Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3247263imu; Mon, 19 Nov 2018 12:56:23 -0800 (PST) X-Google-Smtp-Source: AJdET5d/kDMV3DZAxgIaf2zx0dBbJ/txzBMAu4GQIsK9v2B9DYeonxbUtE9xih1lIaMKF/ankQJr X-Received: by 2002:a63:955a:: with SMTP id t26mr21693327pgn.449.1542660983875; Mon, 19 Nov 2018 12:56:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542660983; cv=none; d=google.com; s=arc-20160816; b=uF9XnnaWAPXg2otdqFm0nKB/+EQ1njurJEz2QM9MELXnpDp68tKrKFmXSqUPrjgAFl jZRgL6wt4aQryWereZ8a4E9JbhkQjwlVz6lKigjUcUugJ6yjFYP04rMlpyPi9F3TAdS0 MTxwQISWvNXkZvGJl7dCwlEQmUG8hZT1Wh1nzBUSu6kvq0teA7w0cBw/ktKZYQi1Xi2e 3oA4oAVbSChIYEXlSOtzJeaMw7doa9ucuie/NNgFsl/+o+0WurrpQMCrJiFtIJOdcDV2 Z5TKHBN43JgqYbQ/a0oleKCMAgyMrFxrB29cQoKmVC2tylp6/PUZfADbOWaQINmiVKXZ 8AhA== 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=ngz/Y1cNLgES/cNFWmCB4diKECGfvsf2JLaGb99AV84=; b=Cxag2FgReaWu49IsdDqWG1jiOmxmpOlmr0qiJCqjSpUzhW5fmwmLmU5s/jpg8P9MPT zAqvEiiglkC9qK8itn4z0VtoMJqEDvXVwV/jozeSNER+X3pMrDI3315ExnIdbR31j50z t1GEeHXAo48Ef3kcrHeb19NQK3XYhgrYyE1Cy2xue9anU/XvbKV2imJdKgE+YEGR2vH4 p47BfEAUndoh+6dnPs9KczXmUU5dbSQM0v83OyVp1XteBAo+uhMulfanGgKRLmFe+G08 lqcQuuMUn0S3PVwR8rVAZ18EJ3ugVZPfmlm5l1k1uJ5e61k8yIe0jVcZCArerSGf1D1d Y/NA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brauner.io header.s=google header.b=XIIRWGCJ; 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 gn20si37371165plb.273.2018.11.19.12.56.08; Mon, 19 Nov 2018 12:56:23 -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=XIIRWGCJ; 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 S1730898AbeKTHUz (ORCPT + 99 others); Tue, 20 Nov 2018 02:20:55 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:40432 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730852AbeKTHUz (ORCPT ); Tue, 20 Nov 2018 02:20:55 -0500 Received: by mail-pf1-f194.google.com with SMTP id i12so2139557pfo.7 for ; Mon, 19 Nov 2018 12:55:30 -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:in-reply-to:user-agent; bh=ngz/Y1cNLgES/cNFWmCB4diKECGfvsf2JLaGb99AV84=; b=XIIRWGCJDme9RiNStO/ZSsD0CLhn3GHALS0xIAbRh7OUna8y6ytOBfCIzDn/bqSNt/ /ksySguTbmnYqtchvFE+0Ah4oDNmSPUPl///BXeDkXwJ+JkqBXAWMcsQlOnXxKLogImJ SSxgzRptXQ9uDimmq0jQTdZKlyEK102NIqbh6cyReQMF+Og2pBmjKuONCrmMrhsY1PeY VPCCeXu7SSUZ+rfj9QiFe5uq/lGjfyl6d5A5oR+sLLNrXbBtLSuPUfpbCNz2DtBbYZxw qrzAayCc5VxE5MI1LL/QQnOAqk05z7CLiOK5TC6dJI/eiKVR/tPaFFJI12Uu19n3d4nV T3zg== 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=ngz/Y1cNLgES/cNFWmCB4diKECGfvsf2JLaGb99AV84=; b=r/p3plyiJV6kU6y2Zefkm9bzq0w3IXZgKFKYdF4+qWJ+R/1E2Xp+/inb/xgchyY2yt FAUOtyXNSnT4/hOYq6SAm9w7hB/vE8UVUtsthkHtxGrLGtru5CSyeGWWTWgA0ZNjjd8Q 1Kk9IN45i0TQkbSxrCwUz+g+PTcEE+CYMOdGeHhhvwjtZsNW0AOsthwI7okPGzhbeLMF K9iVi/ni0cgsZO7tUVdM6BW451rWSwuV9Ynz9DRR7prtDjvxocmuTauhfNysiCe+5XkV Phx5VIKbteTbEWQ6AtP48jdDCN7z8eVelgGLWgamTt0DhFYeTFVCrjEnI0xeaSvfr14g utOg== X-Gm-Message-State: AGRZ1gIRxNUEuauMPYoy2HTmoiAliVZbAN7BRbWJ8Mr4x+geARLNOE6K SIMoCDNjwX9IbqLDqA4XgW5sYA== X-Received: by 2002:a62:6d83:: with SMTP id i125-v6mr24919112pfc.184.1542660930161; Mon, 19 Nov 2018 12:55:30 -0800 (PST) Received: from brauner.io ([2404:4404:133a:4500:9d11:de0b:446c:8485]) by smtp.gmail.com with ESMTPSA id 11-v6sm59403212pfr.55.2018.11.19.12.55.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 19 Nov 2018 12:55:29 -0800 (PST) Date: Mon, 19 Nov 2018 21:55:20 +0100 From: Christian Brauner To: Aleksa Sarai Cc: ebiederm@xmission.com, linux-kernel@vger.kernel.org, serge@hallyn.com, jannh@google.com, luto@kernel.org, akpm@linux-foundation.org, oleg@redhat.com, viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org, dancol@google.com, timmurray@google.com, linux-man@vger.kernel.org, Kees Cook Subject: Re: [PATCH v1 2/2] signal: add procfd_signal() syscall Message-ID: <20181119205518.btew3vxwgva4w3zh@brauner.io> References: <20181119103241.5229-1-christian@brauner.io> <20181119103241.5229-3-christian@brauner.io> <20181119202857.k5zw742xjfrw677j@yavin> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20181119202857.k5zw742xjfrw677j@yavin> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 20, 2018 at 07:28:57AM +1100, Aleksa Sarai wrote: > On 2018-11-19, Christian Brauner wrote: > > + if (info) { > > + ret = __copy_siginfo_from_user(sig, &kinfo, info); > > + if (unlikely(ret)) > > + goto err; > > + /* > > + * Not even root can pretend to send signals from the kernel. > > + * Nor can they impersonate a kill()/tgkill(), which adds > > + * source info. > > + */ > > + ret = -EPERM; > > + if ((kinfo.si_code >= 0 || kinfo.si_code == SI_TKILL) && > > + (task_pid(current) != pid)) > > + goto err; > > + } else { > > + prepare_kill_siginfo(sig, &kinfo); > > + } > > I wonder whether we should also have a pidns restriction here, since > currently it isn't possible for a container process using a pidns to > signal processes outside its pidns. AFAICS, this isn't done through an > explicit check -- it's a side-effect of processes in a pidns not being > able to address non-descendant-pidns processes. > > But maybe it's reasonable to allow sending a procfd to a different pidns > and the same operations working on it? If we extend the procfd API to No, I don't think so. I really don't want any fancy semantics in here. Fancy doesn't get merged and fancy is hard to maintain. So we should do something like: if (proc_pid_ns() != current_pid_ns) return EINVAL > allow process creation this would allow a container to create a process > outside its pidns. > > -- > Aleksa Sarai > Senior Software Engineer (Containers) > SUSE Linux GmbH >