Received: by 2002:a05:7208:2202:b0:86:316c:7444 with SMTP id s2csp670120rbb; Fri, 31 May 2024 14:16:48 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUkKeDnQufUop7a+qbHemeyRnVkVF34HgHgSwkcY8ZGidztFYJ7XUxWirB3jrzcLeAVGun9Q0gC+4nWCGKFIjNYPmptj0V+Ibpen8Ma9A== X-Google-Smtp-Source: AGHT+IFER1C2nattZTHn9gcHTixytipM/h59MFX7wwVVzUfv5YOqdJtI9ZJVTwdzA5i6aXfKMWjY X-Received: by 2002:a17:903:1112:b0:1f4:b2ce:8dbe with SMTP id d9443c01a7336-1f636fe892amr34616835ad.9.1717190208337; Fri, 31 May 2024 14:16:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717190208; cv=pass; d=google.com; s=arc-20160816; b=AjfkCGwHgrp2OKseqe84Rfq28xP1fQOlMJQ64YhBMLcmKz6RMVfRX6pRaFNcLSMZD5 zmJp/eKk8fxpQCosFN/GJuWKhil6Y1Z28NVaDRWvtxfPY1kmNr+bdvZKxnCFJckXIlw7 YKLT85WHVPlgOYLDuVQG2DQN+jAY5o+IGccKxFzn77L5Yaz50bxjiGQzstBMxmhLWw+e gHAzJ1u1wXmm7EzwvvYz9ymUb7JD54IcI//Yvu1XWjbWro7r5Vb/86wTmmGaivkNXGv5 WH8Z4nol1TYombkpziXTJcgFZXmgfdC+4LAfT6bsxphINKx/jJ6903Vgho5q/BE46o7S Ciuw== 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:dkim-signature; bh=bLJEgLpSKwPSs0RtS93+C6wr23jwilTgNXYi0RLqThg=; fh=mPOC/ZXSmkd2NZ4qGH/GNLmRrh//DYLVHGWu7HKMar4=; b=09DGBSdOComH/R5ZnzuWGUlkOZ7VdfAHR9nFZjQnc161IfAEMIlRZt3ZyVAMbIw/xC Jyj0Vw/svd7BPWH58FuTagnFyRn71KlQxOWnBn+wtulcRTZrry1gjVbUnMwXotMdSsut JuDDl8tCcGi813wIQCTeKSwwqntOr1MT3rveRXMBYNAWicikwKVlfXIxd8re2dI0XfNV l9JbWN8P6d+069vEFQezB8BqXSir1w4XY9jxc0eGqYbCWqX0WYNj/FGIi1lB6fBULikM Re1v75TYtikkUSYCVDbj8/EJbD8XjooIQIgwx4l3Rsy8BDxS8z9o1jENUs5cX8KpCvbS O/ow==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jwVjSWrK; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-197491-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197491-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d9443c01a7336-1f6323eb6c6si21643725ad.408.2024.05.31.14.16.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 14:16:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-197491-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jwVjSWrK; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-197491-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197491-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 054B4281E66 for ; Fri, 31 May 2024 21:15:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E851E12F5BB; Fri, 31 May 2024 21:14:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jwVjSWrK" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 089368286B; Fri, 31 May 2024 21:14:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717190045; cv=none; b=Yn3l2PO3C0VSlRPN7wyWbAi99tMT7mzaeWUlwAzMW+6yXl8/Ovo1OUSiTtZYcguN7ZHJNj7IOhhi4asA1ptNx6d9ic6TW0XOZdR+zjjLNN3skQq/opWoZ6+JXAiKauzvYFjlNwH/0bqoJdprATqheimL1ZsaesTYMURFcmyr4/0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717190045; c=relaxed/simple; bh=adcGqVW2UvBtdH178ghT0VtsdZKk0LvV3foBZFisFvc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Oyvx/Hphi5nTxZHvgB2OLFJOM/HIKGafSr3Jz7QVYVtqPG0+Fcwu4WriKZQ//XUJmmbPwdoTkslN4gcbkbTjvrfijXdtNqFHxml+Rt1LDr/3O9FXlhgEfgK8ihB7Bz86TGJbSrJLuMUwidn6dvMmYTuOCzUQ+RONePb4LuPu/oI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jwVjSWrK; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B7B1C116B1; Fri, 31 May 2024 21:14:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717190044; bh=adcGqVW2UvBtdH178ghT0VtsdZKk0LvV3foBZFisFvc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=jwVjSWrKXGPuSQjpIChdAY5ufSTBn3v+zt08V9iOrzMZ9PRS1cjFZezX41v+4Luu4 7aRvnfgWUCxogZiVlOMWMh26SFzxAQvNStNqWUKF/i6oobvcI0srxxse2a0pLem05T tpwALGI6Stvs6VBO4On/1ingmaW52ItW4VfHPHeMhmJ3+aVB4wReVV1KNif1/NFGUd XUB9qTO9VInOIsvcdMrlZgXJ3yJoFx3lMSmwcQTEsM9Cca8biZ60rz//LdlbO+WsbT B65Sb+yjkik0MUQhynwFTbkIjxIJtYFHFISUJtd0+iT/RPZCX04hcmLlVO3oOyRJQC KzG/hj78Jl4ww== Date: Fri, 31 May 2024 14:14:04 -0700 From: Kees Cook To: Adrian Ratiu Cc: linux-fsdevel@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, linux-doc@vger.kernel.org, kernel@collabora.com, gbiv@google.com, ryanbeltran@google.com, inglorion@google.com, ajordanr@google.com, jorgelo@chromium.org, Jann Horn , Christian Brauner Subject: Re: [PATCH v4 1/2] proc: pass file instead of inode to proc_mem_open Message-ID: <202405311413.DF87BBE491@keescook> References: <20240524192858.3206-1-adrian.ratiu@collabora.com> 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: <20240524192858.3206-1-adrian.ratiu@collabora.com> On Fri, May 24, 2024 at 10:28:57PM +0300, Adrian Ratiu wrote: > The file struct is required in proc_mem_open() so its > f_mode can be checked when deciding whether to allow or > deny /proc/*/mem open requests via the new read/write > and foll_force restriction mechanism. > > Thus instead of directly passing the inode to the fun, > we pass the file and get the inode inside it. > > Cc: Jann Horn > Cc: Kees Cook > Cc: Christian Brauner > Signed-off-by: Adrian Ratiu With the nommu errors pointed out by 0day fixed: Reviewed-by: Kees Cook -- Kees Cook