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]
Message-ID: <CA+55aFz-MWpRG7i5GQqM5o26e0jstxSAXLx9b1vD7hN5LXDt3Q@mail.gmail.com>
Date:	Fri, 10 Apr 2015 10:49:21 -0700
From:	Linus Torvalds <torvalds@...ux-foundation.org>
To:	Ingo Molnar <mingo@...nel.org>
Cc:	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
	Jason Low <jason.low2@...com>,
	Peter Zijlstra <peterz@...radead.org>,
	Davidlohr Bueso <dave@...olabs.net>,
	Tim Chen <tim.c.chen@...ux.intel.com>,
	Aswin Chandramouleeswaran <aswin@...com>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] x86/uaccess: Implement get_kernel()

On Fri, Apr 10, 2015 at 4:14 AM, Ingo Molnar <mingo@...nel.org> wrote:
>
>>
>> The next patch will implement efficient __copy_from_kernel_inatomic()
>> for x86.
>
> The patch below does that. Note, for simplicity I've changed the
> interface to 'get_kernel()' (will propagate this through the other
> patches as well).

So I think this needs a couple of changes:

 - That "get_kernel()" name is not clear enough about what the issue
is. I think it should make it clearer that it's an unsafe access that
could fault, and that we don't want a user access.

    So maybe "get_kernel_stalepointer()" or something like that.

 - you're just re-implementing "__get_user_asm_ex()" afaik. Try to
share the code, renaming it to be something common.

 - I think we should look at sharing the code for __get_user(). Could
we do something like this:

     (a) implement the basic "load with exceptions" as __get_with_exception()
     (b) #define get_kernel_stalepointer() __get_with_exception
     (c) make "__get_user()" be "stac(); __get_with_exception(); clac()"

 - finally, I wonder what the exact semantics of
"get_kernel_stalepointer()" should be. I could well imagine that what
we should do is

        #ifdef CONFIG_DEBUG_PAGEALLOC
            #define get_kernel_stalepointer(x,ptr) ((x)=READ_ONCE(*(ptr)), 0)
        #else
           #define get_kernel_stalepointer(x,ptr) __get_with_exception(x,ptr)
        #endif

because I think it's reasonable to require that the kernel pointer is
_stale_, and not "invalid". IOW, guarantee that it *has* been a kernel
pointer, and that the only reason it would trap is for
DEBUG_PAGEALLOC.

That last point might need to be verified with hotplug memory. I think
hotplug memory does a stop_machine() or similar, but I'm not sure.

Hmm?

                         Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ