Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 14 Jun 2020 19:26:07 +1000
From: Nicholas Piggin <npiggin@...il.com>
To: Segher Boessenkool <segher@...nel.crashing.org>
Cc: libc-dev@...ts.llvm.org, linux-api@...r.kernel.org,
	linuxppc-dev@...ts.ozlabs.org, musl@...ts.openwall.com
Subject: Re: Linux powerpc new system call instruction and ABI

Excerpts from Segher Boessenkool's message of June 12, 2020 7:02 am:
> Hi!
> 
> On Thu, Jun 11, 2020 at 06:12:01PM +1000, Nicholas Piggin wrote:
>> Calling convention
>> ------------------
>> The proposal is for scv 0 to provide the standard Linux system call ABI 
>> with the following differences from sc convention[1]:
>> 
>> - lr is to be volatile across scv calls. This is necessary because the 
>>   scv instruction clobbers lr. From previous discussion, this should be 
>>   possible to deal with in GCC clobbers and CFI.
>> 
>> - cr1 and cr5-cr7 are volatile. This matches the C ABI and would allow the
>>   kernel system call exit to avoid restoring the volatile cr registers
>>   (although we probably still would anyway to avoid information leaks).
>> 
>> - Error handling: The consensus among kernel, glibc, and musl is to move to
>>   using negative return values in r3 rather than CR0[SO]=1 to indicate error,
>>   which matches most other architectures, and is closer to a function call.
> 
> What about cr0 then?  Will it be volatile as well (exactly like for
> function calls)?

Yes, same as for sc (except for SO bit). Which is a bit unclear in this
section.

>> Notes
>> -----
>> - r0,r4-r8 are documented as volatile in the ABI, but the kernel patch as
>>   submitted currently preserves them. This is to leave room for deciding
>>   which way to go with these.
> 
> The kernel has to set it to *something* that doesn't leak information ;-)

For "sc" system calls these were defined as volatile (and used to just 
leak information), so now we just zero them.

Thanks,
Nick

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.