Re: [PATCH v8 3/7] kernel: Implement selective syscall userspace redirection
From: Gabriel Krisman Bertazi
Date: Thu Jul 01 2021 - 13:09:31 EST
ebiederm@xxxxxxxxxxxx (Eric W. Biederman) writes:
> Why does do_syscal_user_dispatch call do_exit(SIGSEGV) and
> do_exit(SIGSYS) instead of force_sig(SIGSEGV) and force_sig(SIGSYS)?
>
> Looking at the code these cases are not expected to happen, so I would
> be surprised if userspace depends on any particular behaviour on the
> failure path so I think we can change this.
Hi Eric,
There is not really a good reason, and the use case that originated the
feature doesn't rely on it.
Unless I'm missing yet another problem and others correct me, I think
it makes sense to change it as you described.
> Is using do_exit in this way something you copied from seccomp?
I'm not sure, its been a while, but I think it might be just that. The
first prototype of SUD was implemented as a seccomp mode.
> The reason I am asking is that by using do_exit you deprive userspace
> of the change to catch the signal handler and try and fix things.
>
> Also by using do_exit only a single thread of a multi-thread application
> is terminated which seems wrong.
>
> I am asking because I am going through the callers of do_exit so I can
> refactor things and clean things up and this use just looks wrong.
Thanks,
--
Gabriel Krisman Bertazi