[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.20.1708252243020.2124@nanos>
Date: Fri, 25 Aug 2017 22:43:41 +0200 (CEST)
From: Thomas Gleixner <tglx@...utronix.de>
To: Will Deacon <will.deacon@....com>
cc: Jiri Slaby <jslaby@...e.cz>, mingo@...hat.com,
dvhart@...radead.org, peterz@...radead.org,
linux-kernel@...r.kernel.org, Richard Henderson <rth@...ddle.net>,
Ivan Kokshaysky <ink@...assic.park.msu.ru>,
Matt Turner <mattst88@...il.com>,
Vineet Gupta <vgupta@...opsys.com>,
Catalin Marinas <catalin.marinas@....com>,
Richard Kuo <rkuo@...eaurora.org>,
Tony Luck <tony.luck@...el.com>,
Fenghua Yu <fenghua.yu@...el.com>,
Michal Simek <monstr@...str.eu>,
Ralf Baechle <ralf@...ux-mips.org>,
Jonas Bonn <jonas@...thpole.se>,
Stefan Kristiansson <stefan.kristiansson@...nalahti.fi>,
Stafford Horne <shorne@...il.com>,
"James E.J. Bottomley" <jejb@...isc-linux.org>,
Helge Deller <deller@....de>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>,
Martin Schwidefsky <schwidefsky@...ibm.com>,
Yoshinori Sato <ysato@...rs.sourceforge.jp>,
Rich Felker <dalias@...c.org>,
"David S. Miller" <davem@...emloft.net>,
"H. Peter Anvin" <hpa@...or.com>, Chris Zankel <chris@...kel.net>,
Max Filippov <jcmvbkbc@...il.com>,
Arnd Bergmann <arnd@...db.de>, x86@...nel.org,
linux-alpha@...r.kernel.org, linux-snps-arc@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org,
linux-hexagon@...r.kernel.org, linux-ia64@...r.kernel.org,
linux-mips@...ux-mips.org, openrisc@...ts.librecores.org,
linux-parisc@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
linux-s390@...r.kernel.org, linux-sh@...r.kernel.org,
sparclinux@...r.kernel.org, linux-xtensa@...ux-xtensa.org,
linux-arch@...r.kernel.org
Subject: Re: [PATCH v2 1/1] futex: remove duplicated code and fix UB
On Thu, 24 Aug 2017, Will Deacon wrote:
> On Thu, Aug 24, 2017 at 09:31:05AM +0200, Jiri Slaby wrote:
> > +static int futex_atomic_op_inuser(unsigned int encoded_op, u32 __user *uaddr)
> > +{
> > + unsigned int op = (encoded_op & 0x70000000) >> 28;
> > + unsigned int cmp = (encoded_op & 0x0f000000) >> 24;
> > + int oparg = sign_extend32((encoded_op & 0x00fff000) >> 12, 12);
> > + int cmparg = sign_extend32(encoded_op & 0x00000fff, 12);
> > + int oldval, ret;
> > +
> > + if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) {
> > + if (oparg < 0 || oparg > 31)
> > + return -EINVAL;
> > + oparg = 1 << oparg;
> > + }
> > +
> > + if (!access_ok(VERIFY_WRITE, uaddr, sizeof(u32)))
> > + return -EFAULT;
> > +
> > + ret = arch_futex_atomic_op_inuser(op, oparg, &oldval, uaddr);
> > + if (ret)
> > + return ret;
>
> We could move the pagefault_{disable,enable} calls here, and then remove
> them from the futex_atomic_op_inuser callsites elsewhere in futex.c
Correct, but we can do that after getting this in.
Thanks,
tglx
Powered by blists - more mailing lists