Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp3330251lqo; Tue, 21 May 2024 13:44:09 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVN5U1rFPrMAZCrk1MrvnTDErSAUuRh51v/0PX3HUpVDgWBcoAytqUwznB+KNs1alZp3FjjWv+Lrhp55AUBE5fzVGOHThPFUZsT8oFvHQ== X-Google-Smtp-Source: AGHT+IHL1B0Gr8vWNnRU7QYxyv9uV7ZLxIC39A99yyaQQpvaaQ24Tj2MbkblQgPjt/Pm0cQe8TSQ X-Received: by 2002:a05:6a21:800f:b0:1af:f8d9:2087 with SMTP id adf61e73a8af0-1b1f8a8c02cmr104942637.47.1716324249003; Tue, 21 May 2024 13:44:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716324248; cv=pass; d=google.com; s=arc-20160816; b=Ssl3H9c7JgqDiWjuXs+KwKCZ3i5d6gD9kIC/zc44SSKwc0yUzkpdtBggS++kFiogO1 t2R+UH4D5Js3wdVUFzW/u/yq0Fck+L9Bq2WpuTmOFON4VfGqABrhX0lRMKANKwtxP5Wi u3xxkjFoXC1p0yAyT4lceMe2LkE8K8OW2aKjgrb1Njq0BjRCNW/cn1VM9zYFnYpBHXBC 6B5x1ml3ioGLCI3BS7578kJDYLzt6Rilx2qXA2EVtbvUGrHO3Clv6TNAaiAltdmHf+Ez DDj9or42TJE7cgGFFQiBVROwpoPKA4+O7EItCQlzXHw0mHJKsyJXT2VTn7Qo7khBFPNT ZXDQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=c7N6rlTa5ppx9RAeRPq2mB8w6Nw+lsRi9BsRkwM6uhE=; fh=CqxjxcAxnGYe5/hpEhMXTLewry5/3PrPSzsvTF6Au9A=; b=uBferkwN+AucD0q2/D2LtwW4/8tWpnHDzYEU7tpBI6Zxd0Fl/mb4Q6HAaGUW8Za6sx rbb27GJ9zy8wyftF7BdOBo1oUI9QfiqT9gwSNPL/FcDX7wvNYE+xldLZ/ryvUB0Svjoz Am+BGQxin3HiQx7g5z/z45SJPoMhmUqrT+TEeunbhfZ5XpmL2/XYv2MmV4UzxtWGMf40 wxtBJ2cPThiFRIkJQ5r3SwXtBal/7+9yScCvKR1sJz7f5STinw5BNi9qZfcpfcxk+x7P QCTMXwkwgFtyXQUUl7AjQdhmck14coOegHPwNw2HjDZQJqVJYExU0xIzJ7RtSULSLaQs Vx7g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@yandex.ru header.s=mail header.b=SKT3Wtix; arc=pass (i=1 spf=pass spfdomain=yandex.ru dkim=pass dkdomain=yandex.ru dmarc=pass fromdomain=yandex.ru); spf=pass (google.com: domain of linux-kernel+bounces-185428-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-185428-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 41be03b00d2f7-63409e82541si1270854a12.11.2024.05.21.13.44.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 13:44:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-185428-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@yandex.ru header.s=mail header.b=SKT3Wtix; arc=pass (i=1 spf=pass spfdomain=yandex.ru dkim=pass dkdomain=yandex.ru dmarc=pass fromdomain=yandex.ru); spf=pass (google.com: domain of linux-kernel+bounces-185428-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-185428-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex.ru 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 2858AB22A51 for ; Tue, 21 May 2024 20:43:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A62FE149C5D; Tue, 21 May 2024 20:43:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=yandex.ru header.i=@yandex.ru header.b="SKT3Wtix" Received: from forward500b.mail.yandex.net (forward500b.mail.yandex.net [178.154.239.144]) (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 0779853816; Tue, 21 May 2024 20:43:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.154.239.144 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716324201; cv=none; b=NH5Gz/jrp/xwFUjtJjeOwyBQua7J6f0B4pogNORlZOcKC5ZTj4X9Wraqs/rOKIjaVSMlQGeHtOpVgWCo7Bv7Q/Oc75XikctdkV3eGOr30OjnGi0q/zjrpZLVwqZfNJbIhQFNvNln2mD/apN1cFBDAYYYPdEUCksZXtaOlD0jtKw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716324201; c=relaxed/simple; bh=UJeYAx0s+riUtaDffRhQZniXYmFCQfIeCHnUNZFJ0/k=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=KXLxz9oWhsS+xNVmezMv6wJMRn+JrlOidz8UXXIXDQ5jswXb+sY8E+ZwuTon3ZKAukSWdC5qEpsNjiAgcukHruNKUjVm2Gt9+uADzS1vtJQ3boVet07yBRLDUNjF/Y/V8H2wRSHSsyR1bPJ9f+oBBPFtef01woUaDuuhx/OTJuk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=yandex.ru; spf=pass smtp.mailfrom=yandex.ru; dkim=pass (1024-bit key) header.d=yandex.ru header.i=@yandex.ru header.b=SKT3Wtix; arc=none smtp.client-ip=178.154.239.144 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=yandex.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=yandex.ru Received: from mail-nwsmtp-smtp-production-main-78.myt.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-78.myt.yp-c.yandex.net [IPv6:2a02:6b8:c12:39ad:0:640:62fe:0]) by forward500b.mail.yandex.net (Yandex) with ESMTPS id A3851613DB; Tue, 21 May 2024 23:35:18 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-78.myt.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id GZQB3w8oDmI0-W1EtqRHB; Tue, 21 May 2024 23:35:17 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1716323717; bh=c7N6rlTa5ppx9RAeRPq2mB8w6Nw+lsRi9BsRkwM6uhE=; h=From:In-Reply-To:Cc:Date:References:To:Subject:Message-ID; b=SKT3Wtixr0847bCZuU1FA1EPajMmaeICi/K5joOm6b1Mz7LA/Cppwhwg8u2r4Ktya YpQ8xO8wgnibdHZKHCD+LE9aoIid3dWuSfUBaGb8QMRb4J2jjIZcxvZMsVyWzm8Y+v iqxosxvl1YnrIWLIPuRa48u/NAleBv8ge33M8tlA= Authentication-Results: mail-nwsmtp-smtp-production-main-78.myt.yp-c.yandex.net; dkim=pass header.i=@yandex.ru Message-ID: <125b6804-d9f8-4c36-83cd-36143ba1045d@yandex.ru> Date: Tue, 21 May 2024 23:35:16 +0300 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 0/3] implement OA2_CRED_INHERIT flag for openat2() Content-Language: en-US To: Jann Horn Cc: linux-kernel@vger.kernel.org, Stefan Metzmacher , Eric Biederman , Alexander Viro , Andy Lutomirski , Christian Brauner , Jan Kara , Jeff Layton , Chuck Lever , Alexander Aring , David Laight , linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org, Paolo Bonzini , =?UTF-8?Q?Christian_G=C3=B6ttsche?= References: <20240427112451.1609471-1-stsp2@yandex.ru> From: stsp In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 21.05.2024 22:01, Jann Horn пишет: > On Sat, Apr 27, 2024 at 1:24 PM Stas Sergeev wrote: >> This patch-set implements the OA2_CRED_INHERIT flag for openat2() syscall. >> It is needed to perform an open operation with the creds that were in >> effect when the dir_fd was opened, if the dir was opened with O_CRED_ALLOW >> flag. This allows the process to pre-open some dirs and switch eUID >> (and other UIDs/GIDs) to the less-privileged user, while still retaining >> the possibility to open/create files within the pre-opened directory set. > As Andy Lutomirski mentioned before, Linux already has Landlock > (https://docs.kernel.org/userspace-api/landlock.html) for unprivileged > filesystem sandboxing. What benefits does OA2_CRED_INHERIT have > compared to Landlock? The idea is different. OA2_CRED_INHERIT was supposed to give you an additional access (to what you can't access otherwise, after a priv drop), while landlock allows you to explicitly restrict an access. OA2_CRED_INHERIT more answered with idmapped mounts rather than the landlock, but idmapped mounts are not fully unpriv'd.