lkml.org 
[lkml]   [2015]   [Apr]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] x86/uaccess: Implement get_kernel()
From
On Fri, Apr 10, 2015 at 11:04 AM, Ingo Molnar <mingo@kernel.org> wrote:
>
>>
>> So maybe "get_kernel_stalepointer()" or something like that.
>
> Ok.

Note that I'm not at all married to that particular name, I just want
something that describes the requirements a bit more.

>> - 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()"
>
> Will try.
>
> The only possible complication there might be the way we don't recover
> the error code in the _ex() variants, that's actually a pretty
> important aspect to making this zero cost.

Yeah. You may be right. What I would really want is that "asm goto"
with an output register, but gcc doesn't do that. Then we could
improve on the whole try/catch thing too, so that it would just jump
to the catch..

>> #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
>
> I guess you meant that to be the other way around?

Yes I did.

Linus


\
 
 \ /
  Last update: 2015-04-10 20:41    [W:0.148 / U:0.388 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site