[cfarm-users] gcc110 crash

Adhemerval Zanella zatrazz at gmail.com
Thu Feb 14 17:12:18 CET 2019



Inviato da iPhone

> Il giorno 14 feb 2019, alle ore 13:59, Segher Boessenkool <segher at kernel.crashing.org> ha scritto:
> 
> Hi Adhemerval,
> 
>> On Thu, Feb 14, 2019 at 10:43:57AM -0200, zatrazz via cfarm-users wrote:
>> I think I hit a nasty kernel bug testing rt_sigreturn syscall while trying
>> to understand why it was failing on powerpc64.
> 
> Thanks for letting use know.
> 
>> If anyone is curious I
>> changed the way swapcontext is done for powerpc64 to pass the new context
>> as r9:
>> 
>> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S
>> b/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S
>> index af5b108..dcd97ca 100644
>> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S
>> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S
>> @@ -787,7 +787,7 @@ L(error_exit):
>>      R1 pointing at the dummy frame) state.  We do have the ucontext
>>      address in R3, so simply copy R3 to R1 before the syscall.  */
>> L(do_sigret):
>> -  mr   r1,r3,
>> +  mr   r9,r3,
>>   li   r0,SYS_ify(rt_sigreturn)
>>   sc
>>   /* No return.  */
>> 
>> And issue a program that calls swapcontext in a signal handler using the
>> third argument (configured with SA_SIGINFO). This seems to be an issue with
>> certain specific kernel version since newer kernels handle the context
>> information without resorting in syscall argument handling.
>> 
>> Anyway just a heads up that this is probably a nasty issue affecting
>> CentOS7.
> 
> Please tell linuxppc-dev@?
> 

I will try to create a testcase and check on an emulated system first.

> Please don't do such experiments on the cfarm systems (or any other shared
> systems), btw...  If you expect it may crash the system, don't do it, there
> are other users that want to use the systems, too.  But don't feel to bad,
> this stuff happens, just take better care next time :-)
> 
> 
> Segher

I wasn’t fuzzing syscalls or anything and I did not expect to crash (sorry for that btw). The syscall is used on glibc for swapcontext since forever and I was trying to understand *why* it was added at first place since swapcontext for signal handler is UB.



More information about the cfarm-users mailing list