stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brian Gerst <brgerst@gmail.com>
To: Andy Lutomirski <luto@kernel.org>
Cc: Jan Kara <jack@suse.cz>, linux-arch <linux-arch@vger.kernel.org>,
	Christoph Hellwig <hch@lst.de>, Al Viro <viro@zeniv.linux.org.uk>,
	Will Deacon <will@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Linux FS Devel <linux-fsdevel@vger.kernel.org>,
	X86 ML <x86@kernel.org>, Borislav Petkov <bp@alien8.de>,
	Thomas Gleixner <tglx@linutronix.de>,
	stable <stable@vger.kernel.org>
Subject: Re: [PATCH] fanotify: Fix fanotify_mark() on 32-bit x86
Date: Mon, 30 Nov 2020 17:21:08 -0500	[thread overview]
Message-ID: <CAMzpN2gkNnqnT3hS4jaHTphO+KdZmC=9Hi4tXk3RV9C-EcwtLQ@mail.gmail.com> (raw)
In-Reply-To: <CALCETrXS8e9BRcpmSYqE5_Cvrt96wUOWK_P2bFWUkD2BozPNbg@mail.gmail.com>

On Fri, Nov 27, 2020 at 7:36 PM Andy Lutomirski <luto@kernel.org> wrote:
>
> On Fri, Nov 27, 2020 at 2:30 PM Brian Gerst <brgerst@gmail.com> wrote:
> >
> > On Fri, Nov 27, 2020 at 1:13 PM Andy Lutomirski <luto@kernel.org> wrote:
> > >
> > > On Thu, Nov 26, 2020 at 7:52 AM Jan Kara <jack@suse.cz> 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.
> >
>
> That was my guess.
>
> > 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.
>
>
> Want to send a patch?

I settled on doing something along the same line as Jan, but in a more
generic way that lays the groundwork for converting more of these
arch-specific compat wrappers to a generic wrapper.

Patch coming soon.

--
Brian Gerst

  reply	other threads:[~2020-11-30 22:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-26 15:52 [PATCH] fanotify: Fix fanotify_mark() on 32-bit x86 Jan Kara
2020-11-27 18:13 ` Andy Lutomirski
2020-11-27 22:30   ` Brian Gerst
2020-11-28  0:36     ` Andy Lutomirski
2020-11-30 22:21       ` Brian Gerst [this message]
2020-12-01  8:30         ` Jan Kara
2020-12-02 10:14 ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMzpN2gkNnqnT3hS4jaHTphO+KdZmC=9Hi4tXk3RV9C-EcwtLQ@mail.gmail.com' \
    --to=brgerst@gmail.com \
    --cc=bp@alien8.de \
    --cc=catalin.marinas@arm.com \
    --cc=hch@lst.de \
    --cc=jack@suse.cz \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=viro@zeniv.linux.org.uk \
    --cc=will@kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).