Messages in this thread | | | From | Arnd Bergmann <> | Date | Thu, 1 Oct 2020 17:00:03 +0200 | Subject | Re: [PATCH 2/2] dev_ioctl: split out SIOC?IFMAP ioctls |
| |
On Tue, Sep 29, 2020 at 7:53 PM Christoph Hellwig <hch@infradead.org> wrote: > On Fri, Sep 25, 2020 at 02:28:29PM +0200, Arnd Bergmann wrote:
> > Do you mean we should check that the (larger) user space size > > remains what it is for future changes, or that the (smaller) > > kernel size remains the same on all kernels, or maybe both? > > I had something like: > > BUILD_BUG_ON(sizeof(struct ifmap) > > sizeof(struct ifreq) - IFNAMSIZ); > > plus a suitable comment in mind.
But that condition is true on all 64-bit architectures, which is the fundamental issue I'm working around. I can try to capture that better in the comment though.
My expectation here is that passing the smaller 'ifreq' structure to ndo_do_ioctl() is safe as long as all drivers use only the remaining members of ifr_ifru that all fit into the first 16 bytes. Do you see a problem with that assumption?
Arnd
| |