Signal handle without calling exit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux