Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp481223imm; Fri, 3 Aug 2018 06:40:30 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfl3FvMw9yJSLpRfVpkdhP7Bni8wp5K2UDPfQjTcpzEW2ELIjCvmuWmNppMbiTFARjTYQLc X-Received: by 2002:a62:4308:: with SMTP id q8-v6mr4684908pfa.86.1533303630229; Fri, 03 Aug 2018 06:40:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533303630; cv=none; d=google.com; s=arc-20160816; b=mpBwnJ83ibQdo63TF3UPBskNSURM1uJDLfMZH25mnnHpKT3axsFyQhSzz80DxCKkd7 79NVbtCTThtyQszkUlc4D1mqP0HWaJ63Zq1kWOXeUwGd3oEp14zyKoNQxTj7UDTaYF1y J1cFuuyblPUaeKAZWwsCJLmszUGxPXN5VC4noswHG3iMCIQiEeHBWTy7Oll6ndinq7TD l6/CpFTGLn/SW8RbnS7a5k69EcCBarqmyBHb4odjl6XkYqvGZoqViPMwqw3lCkE629Ql jF7VzJUamvC33qWGJgBdm7U4X9j8F3O1qsx0InjRzLu7aYqMjGSh4OW22ijYlWbRQIJ0 QOBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=9wbPuDluMq5j9ot4pW4IlrUbNQjE7Jo69zYLfOWDR0s=; b=HlHZAHUrtrl5cTA/pI1XUdtuwbK+1AIi2aSNUIpLTx647zsqds0dDR0YUjar/9Oiph CkegoC4BJ/TwpnfpRrkShdyd2opksxW2UxC2DMTyx10XelxixjzzBevuQikCQUp5efnp F8K0yLQ0Mzv0Y/zRFQ4yPDOhHJywKq0h5fH3Agagv7F76gDG2d0cnpimVpur8muHtfcZ MdH64IxZDRZzzTYe4iEnBhYwEVo1WM1bMtuOtnB6c4NKd0MNeFO1gTPJj96nxTxi+jkC IGUk5q1C8I5KSEHm9smRQdp74Yeo7gpQHjUeVF811v4BeQVuWWuqxjnb7pcFfbkKwkkc GEwA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u7-v6si5627701pfi.96.2018.08.03.06.40.15; Fri, 03 Aug 2018 06:40:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731986AbeHCPfv (ORCPT + 99 others); Fri, 3 Aug 2018 11:35:51 -0400 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 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 322BD40216F7; Fri, 3 Aug 2018 13:39:26 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.34.27.30]) by smtp.corp.redhat.com (Postfix) with SMTP id F009410CD79E; Fri, 3 Aug 2018 13:39:24 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Fri, 3 Aug 2018 15:39:25 +0200 (CEST) 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: User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 03 Aug 2018 13:39:26 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 03 Aug 2018 13:39:26 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'oleg@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.