[Bug 1922117] Re: URFkill fails to read RFKILL events with latest kernel
William Wilson
1922117 at bugs.launchpad.net
Wed Oct 27 18:40:10 UTC 2021
This bug will not exist in hwe kernels 5.11 or 5.13. Both of those
kernels use a separate rfkill_event and rfkill_event_ext struct with the
following explanation:
/**
* DOC: Extensibility
*
* Originally, we had planned to allow backward and forward compatible
* changes by just adding fields at the end of the structure that are
* then not reported on older kernels on read(), and not written to by
* older kernels on write(), with the kernel reporting the size it did
* accept as the result.
*
* This would have allowed userspace to detect on read() and write()
* which kernel structure version it was dealing with, and if was just
* recompiled it would have gotten the new fields, but obviously not
* accessed them, but things should've continued to work.
*
* Unfortunately, while actually exercising this mechanism to add the
* hard block reasons field, we found that userspace (notably systemd)
* did all kinds of fun things not in line with this scheme:
*
* 1. treat the (expected) short writes as an error;
* 2. ask to read sizeof(struct rfkill_event) but then compare the
* actual return value to RFKILL_EVENT_SIZE_V1 and treat any
* mismatch as an error.
*
* As a consequence, just recompiling with a new struct version caused
* things to no longer work correctly on old and new kernels.
*
* Hence, we've rolled back &struct rfkill_event to the original version
* and added &struct rfkill_event_ext. This effectively reverts to the
* old behaviour for all userspace, unless it explicitly opts in to the
* rules outlined here by using the new &struct rfkill_event_ext.
*
* Userspace using &struct rfkill_event_ext must adhere to the following
* rules
*
* 1. accept short writes, optionally using them to detect that it's
* running on an older kernel;
* 2. accept short reads, knowing that this means it's running on an
* older kernel;
* 3. treat reads that are as long as requested as acceptable, not
* checking against RFKILL_EVENT_SIZE_V1 or such.
*/
This preserves backwards compatibility and therefore does not result in the bug seen previously.
--
You received this bug notification because you are a member of Ubuntu
Sponsors Team, which is subscribed to the bug report.
https://bugs.launchpad.net/bugs/1922117
Title:
URFkill fails to read RFKILL events with latest kernel
Status in urfkill package in Ubuntu:
Fix Released
Bug description:
The kernel has added a byte to the rfkill event struct to account for
a possible reason field. See:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=14486c82612a177cb910980c70ba900827ca0894
urfkill is checking to make sure the rfkill event is exactly 8 bytes,
and therefore failing when the reason field is included.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/urfkill/+bug/1922117/+subscriptions
More information about the Ubuntu-sponsors
mailing list