On Tue, Dec 10, 2019 at 10:06:04AM +0100, Bartosz Golaszewski wrote: > śr., 4 gru 2019 o 20:42 Andy Shevchenko > <andriy.shevchenko@xxxxxxxxxxxxxxx> napisał(a): > > > > The introduced line even handling ABI in the commit > > > > 61f922db7221 ("gpio: userspace ABI for reading GPIO line events") > > > > missed the fact that 64-bit kernel may serve for 32-bit applications. > > In such case the very first check in the lineevent_read() will fail > > due to alignment differences. > > > > To workaround this we do several things here: > > - put warning comment to UAPI header near to the structure description > > - derive the size of the structure in the compatible mode from its members > > - check for the size of this structure in the ->read() callback > > - return only one event in the compatible mode at a time > > > > Above mitigation will work at least with libgpiod which does one event > > at a time. > > > > Since the bug hasn't been reported earlier we assume that there is close > > to zero actual users of the compatible mode to monitor GPIO events and thus > > we might consider to rework this ABI in the future. > > > > How come this only affects the read operation but not the structures > passed as arguments to ioctl() calls? On x86 the rest of the structures is naturally aligned by 8 bytes. But you are right, the ABI is broken more widely than simple ->read(). -- With Best Regards, Andy Shevchenko