Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1970075imu; Sun, 18 Nov 2018 12:46:10 -0800 (PST) X-Google-Smtp-Source: AFSGD/VHw5dYmJLHbO/K2CQMShebCaJ9xf8gyZP8pqT7g62HWlJQSypVw1QNnv5XugED03WiP1jK X-Received: by 2002:a17:902:6909:: with SMTP id j9mr4868050plk.196.1542573970931; Sun, 18 Nov 2018 12:46:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542573970; cv=none; d=google.com; s=arc-20160816; b=uuDxoStnfFvAXkRXSFjDvm9tYYsvUWueNfclWfQFE/BCFOtuS2GtzA6zioqepyA4tN gALB31L7RW80y7TRDJV5ifUexQXhOrqBlTrF8mXrmrsq3gjB4GS4XaC/vHl45qqrNaij wW2Iz6pLj+q/oRs2vXzETmXQ5joBnFR+YVDCcdDAwaWwjcmGhuxSMEzFcUc9h9vZWY4/ F17upgXvumiIR+c71fUbCF6z5upBHTifbdPTd2YphPKMT76AG3bik9g5hNpD4bw761DU 8evzQXGZ5vnKBY0Wa+dNF33INJWA3tBhpSw6fc0V/X0ywuNmWus2lUzCpyN2iyDVjPzu IRcQ== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ZOzAzEkZSeShnw3IMWJ8pwJU/havDmGTKyO1QCcP0nI=; b=Yhs0oOnXmZ/tXj8ad0EkgXZMJCk71EU8A6b1nwQMlqW2QgNzjIA4CKBUbfTAKvfibh JiGP68Zp/2KVGnl4cYYxHkJNHjx9MsG/0sP0rMY3ZehWvVv/zLtDOpN43rERIQp6Gjg2 W5FiPfFDKrdKcV5mIZTZU3a8iwblO3FSiMXt1SdU4OLJGcn7SIntrj2NNgkmLCeAFqTH KWLlzwyimUb4JM9DFkDGKXirn5NqC9uDYvy15LxwVrAGmFhmoqTGAMwunk+ZATr2NAuA 5bcDkYNY6pnrIuRXb2XkdMmffL0kWB6WqTkqoF2xishd1yvnqwOhdHTi83iBmHAZIEkK 2NlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brauner.io header.s=google header.b=TuHbueyy; 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 c132si25250582pga.597.2018.11.18.12.45.56; Sun, 18 Nov 2018 12:46:10 -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=@brauner.io header.s=google header.b=TuHbueyy; 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 S1727398AbeKSHEr (ORCPT + 99 others); Mon, 19 Nov 2018 02:04:47 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:35885 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726400AbeKSHEr (ORCPT ); Mon, 19 Nov 2018 02:04:47 -0500 Received: by mail-pg1-f195.google.com with SMTP id n2so5684244pgm.3 for ; Sun, 18 Nov 2018 12:43:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brauner.io; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=ZOzAzEkZSeShnw3IMWJ8pwJU/havDmGTKyO1QCcP0nI=; b=TuHbueyyHKqDlzEwj6DNNwGBuag+9zMFflkGgFJLJK/YmI6CFHFTd7N0DdOsSayT7f IAam6wSju81ElDKeLjMCeL2UDLFfqStlROJcMdoTFQ1SJP3UCvHJWGd/DFnSxdtYitPF soa3SCwlkEPqsetCsDR0AYyisyjS+RjOwZ97pijtKscD+OrM91liVHs0aBIo2Arz8aPo 1qBA2HzbtJyYq+W11l1TGfIvaHy9HlhZ/myfvAohX/7M3iq4Uc0lL8Nusbp3yw93loDE 8wJaq3ak5eONy2Awj2+UBvAnI/PabycKI0R89UgL2jNp/ZXX660qeKtwwY/0SFW7VZr0 5XPg== 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:content-transfer-encoding :in-reply-to:user-agent; bh=ZOzAzEkZSeShnw3IMWJ8pwJU/havDmGTKyO1QCcP0nI=; b=Q88vqgsvcoAjQ2P/+h5LtE8KHujfefJGheqi3Qaxe2bveEwivOWvbn2Sv066g0KFw7 EC6chrHaokM6REhZjs2wdNlkdfSy50u1NPezvsdszeBuhuqfK0tUYVm0i5AbuZHhHtLf Ep6D8HU6N6gxtCh/t1F0RFszc84DQ8FH77FUoNm3L7/DGb65PEVQd2PIlLYM88Hr4tvH nkUPNGJ1Xp1mdev3+P00JXp74CMJdOSVoZJ/Qkpy8xUPw2F9470qmT0IbN3J88TokWed hQlXsun5At5Z9DRd6tGxggQiWo23+DNGE9uLQt01zY+FPDXAwFs+hvjxCrKFmdYzCnNb F+AA== X-Gm-Message-State: AGRZ1gLDmf7qK4s4/v+svGaHHZIvBalFqUv4gwTTTwq/fRuIQwBQcxbj m2VJ++su4M4z6YBoo8Q/PUpieg== X-Received: by 2002:a65:514c:: with SMTP id g12mr17493493pgq.169.1542573808768; Sun, 18 Nov 2018 12:43:28 -0800 (PST) Received: from brauner.io ([2404:4404:133a:4500:9d11:de0b:446c:8485]) by smtp.gmail.com with ESMTPSA id v12-v6sm52238102pfa.167.2018.11.18.12.43.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 18 Nov 2018 12:43:28 -0800 (PST) Date: Sun, 18 Nov 2018 21:43:19 +0100 From: Christian Brauner To: Andy Lutomirski Cc: Daniel Colascione , Aleksa Sarai , Andy Lutomirski , Randy Dunlap , "Eric W. Biederman" , LKML , "Serge E. Hallyn" , Jann Horn , Andrew Morton , Oleg Nesterov , Al Viro , Linux FS Devel , Linux API , Tim Murray , Kees Cook , Jan Engelhardt Subject: Re: [PATCH] proc: allow killing processes via file descriptors Message-ID: <20181118204317.seaztq7fqmysucns@brauner.io> References: <20181118190504.ixglsqbn6mxkcdzu@yavin> <608F2959-800D-46EE-A7CD-8C972ACD2F02@amacapital.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <608F2959-800D-46EE-A7CD-8C972ACD2F02@amacapital.net> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Nov 18, 2018 at 01:28:41PM -0700, Andy Lutomirski wrote: > > > > On Nov 18, 2018, at 12:44 PM, Daniel Colascione wrote: > > > > > > > That is, I'm proposing an API that looks like this: > > > > int process_kill(int procfs_dfd, int signo, const union sigval value) > > > > If, later, process_kill were to *also* accept process-capability FDs, > > nothing would break. > > Except that this makes it ambiguous to the caller as to whether their current creds are considered. So it would need to be a different syscall or at least a flag. Otherwise a lot of those nice theoretical properties go away. I can add a flag argument int process_signal(int procfs_dfd, int signo, siginfo_t *info, int flags) The way I see it process_signal() should be equivalent to kill(pid, signal) for now. That is siginfo_t is cleared and set to: info.si_signo = sig; info.si_errno = 0; info.si_code = SI_USER; info.si_pid = task_tgid_vnr(current); info.si_uid = from_kuid_munged(current_user_ns(), current_uid()); > > > Yes, that's what I have in mind. A siginfo_t is small enough that we > > could just store it as a blob allocated off the procfs inode or > > something like that without bothering with a shmfs file. You'd be able > > to read(2) the exit status as many times as you wanted. > > I think that, if the syscall in question is read(2), then it should work *once* per struct file. Otherwise running cat on the file would behave very oddly. > > Read and poll have the same problem as write: we can’t check caps in read or poll either.