Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4465891img; Tue, 26 Mar 2019 09:55:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqxY5cjFdSO0Y1CxucK6IDQISU57ZC+LMrog+jbE4MAlelpa9aCX8uUyIN1QIwF1g+2s7J4g X-Received: by 2002:a17:902:2c01:: with SMTP id m1mr32182423plb.186.1553619333853; Tue, 26 Mar 2019 09:55:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553619333; cv=none; d=google.com; s=arc-20160816; b=XKjnZ1C2swwIGl1uWMiHSSbp2jKN2L/vg/CUV0U5CzJw443QYYOSC4LBf/kh6hOtw5 TDireVwZFqB+tV7eM0ugaE8rQEjwu26le5vzducCM9emKBcR+ByaPDp3zfqLRjqG3U9M ELDUHBuQtaJFzhhggIaqPonKshSwicIDHlH31bcZ7xbh4+GRnqYb6/syQwMkvrpj9E/E K73iZVyWnaQc976jUt3GEsiG+FFZZj/G+qq5uArdmZsY0VdVbzprTG+pVMPwUguEV22C a1p7uI8GRtrjRlQvdZ6yoWrDO3clZ0FN3ZWDOiilCr6P/puoTpDYL6iCFcfnPoAU81g6 YfSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=nvGMKneZDvgBoQO9WKpYlgMFSlMx0qHliuhIZ0RURuY=; b=n+HDe8uKbtBv/M+j8Ut+rDrBADd6OFJOMiYifwrUw1xWX3FldglQtXjw355rfJEbYC 8llEWVehlxTDcpDpVDLKesoSsW1fOh0RvtwItOXCVSG7kHw00eTVg59Wf+I7VXwaF6vE r1kyvRyuOySi6BUMQu+nFhnCqgKsskGyQtzO1PGX8RTUwoP7dZPC42gn9TC7xZXxcne8 9LUXz2ry+T2AZ780bENGOqmVmq6CBTzf+1A9OTbcIpsf0s9gs9NvFh/X2kX2hqq8lLdT ftDOaPmd8BQNwzGJTVbeCdlmMK5YpCUYblaur0DSzn5uyZUY0CgSPeQkzISiaJqvvy2d Y4SQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=WkgZ4pvB; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k5si1234030plt.179.2019.03.26.09.55.18; Tue, 26 Mar 2019 09:55:33 -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=@google.com header.s=20161025 header.b=WkgZ4pvB; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731570AbfCZQio (ORCPT + 99 others); Tue, 26 Mar 2019 12:38:44 -0400 Received: from mail-ot1-f66.google.com ([209.85.210.66]:44513 "EHLO mail-ot1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730451AbfCZQio (ORCPT ); Tue, 26 Mar 2019 12:38:44 -0400 Received: by mail-ot1-f66.google.com with SMTP id d24so12037896otl.11 for ; Tue, 26 Mar 2019 09:38:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=nvGMKneZDvgBoQO9WKpYlgMFSlMx0qHliuhIZ0RURuY=; b=WkgZ4pvBsM7OaWPPaDLIlyd6tXXTgazNDrxPXuius0S2rSNexVHijpJOs1Z4VRwYIr Xj2+H/gHZkMyTRmnQ7ovX2d/HVRz0kTa3uuefeUFZSdCRQFi+3kx45P6p7lvxPeJjiol 3HUFPmD1eFFnTGSamcs23fZfyF9aWQhF8FCM4v9afH3vceQ2REW1iiU2nZmV6kGvqr9f 4PZIGCKtXznBngmTSY1JPff+BXnqKAQa9siz4YBwZo7FJoxQkjVu8bELOPHawp7yfL1M MgW8Tui9d3YEQZm1AgUJ39FnNmkYVQ74bGwqtPnml7658kwKc//QsteSzQR4OVM0BQSY wprw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=nvGMKneZDvgBoQO9WKpYlgMFSlMx0qHliuhIZ0RURuY=; b=HIzxDmr51pIhamwfdBF68fuuRdGUqan3Jr3LOSzZPz2a0jx25JjLPzklzjKMdJ3PTd JQ6qYFkG55PRF3nNQ/jL/XjC7TpuwXpyz1IaK0zdNsSGozLiGApqwlbax5WgyQjtqPR0 0WOuVbATpJkYl0hqX9UCyqNuoH74ro0Z72BwscQIcCYIPq4UQGmAt2no+AkdK/RklIjm 4vHori//Ku+haz49NLN2n/eJnYaK8CESi8VzUD5ewB7T8Il7iIP6yi24viaIUDi6FZMC 47zJaY6N+YTU/JuHP+nuIlWPZ6JP7jlnKfKh0iGNYfIPd9PItChNtny3JJjnObAeCoWh tnpQ== X-Gm-Message-State: APjAAAVDs5jiAGJR4lUOwkAp/vkOBATyWHGO2jtwmA9LNPZ0m384d+SG GZqS8M8w7YIRIO0rkaFOi4IYf52XpCxnrGLUjBDEcA== X-Received: by 2002:a9d:5906:: with SMTP id t6mr22320306oth.308.1553618323107; Tue, 26 Mar 2019 09:38:43 -0700 (PDT) MIME-Version: 1.0 References: <20190326155513.26964-1-christian@brauner.io> <20190326155513.26964-3-christian@brauner.io> <20190326162337.o256x7hiodu2qfyg@brauner.io> <20190326163142.4eh5qpgiqvygf26w@brauner.io> <20190326163452.uku4bgkessxzxvai@brauner.io> In-Reply-To: <20190326163452.uku4bgkessxzxvai@brauner.io> From: Daniel Colascione Date: Tue, 26 Mar 2019 09:38:31 -0700 Message-ID: Subject: Re: [PATCH v1 2/4] pid: add pidctl() To: Christian Brauner Cc: Jann Horn , Konstantin Khlebnikov , Andy Lutomirski , David Howells , "Serge E. Hallyn" , "Eric W. Biederman" , Linux API , linux-kernel , Arnd Bergmann , Kees Cook , Alexey Dobriyan , Thomas Gleixner , Michael Kerrisk-manpages , Jonathan Kowalski , "Dmitry V. Levin" , Andrew Morton , Oleg Nesterov , Nagarathnam Muthusamy , Aleksa Sarai , Al Viro , Joel Fernandes Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 26, 2019 at 9:34 AM Christian Brauner wrote: > > On Tue, Mar 26, 2019 at 05:31:42PM +0100, Christian Brauner wrote: > > On Tue, Mar 26, 2019 at 05:23:37PM +0100, Christian Brauner wrote: > > > On Tue, Mar 26, 2019 at 09:17:07AM -0700, Daniel Colascione wrote: > > > > Thanks for the patch. > > > > > > > > On Tue, Mar 26, 2019 at 8:55 AM Christian Brauner wrote: > > > > > > > > > > The pidctl() syscalls builds on, extends, and improves translate_pid() [4]. > > > > > I quote Konstantins original patchset first that has already been acked and > > > > > picked up by Eric before and whose functionality is preserved in this > > > > > syscall: > > > > > > > > We still haven't had a much-needed conversation about splitting this > > > > system call into smaller logical operations. It's important that we > > > > address this point before this patch is merged and becomes permanent > > > > kernel ABI. > > > > > > I don't particularly mind splitting this into an additional syscall like > > > e.g. pidfd_open() but then we have - and yes, I know you'll say > > > syscalls are cheap - translate_pid(), and pidfd_open(). What I like > > > about this rn is that it connects both apis in a single syscall > > > and allows pidfd retrieval across pid namespaces. So I guess we'll see > > > what other people think. > > > > There's something to be said for > > > > pidfd_open(pid_t pid, int pidfd, unsigned int flags); > > > > /* get pidfd */ > > int pidfd = pidfd_open(1234, -1, 0); > > > > /* convert to procfd */ > > int procfd = pidfd_open(-1, 4, 0); > > > > /* convert to pidfd */ > > int pidfd = pidfd_open(4, -1, 0); > > probably rather: > > int pidfd = pidfd_open(-1, 4, PIDFD_TO_PROCFD); > int procfd = pidfd_open(-1, 4, PROCFD_TO_PIDFD); > int pidfd = pidfd_open(1234, -1, 0); These three operations look like three related but distinct functions to me, and in the second case, the "pidfd_open" name is a bit of a misnomer. IMHO, the presence of an "operation name" field in any API is usually a good indication that we're looking at a family of related APIs, not a single coherent operation.