Re: [PATCH v2 12/19] x86/signal: Land on &frame->retcode when vdso isn't mapped

From: Andy Lutomirski
Date: Tue Nov 24 2020 - 18:09:08 EST


On Mon, Nov 23, 2020 at 4:30 PM Dmitry Safonov <dima@xxxxxxxxxx> wrote:
>
> Since commit 9fbbd4dd17d0 ("x86: Don't require the vDSO for handling
> a.out signals") after processing 32-bit signal if there is no vdso
> mapped frame->retcode is used as a landing.
> Do the same for rt ia32 signals.
> It also makes the ia32 compat signals match the native ia32 case.
>
> This shouldn't be mistaken for encouragement for running binaries with
> executable stack, rather something to do in hopefully very rare
> situation with disabled or unmapped vdso and absent SA_RESTORER.
> For non-executable stack it'll segfault on attempt to land, rather than
> land on a random address where vdso was previously mapped.
> For programs with executable stack it'll just do the same for rt signals
> as for non-rt.
>
> Discouraging users to run with executable stack is done separately in
> commit 47a2ebb7f505 ("execve: warn if process starts with executable
> stack").
>
> Signed-off-by: Dmitry Safonov <dima@xxxxxxxxxx>

The new code is more readable than the old code, too.

Acked-by: Andy Lutomirski <luto@xxxxxxxxxx>