Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5034803imu; Tue, 8 Jan 2019 10:19:20 -0800 (PST) X-Google-Smtp-Source: ALg8bN7nKipvTU45CJNQ+jRarMNC6qsVzXQBj3lctIH7zbCO4cfqKfYPg6wP44e2Ni1Sxl6F4F6K X-Received: by 2002:a63:b24a:: with SMTP id t10mr2372140pgo.223.1546971560495; Tue, 08 Jan 2019 10:19:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546971560; cv=none; d=google.com; s=arc-20160816; b=qarjK94Zyx7xiPC5+2iaI5S0VcbkXfycg6TJnmrgN9hkx18fU+kwsYcDelDUedvVKt YnHlOBKJnJ8awjdZRv+rvAUIZ3rfYecOwt+BJVaJi+3aSgMzuGnCcLjum+jqJNHhv12/ JYx5LkxtuZYXsTTbBkqM90B8A2DlQ90o6krbPFSc6lSs7rF7FbFCY8zZmnaUZ78dtG/4 uRGgNECq71JZhV/YqmMM53d3tHHbpu3E0xw5M8qt3btpo7P48lFjgT39DPqPFQMP4tvp gE2UhWqzO2vKfMdREyKbs3nTh3fibqookW4ndDRXEngxAAwZxer3r2PYMwqI71LvoXnb rlwQ== 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; bh=OeWb76GaFTvxFq/kWTjSdnoE81H77812/cwRe/MffJQ=; b=MDnQTsax6yeFaxtR0TRkgQP0MzGPvnbGtBVFSvNxLYb2zEpMmxCUUEPuf/EvKmTdpl 0417OTEirF7BPCuLNR1kPCVQfYOR+hlRFDuC1ytIAMPZonEbl5e+DJYbveNqzuF9KSJ/ OEebe2bprDAitay7pQ87ljV5es0cK5vb4vv1nM7E2kVIdKx73Q41mbMRKIkoUvpcQ4Pr BAkvojD13ZtZXRPusE6ud+Dj0Qhb5djVGxp7RROOM2ZGB3OoV8IOvViQcpvSH0oAGv99 5Mo5K8u2sz/HKTxoENqw9e1fNfXbL3f+vSmfH2oXeTc3tYCvjdaPi4fOFNJ9LnmaIEVi U/hA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d9si14559332pgb.105.2019.01.08.10.19.05; Tue, 08 Jan 2019 10:19:20 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729428AbfAHSRp (ORCPT + 99 others); Tue, 8 Jan 2019 13:17:45 -0500 Received: from mail.hallyn.com ([178.63.66.53]:40998 "EHLO mail.hallyn.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727484AbfAHSRo (ORCPT ); Tue, 8 Jan 2019 13:17:44 -0500 Received: by mail.hallyn.com (Postfix, from userid 1001) id AEDB0107D; Tue, 8 Jan 2019 12:17:42 -0600 (CST) Date: Tue, 8 Jan 2019 12:17:42 -0600 From: "Serge E. Hallyn" To: Tycho Andersen Cc: "Serge E. Hallyn" , Christian Brauner , linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, luto@kernel.org, arnd@arndb.de, keescook@chromium.org, akpm@linux-foundation.org, jannh@google.com, oleg@redhat.com, cyphar@cyphar.com, viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org, dancol@google.com, timmurray@google.com, fweimer@redhat.com, tglx@linutronix.de, x86@kernel.org, ebiederm@xmission.com Subject: Re: [PATCH v7 2/2] selftests: add tests for pidfd_send_signal() Message-ID: <20190108181742.GA22614@mail.hallyn.com> References: <20190102161654.9093-1-christian@brauner.io> <20190102161654.9093-2-christian@brauner.io> <20190108175306.GF29009@cisco> <20190108175415.GA22353@mail.hallyn.com> <20190108175843.GA26016@cisco> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190108175843.GA26016@cisco> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 08, 2019 at 10:58:43AM -0700, Tycho Andersen wrote: > On Tue, Jan 08, 2019 at 11:54:15AM -0600, Serge E. Hallyn wrote: > > On Tue, Jan 08, 2019 at 10:53:06AM -0700, Tycho Andersen wrote: > > > On Wed, Jan 02, 2019 at 05:16:54PM +0100, Christian Brauner wrote: > > > > + /* > > > > + * Stop the child so we can inspect whether we have > > > > + * recycled pid PID_RECYCLE. > > > > + */ > > > > + close(pipe_fds[0]); > > > > + ret = kill(recycled_pid, SIGSTOP); > > > > + close(pipe_fds[1]); > > > > + if (ret) { > > > > + (void)wait_for_pid(recycled_pid); > > > > + _exit(PIDFD_ERROR); > > > > + } > > > > > > Sorry for being late to the party, but I wonder if this whole thing > > > couldn't be simplified with /proc/sys/kenrel/ns_last_pid? > > > > no, bc it's not namespaced :) > > Huh? It looks like it is... > > static int pid_ns_ctl_handler(struct ctl_table *table, int write, > void __user *buffer, size_t *lenp, loff_t *ppos) > { > struct pid_namespace *pid_ns = task_active_pid_ns(current); > struct ctl_table tmp = *table; > int ret, next; > > if (write && !ns_capable(pid_ns->user_ns, CAP_SYS_ADMIN)) > return -EPERM; > > ... Oh - hah, but that's ns_last_pid. You'd want pid_max. And that one is not namespaced.