[Letux-kernel] two accelerometers + iio_bridge considered harmful

Andreas Kemnade andreas at kemnade.info
Tue Jul 31 22:45:55 CEST 2018


On Tue, 31 Jul 2018 19:16:53 +0200
Andreas Kemnade <andreas at kemnade.info> wrote:


> [    6.419860] usb usb1: Product: MUSB HDRC host driver
> [    6.430450] iio_device_register_inputbridge(): process channel 3

-> EVIL, EVIL, EVIL

this means access to channels[3] which is an out-of-bound access.
Next thing in row probably
static struct delayed_work input_work;

So how can it happen: between
if (channel >= 3)
                return 0;

and the final
        switch (channel++) {

a lot ot things happen, so enough time for two threads to enter.

So first question is it really worth to make it thread-safe if it is
now so much more sensitive to threading issues or should we better fix
userspace to use iio. What is to fix? Qtmoko (probably easy), Replicant:
Well it should support all the other sensors, too, so it has to use iio
anyways.

Just a note from systemd changelog (which is the source of udev in
stretch and jessie)
* The udev accelerometer helper was removed. The functionality
          is now fully included in iio-sensor-proxy. But this means,
          older iio-sensor-proxy versions will no longer provide
          accelerometer/orientation data with this systemd version.
          Please upgrade iio-sensor-proxy to version 1.0.
That is from 2015-07-07

So userspace has adopted a long time ago.

At least we should heavily test all the threading issues with multiple
accelerometers if we decide to continue the bridge.

Regards,
Andreas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.goldelico.com/pipermail/letux-kernel/attachments/20180731/bcc57ddd/attachment.asc>


More information about the Letux-kernel mailing list