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:   Fri, 23 Oct 2020 21:52:16 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Linus Torvalds' <torvalds@...ux-foundation.org>,
        Peter Anvin <hpa@...or.com>
CC:     Rasmus Villemoes <linux@...musvillemoes.dk>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        the arch/x86 maintainers <x86@...nel.org>,
        "Sean Christopherson" <sean.j.christopherson@...el.com>,
        Naresh Kamboju <naresh.kamboju@...aro.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] x86/uaccess: fix code generation in put_user()

From: Linus Torvalds
> Sent: 23 October 2020 22:11
> 
> On Fri, Oct 23, 2020 at 2:00 PM <hpa@...or.com> wrote:
> >
> > There is no same reason to mess around with hacks when we are talking about dx:ax, though.
> 
> Sure there is.
> 
> "A" doesn't actually mean %edx:%eax like you seem to think.
> 
> It actually means %eax OR %edx, and then if given a 64-bit value, it
> will use the combination (with %edx being the high bits).
> 
> So using "A" unconditionally doesn't work - it gives random behavior
> for 32-bit (or smaller) types.
> 
> Or you'd have to cast the value to always be 64-bit, and have the
> extra code generation.
> 
> IOW, an unconditional "A" is wrong.
> 
> And the alternative is to just duplicate things, and go back to the
> explicit size testing, but honestly, I really think that's much worse
> than relying on a documented feature of "register asm()" that gcc
> _documents_ is for this kind of inline asm use.

Could do_put_user() do an initial check for 64 bit
then expand a different #define that contains the actual
code passing either "a" or "A" for the constriant.

Apart from another level of indirection nothing is duplicated.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ