Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1977748imu; Sun, 18 Nov 2018 12:58:52 -0800 (PST) X-Google-Smtp-Source: AJdET5ccRHQHmU81UP1/yFDRaEr06RnPWMt8t/4qZxoFZd6OJu1PXU6vVrLZAhmHaYq1uErDIW03 X-Received: by 2002:a17:902:162:: with SMTP id 89-v6mr19579217plb.293.1542574731940; Sun, 18 Nov 2018 12:58:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542574731; cv=none; d=google.com; s=arc-20160816; b=S6/5iAEF2dnuFLhLwaEGWC+TfYiObcPdhtOyoWm7UZ6GdKQfzLzpQ63sHmpxFbn+Wt TQmU6K81+yFzVvkMipJwr5tgD3ijABSa+0W5ASABQzNiFlBbx6PEyr66mlvwjEVhPeqG KHgDvA3yZcV/n2k7rPQLYLXBeaeYvWTuNzwTFBSF6j5tbwfW14sUFWA/6WztF4555Gnm J+sexm4pNjFqCpG9n+nDBfptnbX74fsdhG5sd0v7W3cHjPssmiH/DwSYZyFLPOOvAeqZ CcxtW9CIHGYkbUST9RE9GRHmSLctg8h+pi0SqpQ5H9sgtKHsUhGWPVwT7AsS/sD3PCde n6NQ== 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 :references:in-reply-to:mime-version:dkim-signature; bh=sfk5ZdXY2vuq/wJkpLW0WfUPfnM+sqQ55yswNlMabQM=; b=04um4WlfbgFRh7ZyNqfUeMkJJiyO6m8hnRUGnlbKdfPfZQTHfXocA5f1tZug/6y/hx /r0kX19T25dbw/uII89JkixBUE0iM02+VS7LDvU8FXDD9xW82tpKnrRCfmmz9NYTp6tH JvO3NTgFO6P/f4m/48EIg8DnB2Kvq+D3Czp3WWa72bEMkYAq6nAKeNa0183vaBpJIPBX nvvugPQKVMUCfnBqOj+WI/2+HjLYdqJX3GUbb1aJJf5TVspY3zaBTdGjtiK5Ej9v3MLi 9GpB/FBFJtuRAzgSkVZ+UT112sJRDSTZNK2rPjfemQyrjVDY51sLOa3WNaeEBmj91c1q USWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=VQT8N2+A; 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 a185si34911933pge.404.2018.11.18.12.58.36; Sun, 18 Nov 2018 12:58:51 -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=@google.com header.s=20161025 header.b=VQT8N2+A; 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 S1727496AbeKSHPb (ORCPT + 99 others); Mon, 19 Nov 2018 02:15:31 -0500 Received: from mail-vs1-f65.google.com ([209.85.217.65]:41571 "EHLO mail-vs1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726523AbeKSHPb (ORCPT ); Mon, 19 Nov 2018 02:15:31 -0500 Received: by mail-vs1-f65.google.com with SMTP id t17so16616017vsc.8 for ; Sun, 18 Nov 2018 12:54:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=sfk5ZdXY2vuq/wJkpLW0WfUPfnM+sqQ55yswNlMabQM=; b=VQT8N2+Amv6glMz08WkLUyXyZdi8GCGX+/deOdeCrICjbfDGsCQ897Zs6ljYjjenSF NgprT73Hw8KTP3baibaEg2N+582jaAy4b3mmgwzyYm8hzxMDv38gGeKZn0hI4gWULfP6 F8DePNLPs0RNqmvRaSwFGPdIqQ+h8m7XyKW7mmWhengavOvAmgEihCDby/z3xSdW0sc/ Ij+StoAvNwfbN0p8iSmN/WuHeMDWlWgrMeNYq85K1QJfwpAxG0z7Ty4zJik8UpOIWaRU QNkK98nM6ZETpOiCKKRN67L+4tynxKvxXpdrQLDwny+/aFyifzCCe3dGzgmso5Tl9GZ6 dpZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=sfk5ZdXY2vuq/wJkpLW0WfUPfnM+sqQ55yswNlMabQM=; b=T+ErhmmlF885Wt8te5EKHkvOs/gYDlxfG1/nW0OFVlpLVIue5UqIUm7HIqq5vG54bu z5vb2ZEBfxRB9mvuwBpYnwh+k2A4mFIaCgbN9eUGhyAV+ABu6NHYPwRpLvplFoEZbvV8 Lgv4p0fUKKFrwMLLGACDpaNFdarVjvhjvWm+lnvv/vA5skLAu5h8I8o4eIAo2pwtSQKA 2cTlfmvsZf7EUsZFrOIieDef6f90ACqfkpr6gDo9DdLeVPBZ33MB2WbyATlf15NR0MrE 0MRepKUZVLQpQhBv6ONYPTzRknjQ2yfuiIBwgkmxcEQSiU0Q8O05iwWnf64AlnsB+C7m AGTw== X-Gm-Message-State: AGRZ1gIpUUyVgo7qMXrT5+gB8njGiipo9VTvs+xMEQV7XNSUkdK3UKuz pCGBKYZy93kSKfbP7VJeX1QX2idEBi0oZzTpwvcdew== X-Received: by 2002:a67:105:: with SMTP id 5mr7880486vsb.183.1542574451277; Sun, 18 Nov 2018 12:54:11 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a67:f48d:0:0:0:0:0 with HTTP; Sun, 18 Nov 2018 12:54:10 -0800 (PST) In-Reply-To: <20181118204317.seaztq7fqmysucns@brauner.io> References: <20181118190504.ixglsqbn6mxkcdzu@yavin> <608F2959-800D-46EE-A7CD-8C972ACD2F02@amacapital.net> <20181118204317.seaztq7fqmysucns@brauner.io> From: Daniel Colascione Date: Sun, 18 Nov 2018 12:54:10 -0800 Message-ID: Subject: Re: [PATCH] proc: allow killing processes via file descriptors To: Christian Brauner Cc: Andy Lutomirski , 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 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 Sun, Nov 18, 2018 at 12:43 PM, Christian Brauner wrote: > 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()); That makes sense. I just don't want to get into a situation where callers feel that they *have* to use the PID-based APIs to send a signal because process_kill doesn't offer some bit of functionality. Are you imagining something like requiring info t be NULL unless flags contains some "I have a siginfo_t" value? BTW: passing SI_USER to rt_sigqueueinfo *should* as long as the passed-in si_pid and si_uid match what the kernel would set them to in the kill(2) case. The whole point of SI_USER is that the recipient knows that it can trust the origin information embedded in the siginfo_t in the signal handler. If the kernel verifies that a signal sender isn't actually lying, why not let people send SI_USER with rt_sigqueueinfo?