lkml.org 
[lkml]   [2020]   [Jul]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: objtool clac/stac handling change..
Date


> On Jul 1, 2020, at 12:35 PM, Linus Torvalds <torvalds@linux-foundation.org> wrote:
>
> On Wed, Jul 1, 2020 at 11:29 AM Andy Lutomirski <luto@kernel.org> wrote:
>>
>> Do we really want the exception handling to do the CLAC? Having
>> unsafe_get_user() do CLAC seems surprising to me, and it will break
>> use cases like:
>>
>> if (!user_access_begin(...)
>> goto out;
>>
>> ret = unsafe_get_user(...);
>>
>> user_access_end();
>>
>> check ret;
>
> That's not how unsafe_get_user() works.
>
> unsafe_get_user() always jumps to the error label, it never returns a
> value. So the code is actually now what you claim above, but
>
> if (!user_access_begin(...)
> goto out;
>
> unsafe_get_user(..., out_fault);
> user_access_end();
> .. this is good, use the value we got..
>
> out_fault:
> user_access_end();
> out:
> return -EFAULT;

Ugh, right. But maybe, with the asm goto magic, we can’t get rid of this. I’ve always disliked the pattern where we enable user access, do a bunch of accesses that branch on error, and finish up. We ought to be able to do it the way I described and get decent code generation too.

If we do this extable change, we end up with a different mess: some exception handlers will clear AC and some won’t. I’m sure objtool can deal with this with some effort, but I’m not convinced it’s worth it.
\
 
 \ /
  Last update: 2020-07-01 22:36    [W:3.456 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site