Received: by 2002:ab2:784b:0:b0:1fd:adc2:8405 with SMTP id m11csp333013lqp; Mon, 10 Jun 2024 05:49:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXZk9HDNZbTNTdpPbCV8owkmzcaz81znw1fn/U+vuSeMw9ejgTD/DbijMAjiRfkD9W/Ui9OfaKP1zo2zE8AeB3F+H5rKk+ivaGxFhmbZA== X-Google-Smtp-Source: AGHT+IHepZA5W/JUGzHRaznWhxx+KncCBsBQHGElTuBcg6cEPfth0x4nSu7J5v7AlTFWjKPtMWAj X-Received: by 2002:a17:90a:e40f:b0:2c2:e31f:49a2 with SMTP id 98e67ed59e1d1-2c2e31f4c7emr4362804a91.9.1718023768838; Mon, 10 Jun 2024 05:49:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718023768; cv=pass; d=google.com; s=arc-20160816; b=h+ugLwLRzTIX9gfNAPewLfSEaXixw8JI1knduL91Mvxogt3XVbDpjzLMQLDRsAo9qv zZn9lAMui4TTABGpbsdL3wZBTHVTPKkh238K3AZ3gompdkkDzu5NobeBMxcPKmhT+wGQ PXZ7zL/DS0AFdVQ6qBmERArZ7kKqYNqHOCELfMau42v7nsXeueVOg03NlZjQeY1OcjK+ 8ni4XiBy+fkdFrxbIURVC19Q7VCGi8HEGsKL18spmOGIW9MNAlvlrfcoLi+jrHYJaX5K lst2Dh5igRdcDrQxrPo6JOGPa9uxPpqjsXMlvcCNZJ4ZFnEp0cyVVOzOD3+jAPztKiV4 RTKA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=qmfXTP4zFgAB6Tr8peuUIf5IGK+bFIE2wcGnI0ixiuw=; fh=UgWfJoLqBe2ODbLLy6X/dysUNfyMRpLDM0k/VQ0h5F4=; b=EF/6VObXtkZ4wv890FGN4fJueHOiIceXaQNgrJktSYDnGicAuziZqZmPUVkueYypiQ yoJlYzdjBSOTbsaKUosg2iBBwUcvPSddwEy1gT6jjP6cCjmsB1LtZSkK1/75XXPADYHy zRLHVtVnX7trIIvsLqP3BjNQA6Vsrt6QMNUZwCc7BKTatOO3v6cuTEsdDO+WLfPEuAvq RvmePrDu+J4jAN/p9vdTBGSoFVGrFJDrTTbAl2vIPRcVNXTBLYuEbNi5TeyhkfbtxzE+ YRdBdT2SmQ4RqGdwK0FfnPgby12CWrB02OcLu/ScQ8yzQ2bDvhsv9ExWJv9znUEqNZLw p81w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=mail.hallyn.com); spf=pass (google.com: domain of linux-kernel+bounces-208178-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208178-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-6f0eaaa7fc0si1706688a12.780.2024.06.10.05.49.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 05:49:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-208178-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=mail.hallyn.com); spf=pass (google.com: domain of linux-kernel+bounces-208178-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208178-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 217022811D3 for ; Mon, 10 Jun 2024 12:49:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8375980C03; Mon, 10 Jun 2024 12:49:00 +0000 (UTC) Received: from mail.hallyn.com (mail.hallyn.com [178.63.66.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1BC6A80639; Mon, 10 Jun 2024 12:48:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.63.66.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718023740; cv=none; b=HA7RpwOiX2asF24JlGR0cYQtEx5/202ujhFYFD7G5J6z2vNBsAxxn6+q7/O5c+trAWCQw/iCEB6cZHp0mbx2uzX2XysF/d2D/5EjfnL3wzy2KGZJ8uaZdeCEqWJwu6q4kQoPVMduIWKtyx+BZPbwKVCxEy1QzxsI0BgdMkgb4Lk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718023740; c=relaxed/simple; bh=c1EmVzZERqjSJs/SlkFG6bKIoC5k7IxAp0ghoFzDQa8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=e7hAryKAy3STYX5UC4MdgKTGw/0zxUngdadWGB99c81XMdU9AVWOkZ1YoJCosA44/AUTk0OLIyowZb7oAoEYFjTIceAUzS2KAe3/tdZH9hJPk5jCHHs4VoIA6RiFnVmsAUCwmGsy30/Mr/dY0m71W1iMqHdqRcI7enHEHUOXJrw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hallyn.com; spf=pass smtp.mailfrom=mail.hallyn.com; arc=none smtp.client-ip=178.63.66.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hallyn.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mail.hallyn.com Received: by mail.hallyn.com (Postfix, from userid 1001) id EBF00579; Mon, 10 Jun 2024 07:48:55 -0500 (CDT) Date: Mon, 10 Jun 2024 07:48:55 -0500 From: "Serge E. Hallyn" To: Jonathan Calmels Cc: "Serge E. Hallyn" , Andrew Morgan , brauner@kernel.org, ebiederm@xmission.com, Jonathan Corbet , Paul Moore , James Morris , KP Singh , Matt Bobrowski , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , Stanislav Fomichev , Hao Luo , Jiri Olsa , Luis Chamberlain , Kees Cook , Joel Granados , John Johansen , David Howells , Jarkko Sakkinen , Stephen Smalley , Ondrej Mosnacek , Mykola Lysenko , Shuah Khan , containers@lists.linux.dev, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-doc@vger.kernel.org, linux-security-module@vger.kernel.org, bpf@vger.kernel.org, apparmor@lists.ubuntu.com, keyrings@vger.kernel.org, selinux@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH v2 1/4] capabilities: Add user namespace capabilities Message-ID: <20240610124855.GA2193924@mail.hallyn.com> References: <20240609104355.442002-1-jcalmels@3xx0.net> <20240609104355.442002-2-jcalmels@3xx0.net> <20240610015024.GA2182786@mail.hallyn.com> <6pwskrbtmxjy2ti3xabfslmupjhat7dhrnbftinzhxgxnsveum@5jq5l6ws7hls> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6pwskrbtmxjy2ti3xabfslmupjhat7dhrnbftinzhxgxnsveum@5jq5l6ws7hls> On Mon, Jun 10, 2024 at 01:47:13AM -0700, Jonathan Calmels wrote: > On Sun, Jun 09, 2024 at 08:50:24PM GMT, Serge E. Hallyn wrote: > > On Sun, Jun 09, 2024 at 03:43:34AM -0700, Jonathan Calmels wrote: > > > Attackers often rely on user namespaces to get elevated (yet confined) > > > privileges in order to target specific subsystems (e.g. [1]). Distributions > > > > I'd modify this to say "in order to target *bugs* in specific subsystems" :) > > Ack > > > > This effectively mimics the inheritable set rules and means that, by > > > default, only root in the user namespace can regain userns capabilities > > > previously dropped: > > > > Something about this last sentence feels wrong, but I'm not sure what > > the best alternative would be. As is, though, it makes it sound as though > > root in the userns can always regain previously dropped capabilities, but > > that's not true if dropped in ancestor ns, or if root also dropped the > > bits from its bounding set (right?). > > Right, the wording is a little bit confusing here I admit. > What I meant to say is that if a cap is dropped in a *given* namespace, > then it can only be regained by root there. But yes, caps can never be > regained from ancestors ns. I'll try to rephrase it. > > BTW, this is rather strict, but I think that's what we want right, Yes, > something simple? Alternative would be to have a new cap masked off by > default, but if granted to a userns, allows you to regain ancestors > caps. we absolutely do not want to allow regaining caps dropped in an ancestor namespace. thanks, -serge