Re: [PATCH v2] btrfs: assert sizes of ioctl structures

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 14, 2020 at 02:49:31PM +0000, Johannes Thumshirn wrote:
> On 14/07/2020 14:33, David Sterba wrote:
> > On Tue, Jul 14, 2020 at 06:32:36PM +0900, Johannes Thumshirn wrote:
> >> When expanding ioctl interfaces we want to make sure we're not changing
> >> the size of the structures, otherwise it can lead to incorrect transfers
> >> between kernel and user-space.
> >>
> >> Build time assert the size of each structure so we're not running into any
> >> incompatibilities.
> >>
> >> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@xxxxxxx>
> > 
> > I've tried 32bit build and the assertion fails for many structures, but
> > I was expecting only the send one because it contains the pointer.
> 
> I wonder if we should have two different asserts for 32 and 64bit for 
> these structures or remove the asserts from them.
> 
> Having a 32 and 64bit assert will add some ifdeffery, let me see how 
> ugly this will get.

Progs do the switch using sizeof(long) and ?: operator but I don't know
if this works with _Static_assert as progs use the struct + bitfield
way.



[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux