lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 6 Mar 2017 01:13:52 -0800
From:   "H. Peter Anvin" <hpa@...or.com>
To:     Jiri Slaby <jslaby@...e.cz>, Stafford Horne <shorne@...il.com>
Cc:     Russell King - ARM Linux <linux@...linux.org.uk>,
        akpm@...ux-foundation.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>,
        Will Deacon <will.deacon@....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>,
        "James E.J. Bottomley" <jejb@...isc-linux.org>,
        Helge Deller <deller@....de>,
        Benjamin Herrenschmidt <benh@...nel.crashing.org>,
        Paul Mackerras <paulus@...ba.org>,
        Michael Ellerman <mpe@...erman.id.au>,
        Martin Schwidefsky <schwidefsky@...ibm.com>,
        Heiko Carstens <heiko.carstens@...ibm.com>,
        Yoshinori Sato <ysato@...rs.sourceforge.jp>,
        Rich Felker <dalias@...c.org>
Subject: Re: [PATCH 1/3] futex: remove duplicated code

On 03/06/17 00:46, Jiri Slaby wrote:
> 
>  static int futex_atomic_op_inuser(int encoded_op, u32 __user *uaddr)
>  {
> -       int op = (encoded_op >> 28) & 7;
> -       int cmp = (encoded_op >> 24) & 15;
> -       int oparg = (encoded_op << 8) >> 20;
> -       int cmparg = (encoded_op << 20) >> 20;
> +       int op =                  (encoded_op & 0x70000000) >> 28;
> +       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;
> 

At least in the sign-extend case the mask is unnecessary.

This is why it would be nice to have both sign and zero extend for symmetry.

	-hpa


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ