Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp2332247ima; Thu, 25 Oct 2018 13:24:43 -0700 (PDT) X-Google-Smtp-Source: AJdET5eBbc1oGXk+vtml169e3NOZA9Sm4eGlKwxnkKTB1nOlyiaFVMPxvF3dvYKbJN/N7Q+mdNIf X-Received: by 2002:a62:4681:: with SMTP id o1-v6mr667368pfi.108.1540499082896; Thu, 25 Oct 2018 13:24:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540499082; cv=none; d=google.com; s=arc-20160816; b=KAVrpb4pjou++5HjbQcUlLwWWDSOB9B/iGl/0X1U5VXOxZ5Duwti8fF/iuCBtCGW6/ xIzFa7gD2E7paV7oLI/OIMZqmJ7+7hCXuzAtkTIRBagjBEsRTfEcoVnQ+2QKTam+rhd/ dUUuMLvgTcav/550nwQMxqiSRDFWWhcQw1WyzozvGL5mEPUIwAM3DvWGVRevHzF1ioD7 2T9Z8UetOMdvdWg0XVAgLFWJ1nAG9Sf8Z3BoagE6CmHzU/CIn7RxpAgw8tE/ILpaBFyG FB+e32uDAvFzL3GQRNM7+9tzqoPSyu4T/enpmjqA6/s5kFxNDUSCL0RI8YHgr9oT8aZT Nz6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:mime-version:user-agent :message-id:in-reply-to:date:references:cc:to:from; bh=edpfVFa3/yordMtEWRpXbb8FdY0L9enspVSWbnuQFV8=; b=tmi++ZX7QMUQV7+dRlMQXyAjSXXJIDRfFNWwDWKpdcul4MWYD97iirtcT460NxaLls l/q3FyxCyF/uk0pZtIR2Rlz50EueF/ylBXAJazAv7BB4Z7Ci+BI1Iaf6d4IBjbBWcjcd OKxPvdb8c9E3ZNVcIZ0gmY2IWvKf8Vi8HhcDXAzqoXvwgSXhCQohggCHui8EvOTnYxzN wVZUiokPXYH9JiSfPem9YpiB7Lh6ol6U0HqQf1Gp3me0rILQrSRBcCTx1v4IumiVzWm8 ap6u+1QnkvcGF6ZnQJ/Z09b2KR+/OMZ9qIoXr0vFCjMZ76DuUdV2TwWbzyFtSRyh4CTa pUTA== 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=xmission.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q1-v6si9257922pfb.258.2018.10.25.13.24.26; Thu, 25 Oct 2018 13:24:42 -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=xmission.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726808AbeJZE4Z (ORCPT + 99 others); Fri, 26 Oct 2018 00:56:25 -0400 Received: from out01.mta.xmission.com ([166.70.13.231]:53261 "EHLO out01.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725817AbeJZE4Z (ORCPT ); Fri, 26 Oct 2018 00:56:25 -0400 Received: from in01.mta.xmission.com ([166.70.13.51]) by out01.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1gFm8s-0006sJ-6z; Thu, 25 Oct 2018 14:22:06 -0600 Received: from 67-3-154-154.omah.qwest.net ([67.3.154.154] helo=x220.xmission.com) by in01.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1gFm8c-00036L-0y; Thu, 25 Oct 2018 14:22:05 -0600 From: ebiederm@xmission.com (Eric W. Biederman) To: Jann Horn Cc: enkechen@cisco.com, Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , Peter Zijlstra , Arnd Bergmann , Khalid Aziz , Kate Stewart , deller@gmx.de, Greg Kroah-Hartman , Al Viro , Andrew Morton , christian@brauner.io, Catalin Marinas , Will Deacon , Dave.Martin@arm.com, mchehab+samsung@kernel.org, Michal Hocko , Rik van Riel , "Kirill A . Shutemov" , guro@fb.com, Marcos Souza , Oleg Nesterov , linux@dominikbrodowski.net, Cyrill Gorcunov , yang.shi@linux.alibaba.com, Kees Cook , "the arch\/x86 maintainers" , kernel list , linux-arch , Victor Kamensky , xe-linux-external@cisco.com, sstrogin@cisco.com References: <458c04d8-d189-4a26-729a-bb1d1d751534@cisco.com> <87sh0vpj5q.fsf@xmission.com> Date: Thu, 25 Oct 2018 15:21:23 -0500 In-Reply-To: (Jann Horn's message of "Thu, 25 Oct 2018 15:45:29 +0200") Message-ID: <87va5plqv0.fsf@xmission.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1gFm8c-00036L-0y;;;mid=<87va5plqv0.fsf@xmission.com>;;;hst=in01.mta.xmission.com;;;ip=67.3.154.154;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1989OtyFJm3sh1Atk25SEcrrjFL2OItj6g= X-SA-Exim-Connect-IP: 67.3.154.154 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa06.xmission.com X-Spam-Level: X-Spam-Status: No, score=0.7 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE,TVD_RCVD_IP,T_TM2_M_HEADER_IN_MSG,T_TooManySym_01, T_XMDrugObfuBody_14,XMSubLong autolearn=disabled version=3.4.1 X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * 0.7 XMSubLong Long Subject * 0.0 TVD_RCVD_IP Message was received from an IP address * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa06 1397; Body=1 Fuz1=1 Fuz2=1] * 0.2 T_XMDrugObfuBody_14 obfuscated drug references * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa06 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;Jann Horn X-Spam-Relay-Country: X-Spam-Timing: total 15031 ms - load_scoreonly_sql: 0.03 (0.0%), signal_user_changed: 2.9 (0.0%), b_tie_ro: 2.1 (0.0%), parse: 0.79 (0.0%), extract_message_metadata: 13 (0.1%), get_uri_detail_list: 1.58 (0.0%), tests_pri_-1000: 6 (0.0%), tests_pri_-950: 1.30 (0.0%), tests_pri_-900: 1.14 (0.0%), tests_pri_-90: 31 (0.2%), check_bayes: 29 (0.2%), b_tokenize: 11 (0.1%), b_tok_get_all: 9 (0.1%), b_comp_prob: 2.7 (0.0%), b_tok_touch_all: 3.8 (0.0%), b_finish: 0.66 (0.0%), tests_pri_0: 261 (1.7%), check_dkim_signature: 1.29 (0.0%), check_dkim_adsp: 4.7 (0.0%), tests_pri_10: 2.2 (0.0%), tests_pri_500: 14710 (97.9%), poll_dns_idle: 14694 (97.8%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH v2] kernel/signal: Signal-based pre-coredump notification X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Jann Horn writes: > On Wed, Oct 24, 2018 at 3:30 PM Eric W. Biederman wrote: >> Enke Chen writes: >> > For simplicity and consistency, this patch provides an implementation >> > for signal-based fault notification prior to the coredump of a child >> > process. A new prctl command, PR_SET_PREDUMP_SIG, is defined that can >> > be used by an application to express its interest and to specify the >> > signal (SIGCHLD or SIGUSR1 or SIGUSR2) for such a notification. A new >> > signal code (si_code), CLD_PREDUMP, is also defined for SIGCHLD. >> > >> > Changes to prctl(2): >> > >> > PR_SET_PREDUMP_SIG (since Linux 4.20.x) >> > Set the child pre-coredump signal of the calling process to >> > arg2 (either SIGUSR1, or SIUSR2, or SIGCHLD, or 0 to clear). >> > This is the signal that the calling process will get prior to >> > the coredump of a child process. This value is cleared across >> > execve(2), or for the child of a fork(2). >> > >> > When SIGCHLD is specified, the signal code will be set to >> > CLD_PREDUMP in such an SIGCHLD signal. > [...] >> Ugh. Your test case is even using signalfd. So you don't even want >> this signal to be delivered as a signal. > > Just to make sure everyone's on the same page: You're suggesting that > it might make sense to deliver the pre-dump notification via a new > type of file instead (along the lines of signalfd, timerfd, eventfd > and so on)? My real complaint was that the API was not being tested in the way it is expected to be used. Which makes a test pretty much useless as some aspect userspace could regress and the test would not notice because it is testing something different. I do think that a file descriptor based API might be a good alternative to a signal based API. The proc connector and signals are not the only API solution. The common solution to this problem is that distributions defailt the rlimit core file size to 0. Eric