Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3373582imu; Mon, 19 Nov 2018 15:08:17 -0800 (PST) X-Google-Smtp-Source: AJdET5eszEwe6pj85Ynsvks7fmUROF9PgU5FjNN/yS0VvXtmK67ItD8mWaJ9kfUyPWRyalN8vbTy X-Received: by 2002:a17:902:598e:: with SMTP id p14mr24156819pli.260.1542668897903; Mon, 19 Nov 2018 15:08:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542668897; cv=none; d=google.com; s=arc-20160816; b=l0Ni5vmFOeVBm1RpDfM2AC6+AKXnpQcOhDQ4rLDoeAH7DLZ6YtF8DOX/OKby90sCAP jWjCqWZ3vq9aHsPIVOMZg/8ZMRTX1Rel7BZfaG7tIY23NphtQahDZzvMqxagy/OSMpI9 NTBzP2fAWblCKD+DlEZ5et7i0r2+ixCagT1Ijuzk4/p1ii8KV9VJX4wavzq4/dKaPtDd ZDbRzNJHeWADAXZwbtWU/D3VrLGWKE/QeTkZdchWs/60X2DmsOdWT3Zh2aiUsekrY3SI nM3XaWXJo9F770as8x3FNUqS/oiW+PrlLSYeTnIImWkXfdnwn7DvtSwz5CGkbsSYX7dR Ds2g== 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:dkim-signature; bh=dI+p9Pbih8erbmRN0W/Me9mMEc3sgCVErGWyJMQz/GI=; b=KMEhqUlWQSmgl4zdROIKmdBCF+67Y8Z3Uas9KKXxoCdKyiR0q89vH6WX6ENvFIls1p aMsUjNdMNzQHjvubnYkSI95Aih7Fx0lVwml5MQd/vrEFpC3/IottUNwQi4s9NqX4GQGl AEbK/HFfICrBnynhh7R5G9g9ZjlPRM80SJXVf2lf4hQuTzEtSkUrzPheB3J9zTlykFa+ JHwIeZwNyYLECeNG/ZzBISChiLEwe+cW+1PfakU1p1G/qzSGXUZV0zcSbF+1VgBrf0nM RdE/Py/MfEtTmRESSnHj0WJlbWqfm0tT7zqnbpsqA4TddFQ2r1MSidQMe2XV5IsuUe9n GVCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tycho-ws.20150623.gappssmtp.com header.s=20150623 header.b=I1PMPoHC; 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 j191si39196885pgd.249.2018.11.19.15.08.01; Mon, 19 Nov 2018 15:08:17 -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; dkim=pass header.i=@tycho-ws.20150623.gappssmtp.com header.s=20150623 header.b=I1PMPoHC; 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 S1731789AbeKTJdM (ORCPT + 99 others); Tue, 20 Nov 2018 04:33:12 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:40965 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731651AbeKTJdM (ORCPT ); Tue, 20 Nov 2018 04:33:12 -0500 Received: by mail-pl1-f193.google.com with SMTP id u6so4402617plm.8 for ; Mon, 19 Nov 2018 15:07:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tycho-ws.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=dI+p9Pbih8erbmRN0W/Me9mMEc3sgCVErGWyJMQz/GI=; b=I1PMPoHCz9RDkB17uLAFIhVk5mQyQfLkWOuNETjczWlBP50R9JZyv1X4O3Hd8LrrwL gAqZpCkcF0BWu2nVFGt8FSJ5L3xdb8FX4/zTaK332Cchr8rGzzdNaQt2f35K2zCk0bDs lZNYfdCY7Z+/Pr1vHNM4Z5LMLduiVdjxRrqDnBeEF/Qe1MIWwAMutbXSeRVq1kENNAui oA+kz+j+BZql+Zj608dRI5VYojnP81lz4CMtY297pqKii7zgmzAdekToxr+2XQbsXrW5 X1E+iJNQDrREyneZt4PUW7f4iugciYB1aKMonXX3P0jobSj1WdJh2oXjc4XNUac0xAt/ GA1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=dI+p9Pbih8erbmRN0W/Me9mMEc3sgCVErGWyJMQz/GI=; b=QdhJejcQdWIv0XlSVLCf/EHlh5lWwI+A3thqOSay9MT0P24eOA84Wj37SX7AhBDMXG C8hiSmy4EIBe8ZzIIMmaNvVGovWqWwYTUlXnmwfRB71I4Gt2XbQ5MHtu1kZf1oEcHFO9 6DhWkotBz56AYNjHrvl2O8yMjxSYWMuw2YLSurGELTq5r9ON7G31clp0sgDil0M/TJwp dW5fpqtOka2SK4YRYWMnb2Xc/1eRt4d8hNYiJiqy/FNEWoc1DJLKZzwpERFTyKpUtIxz E4Axj/zJuSxYlqF5dYofC4PRID8Ft/OC6XCPNo/NbB989h8YdmPHKdJhbIazNQAin4Le EUsw== X-Gm-Message-State: AGRZ1gI/7t/bqglb7QWi2o1fy1jlhuoKmiSDO4K3+QEyrvCmeRjmDBzZ i7Hly27aZrEG3WlrigfPEOMkOA== X-Received: by 2002:a17:902:24e7:: with SMTP id l36-v6mr24344521plg.243.1542668832764; Mon, 19 Nov 2018 15:07:12 -0800 (PST) Received: from cisco ([128.107.241.178]) by smtp.gmail.com with ESMTPSA id 128-v6sm45967218pfd.64.2018.11.19.15.07.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 19 Nov 2018 15:07:11 -0800 (PST) Date: Mon, 19 Nov 2018 16:07:09 -0700 From: Tycho Andersen To: Daniel Colascione Cc: Christian Brauner , "Eric W. Biederman" , linux-kernel , "Serge E. Hallyn" , Jann Horn , Andy Lutomirski , Andrew Morton , Oleg Nesterov , Aleksa Sarai , Al Viro , Linux FS Devel , Linux API , Tim Murray , linux-man , Kees Cook Subject: Re: [PATCH v1 2/2] signal: add procfd_signal() syscall Message-ID: <20181119230709.GB4992@cisco> References: <20181119103241.5229-1-christian@brauner.io> <20181119103241.5229-3-christian@brauner.io> <20181119223954.GA4992@cisco> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 19, 2018 at 02:49:22PM -0800, Daniel Colascione wrote: > On Mon, Nov 19, 2018 at 2:40 PM Tycho Andersen wrote: > > Can I just register an objection here that I think using a syscall > > just for this is silly? > > Yes, you can argue that the bikeshed should be ioctl-colored and not > syscall-colored. > > > My understanding is that the concern is that some code might do: > > > > unknown_fd = recv_fd(); > > ioctl(unknown_fd, SOME_IOCTL, NULL); // where SOME_IOCTL == PROC_FD_KILL > > // whoops, unknown_fd was a procfd and we killed a task! > > > > In my experience when writing fd sending/receiving code, the sender and > > receiver are fairly tightly coupled. Has anyone ever actually fixed a > > bug where they had an fd that they lost track of what "type" it was > > and screwed up like this? It seems completely theoretical to me. > > Yes, I have fixed bugs of this form. > > > The ioctl() approach has the benefit of being extensible. > > The system call table is also extensible. But not infinitely so. The x32 ABI starts at 512, and right now I see 334 syscalls on x86_64. So the next 178 people can say "let's just define a syscall", and after that? I suppose we could move to setting BIT(10), but how much userspace assumes > 512 => compat syscall and blocks it via seccomp or whatever? Contrast that with the ioctl space, which is an unsigned long and fairly sparse still (Documentation/ioctl/ioctl-number.txt). > ioctl is for when a given piece of functionality *can't* > realistically get its own system call because it's separated from > the main kernel somehow. procfs is a core part of the kernel, so we > can and should expose interfaces to it using system calls. I suppose it's obvious, but I disagree. > > Adding a > > syscall means that everyone has to do all the boilerplate for each new > > pid op in the kernel, arches, libc, strace, etc. > > These tools also care about ioctls. Adding a system call is a pain, > but the solution is to make adding system calls less of a pain, not to > permanently make the Linux ABI worse. For user-defined values of "worse" :) Tycho