Re: [PATCH] binfmt_elf: fix return value in case of interpreter load failure

Oleg Nesterov
2013-04-16T14:28:41Z

On 04/15, Andrew Morton wrote:
>
> On Fri, 12 Apr 2013 16:49:50 +0200 Matthieu CASTET <matthieu.castet@parrot.com> wrote:
>
> > The only valid remaining part of my patch is to return SIGKILL when
> > load_elf_interp fail (IS_ERR((void *)elf_entry) is true) (for example load
> > address of linker is bad) instead of SIGSEGV. This will follow what is done when
> > loading binary.
> >
> > But is it even worth doing?
>
> SIGSEGV can be caught

Actually it can't be, flush_signal_handlers() was already called.
SIGSEGV can be blocked/ignored after that, but please note that
force_sig_info(SIGSEGV) will unblock and set SIG_DFL if necessary.

In short, force_sig() will actuallu kill the task in any case.

But: afaics send_sig(SIGSEGV) above load_elf_interp() is wrong,
we should either use SIGKILL (which can't be ignored/blocked) or
force_sig.

> that would be a user-visible change.

Yes. waitpid(&status) can notice the difference.

> I just
> don't know what the implications of such a change would be :(

Mee too... Looks harmless but still.

OTOH, I do not know why/when we should use SIGKILL or SIGSEGV in
this code.

Oleg.