Re: [PATCH] fanotify: Fix fanotify_mark() on 32-bit x86

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

 



On Fri, Nov 27, 2020 at 1:13 PM Andy Lutomirski <luto@xxxxxxxxxx> wrote:
>
> On Thu, Nov 26, 2020 at 7:52 AM Jan Kara <jack@xxxxxxx> wrote:
> >
> > Commit converting syscalls taking 64-bit arguments to new scheme of compat
> > handlers omitted converting fanotify_mark(2) which then broke the
> > syscall for 32-bit x86 builds. Add missed conversion. It is somewhat
> > cumbersome since we need to keep the original compat handler for all the
> > other 32-bit archs.
> >
>
> This is stupendously ugly.  I'm not really sure how this is supposed
> to work on any 32-bit arch.  I'm also not sure whether we should
> expect the SYSCALL_DEFINE macros to figure this out by themselves.

It works on 32-bit arches because the compiler implicitly uses
consecutive input registers or stack slots for 64-bit arguments, and
some arches have alignment requirements that result in hidden padding.
x86-32 is different now because parameters are passed in via pt_regs,
and the 64-bit value has to explicitly be reassembled from the high
and low 32-bit values, just like in the compat case.

I think the simplest way to handle this is add a wrapper in
arch/x86/kernel/sys_ia32.c with the other fs syscalls that need 64-bit
args.  That keeps this mess out of general code.

--
Brian Gerst



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux