Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp9328ima; Thu, 25 Oct 2018 14:25:08 -0700 (PDT) X-Google-Smtp-Source: AJdET5dF4h9iMBSJ6AwTbtJZdm+YL3KEr9GMvB8M9M36BhkkXcz1bbUsQWoDkCQIVUh1qpNaG3fS X-Received: by 2002:a63:2218:: with SMTP id i24-v6mr784179pgi.238.1540502708490; Thu, 25 Oct 2018 14:25:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540502708; cv=none; d=google.com; s=arc-20160816; b=a49VN9qqWioYENzvJ9zC2KOaKbDlDAdEamTpEjfQEZMXDwAQoL8QbZOr0PJP28Eg3q VO8Ihl2avGKBO09e2z+KcRqRhKF40LvGEHpCpTY0K6KwMrRDts7DviQDeTiHJoqeajsg M3dFLn2abGWwM349B7Ub9BoLgGFRYcOZLwErbRteMmKxMCLDDzWfnGi4OyUHRjD44PvB Fi2exv7AqMRSOh0nWvTOKW8fYPvBTfqsh/ZIFcZmNcBxhXDD6WfJaYFEUsOl76Cqf0pz dIomRy8LpHYWC1CU38gXGrhrri8ydTWUg6jpG/s+UGGNcL1HsBZlBM7xccex/F68SdXv +RVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=eI2kkPpTLHIot1wcXtBNob2gcE72apn7s/jiaSey4d4=; b=FuWVYGn9Gq5idHlsoYTkgEI0E8/lGKj7xyAklbljF3a4DftEemOemHOPAoh3PERcyU 0DzRY9hZv+WKUyKExIgf76444aHEFmVA0VQ24zW3YLiWT8uM5yL1Ic9r2GG/thBUwynB md11FpykzeApnGbvCYPuyva7RAgxrA/e6sUYiioDBMvoz67Kqy2DG6n0DPepserAG8n0 +b5SKABo4tENVhDFvjl0xkS1fkH9EGVI95XQ+7RtLHmQEDng8hv5BvdoFJHOI0u+aSpO kz7Tia+D1Lk99+HeLSlXVc5nuor9LbT1M8OKqJzcOy0wt56pgcfhmZMrS6P0KsvU7LMn yZjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cisco.com header.s=iport header.b=aagCwDAM; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=cisco.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i13-v6si9091968pgd.311.2018.10.25.14.24.52; Thu, 25 Oct 2018 14:25:08 -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; dkim=pass header.i=@cisco.com header.s=iport header.b=aagCwDAM; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=cisco.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726612AbeJZF6m (ORCPT + 99 others); Fri, 26 Oct 2018 01:58:42 -0400 Received: from alln-iport-7.cisco.com ([173.37.142.94]:12509 "EHLO alln-iport-7.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726085AbeJZF6l (ORCPT ); Fri, 26 Oct 2018 01:58:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=2504; q=dns/txt; s=iport; t=1540502661; x=1541712261; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=4sKv97fOYZgEGmMm61XnqOvfrspEo633ce9zkNjeXMY=; b=aagCwDAMkv2FExUm0QWEGSuT1osphfiGD9nh4nTV4oPN0hzPaY01Iuk6 bRgv75cRTZtAGmGQk8DhsApqmtnHYiV+UVKJfdd3VNz/k7AKH4Uhw6VHo xKfg4O4YhSSA6kTb2KpVIaJEQIjtnC0CAGTEgTphVWKyX4IHsBKmhVQCW I=; X-IronPort-AV: E=Sophos;i="5.54,425,1534809600"; d="scan'208";a="191075932" Received: from rcdn-core-6.cisco.com ([173.37.93.157]) by alln-iport-7.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Oct 2018 21:24:21 +0000 Received: from [10.154.208.133] ([10.154.208.133]) by rcdn-core-6.cisco.com (8.15.2/8.15.2) with ESMTP id w9PLOIkv007227; Thu, 25 Oct 2018 21:24:19 GMT Subject: Re: [PATCH v2] kernel/signal: Signal-based pre-coredump notification To: "Eric W. Biederman" Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Peter Zijlstra , Arnd Bergmann , Khalid Aziz , Kate Stewart , Helge Deller , Greg Kroah-Hartman , Al Viro , Andrew Morton , Christian Brauner , Catalin Marinas , Will Deacon , Dave Martin , Mauro Carvalho Chehab , Michal Hocko , Rik van Riel , "Kirill A. Shutemov" , Roman Gushchin , Marcos Paulo de Souza , Oleg Nesterov , Dominik Brodowski , Cyrill Gorcunov , Yang Shi , Jann Horn , Kees Cook , x86@kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, "Victor Kamensky (kamensky)" , xe-linux-external@cisco.com, Stefan Strogin , Enke Chen References: <458c04d8-d189-4a26-729a-bb1d1d751534@cisco.com> <87sh0vpj5q.fsf@xmission.com> <87zhv2md04.fsf@xmission.com> From: Enke Chen Message-ID: <3da93f7c-972d-14e0-dae2-f0217ba03dc1@cisco.com> Date: Thu, 25 Oct 2018 14:24:19 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <87zhv2md04.fsf@xmission.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Auto-Response-Suppress: DR, OOF, AutoReply X-Outbound-SMTP-Client: 10.154.208.133, [10.154.208.133] X-Outbound-Node: rcdn-core-6.cisco.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Eric: I have a couple comments inlined. >> 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. > > As I stated in a prior email, I have test code for both sigaction/waipid(), and signefd(). As the sigaction/waitpid is more widely used and that is what you prefer, I will change the selftest code to reflect that in the next version. Actually I should separate out the selftest code. > > 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. We do need coredumps in order to have the bugs fixed. Thanks. -- Enke