From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9419DC43603 for ; Fri, 20 Dec 2019 04:35:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6EE83227BF for ; Fri, 20 Dec 2019 04:35:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727202AbfLTEfa (ORCPT ); Thu, 19 Dec 2019 23:35:30 -0500 Received: from mout-p-201.mailbox.org ([80.241.56.171]:18280 "EHLO mout-p-201.mailbox.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726986AbfLTEfa (ORCPT ); Thu, 19 Dec 2019 23:35:30 -0500 Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:105:465:1:1:0]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 47fGBk2v34zQjm6; Fri, 20 Dec 2019 05:35:26 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter06.heinlein-hosting.de (spamfilter06.heinlein-hosting.de [80.241.56.125]) (amavisd-new, port 10030) with ESMTP id 5BE2jh93RM9y; Fri, 20 Dec 2019 05:35:22 +0100 (CET) Date: Fri, 20 Dec 2019 15:35:10 +1100 From: Aleksa Sarai To: Sargun Dhillon Cc: Christian Brauner , Arnd Bergmann , Oleg Nesterov , Florian Weimer , "linux-kernel@vger.kernel.org" , Linux Containers , Linux API , Linux FS-devel Mailing List , Tycho Andersen , Jann Horn , Andy Lutomirski , Al Viro , Gian-Carlo Pascutto , Emilio Cobos =?utf-8?Q?=C3=81lvarez?= , Jed Davis Subject: Re: [PATCH v4 2/5] pid: Add PIDFD_IOCTL_GETFD to fetch file descriptors from processes Message-ID: <20191220043510.r5h6wvsp2p5glyjv@yavin.dot.cyphar.com> References: <20191218235459.GA17271@ircssh-2.c.rugged-nimbus-611.internal> <20191219103525.yqb5f4pbd2dvztkb@wittgenstein> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="nmgp7ksjzcrpo6tt" Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --nmgp7ksjzcrpo6tt Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2019-12-19, Sargun Dhillon wrote: > On Thu, Dec 19, 2019 at 2:35 AM Christian Brauner > wrote: > > I guess this is the remaining question we should settle, i.e. what do we > > prefer. > > I still think that adding a new syscall for this seems a bit rich. On > > the other hand it seems that a lot more people agree that using a > > dedicated syscall instead of an ioctl is the correct way; especially > > when it touches core kernel functionality. I mean that was one of the > > takeaways from the pidfd API ioctl-vs-syscall discussion. > > > > A syscall is nicer especially for core-kernel code like this. > > So I guess the only way to find out is to try the syscall approach and > > either get yelled and switch to an ioctl() or have it accepted. > > > > What does everyone else think? Arnd, still in favor of a syscall I take > > it. Oleg, you had suggested a syscall too, right? Florian, any > > thoughts/worries on/about this from the glibc side? > > > > Christian >=20 > My feelings towards this are that syscalls might pose a problem if we > ever want to extend this API. Of course we can have a reserved > "flags" field, and populate it later, but what if we turn out to need > a proper struct? I already know we're going to want to add one > around cgroup metadata (net_cls), and likely we'll want to add > a "steal" flag as well. As Arnd mentioned earlier, this is trivial to > fix in a traditional ioctl environment, as ioctls are "cheap". How > do we feel about potentially adding a pidfd_getfd2? Or are we > confident that reserved flags will save us? If we end up making this a syscall, then we can re-use the copy_struct_from_user() API to make it both extensible and compatible in both directions. I wasn't aware that this was frowned upon for ioctls (sorry for the extra work) but there are several syscalls which use this model for extendability (clone3, openat2, sched_setattr, perf_events_open) so there shouldn't be any such complaints for a syscall which is extensible. --=20 Aleksa Sarai Senior Software Engineer (Containers) SUSE Linux GmbH --nmgp7ksjzcrpo6tt Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQSxZm6dtfE8gxLLfYqdlLljIbnQEgUCXfxPewAKCRCdlLljIbnQ ElNGAP0QzHxTfcWUIyKQwziyZ7SKPlC5ve6y0476CjvwfTG0mQD+JDR19gzaS69O MYDK8035BURwBnELBe2PceZHzjVhlAQ= =Kwh+ -----END PGP SIGNATURE----- --nmgp7ksjzcrpo6tt--