lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJwJo6bmFZ+2wni1d-t2hh_RqYvnN2c+NJPNyrBLp9H=StTZFg@mail.gmail.com>
Date:   Thu, 2 Aug 2018 20:53:41 +0100
From:   Dmitry Safonov <0x7f454c46@...il.com>
To:     Ivan Delalande <colona@...sta.com>
Cc:     Al Viro <viro@...iv.linux.org.uk>, linux-fsdevel@...r.kernel.org,
        open list <linux-kernel@...r.kernel.org>,
        Oleg Nesterov <oleg@...hat.com>,
        Andy Lutomirski <luto@...nel.org>
Subject: Re: [PATCH RESEND] exec: don't force_sigsegv processes with a pending
 fatal signal

Hi Ivan,

2018-07-31 1:56 GMT+01:00 Ivan Delalande <colona@...sta.com>:
> We were seeing unexplained segfaults in coreutils processes and other
> basic utilities that we tracked down to binfmt_elf failing to load
> segments for ld.so. Digging further, the actual problem seems to occur
> when a process gets sigkilled while it is still being loaded by the
> kernel. In our case when _do_page_fault goes for a retry it will return
> early as it first checks for fatal_signal_pending(), so load_elf_interp
> also returns with error and as a result search_binary_handler will
> force_sigsegv() which is pretty confusing as nothing actually failed
> here.
>
> Fixes: 19d860a140be ("handle suicide on late failure exits in execve() in search_binary_handler()")
> Reference: https://lkml.org/lkml/2013/2/14/5
> Signed-off-by: Ivan Delalande <colona@...sta.com>

+Cc: Oleg Nesterov <oleg@...hat.com>
+Cc: Andy Lutomirski <luto@...nel.org>

> ---
>  fs/exec.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/exec.c b/fs/exec.c
> index bdd0eacefdf5..6e8007edbb2d 100644
> --- a/fs/exec.c
> +++ b/fs/exec.c
> @@ -1656,7 +1656,8 @@ int search_binary_handler(struct linux_binprm *bprm)
>                 if (retval < 0 && !bprm->mm) {
>                         /* we got to flush_old_exec() and failed after it */
>                         read_unlock(&binfmt_lock);
> -                       force_sigsegv(SIGSEGV, current);
> +                       if (!fatal_signal_pending(current))
> +                               force_sigsegv(SIGSEGV, current);

I would suggest to add something like:
: if (print_fatal_signals)
:         pr_info("load_binary() failed: %d\n", retval);

It was interesting to catch that it actually segfaults during loading,
probably will save someone a couple of minutes too ;-)

>                         return retval;
>                 }
>                 if (retval != -ENOEXEC || !bprm->file) {

Thanks,
             Dmitry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ