Created attachment 244424 [details] truss -f wc /dev/wmistat0 If I cat /dev/wmistat0 I see GUID INST EXPE METH STR EVENT OID {ABBC0F6A-8EA1-11D1-00A0-C90629100000} 1 NO WMAA NO NO AA {05901221-D566-11D1-B2F0-00A0C9062910} 1 NO NO NO NO BA If instead I wc /dev/wmistat0 I see a "Bad file descriptor" error. The may be related to capsicum sandboxing. Output of truss is attached.
Driver function acpi_wmi_wmistat_read prohibits reads except by the same process ID that opened the device. The PID check was in the first version of the driver in 2009. This is a very odd restriction. It is stricter than allowing only one file descriptor to attach to the device or only allowing the generated data to be read once.
https://reviews.freebsd.org/D41621
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=28977cb9bc15a7f1fb7d28e14cd03f8dafd4e155 commit 28977cb9bc15a7f1fb7d28e14cd03f8dafd4e155 Author: Dag-Erling Smørgrav <des@FreeBSD.org> AuthorDate: 2023-08-29 17:23:16 +0000 Commit: Dag-Erling Smørgrav <des@FreeBSD.org> CommitDate: 2023-08-29 17:23:16 +0000 wmistat: don't restrict reading to the pid that opened the fd. PR: 273405 MFC after: 1 week Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D41621 sys/dev/acpi_support/acpi_wmi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
A commit in branch stable/14 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=f41c23ee5b347c422f79630345af8a22bc9a5190 commit f41c23ee5b347c422f79630345af8a22bc9a5190 Author: Dag-Erling Smørgrav <des@FreeBSD.org> AuthorDate: 2023-08-29 17:23:16 +0000 Commit: Dag-Erling Smørgrav <des@FreeBSD.org> CommitDate: 2023-09-07 20:28:30 +0000 wmistat: don't restrict reading to the pid that opened the fd. PR: 273405 MFC after: 1 week Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D41621 (cherry picked from commit 28977cb9bc15a7f1fb7d28e14cd03f8dafd4e155) Approved by: re (gjb) sys/dev/acpi_support/acpi_wmi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
A commit in branch stable/12 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=9f9ba5669212d3df01d007fb54056e37814fc438 commit 9f9ba5669212d3df01d007fb54056e37814fc438 Author: Dag-Erling Smørgrav <des@FreeBSD.org> AuthorDate: 2023-08-29 17:23:16 +0000 Commit: Dag-Erling Smørgrav <des@FreeBSD.org> CommitDate: 2023-09-08 10:12:21 +0000 wmistat: don't restrict reading to the pid that opened the fd. PR: 273405 MFC after: 1 week Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D41621 (cherry picked from commit 28977cb9bc15a7f1fb7d28e14cd03f8dafd4e155) sys/dev/acpi_support/acpi_wmi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=17ed300f0833c8e6dd6bce95748f5dbe33050a3c commit 17ed300f0833c8e6dd6bce95748f5dbe33050a3c Author: Dag-Erling Smørgrav <des@FreeBSD.org> AuthorDate: 2023-08-29 17:23:16 +0000 Commit: Dag-Erling Smørgrav <des@FreeBSD.org> CommitDate: 2023-09-08 10:09:22 +0000 wmistat: don't restrict reading to the pid that opened the fd. PR: 273405 MFC after: 1 week Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D41621 (cherry picked from commit 28977cb9bc15a7f1fb7d28e14cd03f8dafd4e155) sys/dev/acpi_support/acpi_wmi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)