From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Colascione Subject: Re: [PATCH] proc: allow killing processes via file descriptors Date: Sun, 18 Nov 2018 12:32:56 -0800 Message-ID: References: <20181118190504.ixglsqbn6mxkcdzu@yavin> <608F2959-800D-46EE-A7CD-8C972ACD2F02@amacapital.net> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <608F2959-800D-46EE-A7CD-8C972ACD2F02@amacapital.net> Sender: linux-kernel-owner@vger.kernel.org To: Andy Lutomirski Cc: Aleksa Sarai , Andy Lutomirski , Randy Dunlap , Christian Brauner , "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 List-Id: linux-api@vger.kernel.org On Sun, Nov 18, 2018 at 12:28 PM, Andy Lutomirski wro= te: >> 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 cur= rent creds are considered. So it would need to be a different syscall or a= t least a flag. Otherwise a lot of those nice theoretical properties go aw= ay. Sure. A flag might make for better ergonomics. >> 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 ver= y oddly. Why? The file pointer would work normally. > Read and poll have the same problem as write: we can=E2=80=99t check caps= in read or poll either. Why not? Reading /proc/pid/stat does an access check today and conditionally replaces the exit status with zero.