From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx3-rdu2.redhat.com ([66.187.233.73]:42092 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729841AbeHCPfv (ORCPT ); Fri, 3 Aug 2018 11:35:51 -0400 Date: Fri, 3 Aug 2018 15:39:24 +0200 From: Oleg Nesterov To: Dmitry Safonov <0x7f454c46@gmail.com> Cc: Ivan Delalande , Al Viro , linux-fsdevel@vger.kernel.org, open list , Andy Lutomirski Subject: Re: [PATCH RESEND] exec: don't force_sigsegv processes with a pending fatal signal Message-ID: <20180803133923.GA19752@redhat.com> References: <20180731005615.GA2911@visor> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On 08/02, Dmitry Safonov wrote: > > Hi Ivan, > > 2018-07-31 1:56 GMT+01:00 Ivan Delalande : > > 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 > > +Cc: Oleg Nesterov > +Cc: Andy Lutomirski Thanks... and sorry, I fail to understand the problem and what/how this patch tries to fix. Hmm. After I read the next email from Dmitry it seems to me that the whole purpose of this patch is to avoid print_fatal_signal()? If yes, the changelog should clearly explain this. > > --- 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 won't argue, but may be force_sigsegv() should check fatal_signal_pending() itself. setup_rt_frame() can too fail if fatal_signal_pending() by the same reason. Oleg.