Signal handle without calling exit

Vineet Gupta Vineet.Gupta1 at synopsys.com
Wed Feb 10 23:23:32 PST 2016


On Thursday 11 February 2016 12:27 PM, Noam Camus wrote:
>
> Hi Vineet,
>
> In case user caused an exception that kernel turned into sinal that the user
> caught with its own implementation without calling exit.
> What we expect to happen when signal handler ends?
> Would it return to the same instruction the one after it or other?
> Is it in the first forbidden to not call exit?
>
> Noam
>

Some signals can't be caught - and depending on default behaviour kernel will kill
the task - it is not user task which calls exit.
For those where catching is allowed - e.g. segv, if handler doesn't do anything -
kernel will resume at exactly the same instruction.
So u could have an interesting loop in app - if tries to access NULL pointer with
signal handler installed for segv, and that handler does nothing.
Now your signal handler can tweak the register corresponding to PC in sigcontext
(ret for ARC) and kernel will use that for return to userspace - so the faulting
instruction will be avoided.

-Vineet



More information about the linux-snps-arc mailing list