From mboxrd@z Thu Jan 1 00:00:00 1970 From: Greg Kroah-Hartman Date: Fri, 18 May 2018 09:01:41 +0000 Subject: Re: [PATCH 4.9 27/33] futex: Remove duplicated code and fix undefined behaviour Message-Id: <20180518090141.GA10227@kroah.com> List-Id: References: <20180518081535.096308218@linuxfoundation.org> <20180518081536.166573281@linuxfoundation.org> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: quoted-printable To: Jiri Slaby Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Thomas Gleixner , Russell King , "Darren Hart (VMware)" , linux-mips@linux-mips.org, Rich Felker , linux-ia64@vger.kernel.org, linux-sh@vger.kernel.org, peterz@infradead.org, Benjamin Herrenschmidt , Max Filippov , Paul Mackerras , sparclinux@vger.kernel.org, Jonas Bonn , linux-s390@vger.kernel.org, linux-arch@vger.kernel.org, Yoshinori Sato , linux-hexagon@vger.kernel.org, Helge Deller , "James E.J. Bottomley" , Catalin Marinas , Matt Turner On Fri, May 18, 2018 at 10:30:24AM +0200, Jiri Slaby wrote: > On 05/18/2018, 10:16 AM, Greg Kroah-Hartman wrote: > > 4.9-stable review patch. If anyone has any objections, please let me k= now. > >=20 > > ------------------ > >=20 > > From: Jiri Slaby > >=20 > > commit 30d6e0a4190d37740e9447e4e4815f06992dd8c3 upstream. > ... > > --- a/kernel/futex.c > > +++ b/kernel/futex.c > > @@ -1458,6 +1458,45 @@ out: > > return ret; > > } > > =20 > > +static int futex_atomic_op_inuser(unsigned int encoded_op, u32 __user = *uaddr) > > +{ > > + unsigned int op =3D (encoded_op & 0x70000000) >> 28; > > + unsigned int cmp =3D (encoded_op & 0x0f000000) >> 24; > > + int oparg =3D sign_extend32((encoded_op & 0x00fff000) >> 12, 12); > > + int cmparg =3D sign_extend32(encoded_op & 0x00000fff, 12); >=20 > 12 is wrong here =E2=80=93 wherever you apply this, you need also a follo= w-up fix: > commit d70ef22892ed6c066e51e118b225923c9b74af34 > Author: Jiri Slaby > Date: Thu Nov 30 15:35:44 2017 +0100 >=20 > futex: futex_wake_op, fix sign_extend32 sign bits Thanks for letting me know, I've now queued it up to the needed trees. greg k-h