4f \n\t "
>> ".popsection \n\t "
>> "1: \n\t "
>> "leaq cs_obj(%%rip), %%rax \n\t "
>> "movq %%rax, % [rseq_cs] \n\t "
>> "cmpl % [cpu_id], % [current_cpu_id] \n\t "
>> "jnz 4f \n\t "
>> /* enable signal testing */
>> "movq $5, %%rdi \n\t "
>> "call sleep@plt \n\t "
>> /*/
>> "jmp % l[committed] \n\t "
>> "2: \n\t "
>> /* Disassembler-friendly signature: nopl (%rip). */
>> ".byte 0x0f, 0x1f, 0x05 \n\t "
>> ".long 0x53053053 \n\t " /* RSEQ_SIG */
>> "4: \n\t "
>> "jmp % l[aborted] \n\t "
>> : /* no outputs */
>> : [cpu_id] "r" (cpu),
>> [current_cpu_id] "m" ( __rseq_abi . cpu_id ),
>> [rseq_cs] "m" ( __rseq_abi . rseq_cs )
>> : "memory" , "cc" , "rax"
>> : aborted, committed
>> );
>> committed:
>> printf ( "committed \n " );
>> return 0 ;
>> aborted:
>> printf ( "aborted \n " );
>> return - 1 ;
>> }
>> void signal_callback_handler ( int signum ) {
>> printf ( "Caught signal %d \n " , signum);
>> }
>> int main ( int argc , char ** argv ) {
>> signal (SIGINT, signal_callback_handler);
>> int cpu, ret;
>> register_thread ();
>> cpu = RSEQ_ACCESS_ONCE ( __rseq_abi . cpu_id_start );
>> printf ( "ret = %d \n " , do_test (cpu));
>> return 0 ;
>> }
> As the screenshot is shown, the program executed the signal handler instead of
> rseq abort handler after interrupted the program.
> I am confused about how rseq deal with signal delivery as I assumed abort
> handler will be triggered anyway when flags permitted. Could you please
> explain
> such two cases or could you please share any references (code, article, etc)
> here?
> Thanks in advance!
> My virtual machine environment:
>> $ cat /etc/os-release
>> NAME="Ubuntu"
>> VERSION="20.04.2 LTS (Focal Fossa)"
>> ...
>> $ uname -r
>> 5.4.0-66-generic
> Best regards,
> Mingyi
> From: Mathieu Desnoyers
> Sent: Wednesday, April 7, 2021 9:25 AM
> To: Liu, Mingyi
> Cc: linux-kernel ; Peter Zijlstra
> ; paulmck ; Boqun Feng
>
> Subject: Re: about seg fault inside rseq critical section
> (re-sent in plain-text for lkml)
> - On Apr 6, 2021, at 6:24 PM, Mingyi Liu mingyi...@gatech.edu wrote:
> > Hi Mathieu,
> > I notice that the program will be terminated with segmentation fault when
> > it is
> > even seg faulted inside the rseq critical section. In Linux kernel rseq.c, I
> > haven't found comment or code regarding this. Could you share any
> > references on
> > why it doesn't execute user defined abort handler but uses the OS handler
> > instead?
> > Thanks in advance!
> Hi Mingyi,
> Please let me add the other rseq maintainers and LKML in CC. I'm a bit
> stretched
> on time
> here, so maybe they will have time to answer before I do.
> Meanwhile, if you could provide details about your architecture, kernel
> .config,
> and a
> small reproducer program, it would help bootstrapping the discussion.
> Thanks,
> Mathieu
> > Best,
> > Mingyi
> --
> Mathieu Desnoyers
> EfficiOS Inc.
> [ http://www.efficios.com/ | http://www.efficios.com ]
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com