Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1333179rdb; Wed, 24 Jan 2024 11:39:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IENLtZ6zEDEE7Zi8vpyVQFwt/XTxfS9PmCLAu9quOsmuVUoY3zrSzhPSPKzJoZPQw/0dQ9r X-Received: by 2002:a17:902:bb87:b0:1d7:4e9e:55f with SMTP id m7-20020a170902bb8700b001d74e9e055fmr1032703pls.72.1706125199692; Wed, 24 Jan 2024 11:39:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706125199; cv=pass; d=google.com; s=arc-20160816; b=Vtp3v5E+pipAwpXibDQYHJwHXKaVyh1ZFt1HFZeSHt9eZAp0huDj+WDxw74foDFoUR YHq6p6qzEyV18tdDfyOv/vob2HNubtHarrjU9wu/swKKNVQMx7XTzdTr18ewD2Btg8G/ oLbcuUQ0kga9DamTNI+hpNTOrUpCtDZUAn0Q3GLuplh8FzsyhMntoLD2nOVAcqrWqKMD /fMpgTAfrN3BlP4UJd2PPtafBEjAMbb3cwwU4Vb0PX6qox419MDkdL5OCT11AlHq0Sh2 6QKGf6T3df3hwiMY0rlIxgjlqrfBSOmzVCH5iNUZaM7tSF6zlQ1Ot5hipyPguDjxCEuD 2RMQ== 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:mail-followup-to :message-id:subject:cc:to:from:date; bh=F+Zlj8yDqUy/uj451nk0vWDUSr/9Xc0ZiokYmRYFXns=; fh=YGwIvHsWSUpjRzFkePXgt+/EMhCZYOd3mbi6rNgQNaQ=; b=JFhECMeeXPQGRLJM7uQI+qfGSOpLf5lOyJFDgJR9mJdQ6IXaoWAFm4tbH/RN/ZRYd/ cc+qwW+IS1o7BpFEnB3H0MuAH617W0FPAOyP5efZDrB07xaoXiaQC6rP2zCRBVab4gdd 8mRj43fxyS2sNNLOKvakmwc8GB9ndC8XgsX2Hl9O7qzVlCUCvpQ7Lqg5NYBLRG0bEDD0 w+LXyipxWe8S63OzCVKxRDrSvX6CfXs6wk+Sax98El8zfnCL5OLwJkCbJrFURYhSCZTn gMlmru5Mox1a/RGJC9VtdD6E7Qug+ItmO+folLmNQOVlkxC0WAFOWkjOff/VG5hWWK8V UU2Q== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=kevinlocke.name dmarc=pass fromdomain=kevinlocke.name); spf=pass (google.com: domain of linux-kernel+bounces-37601-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-37601-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kevinlocke.name Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id ix6-20020a170902f80600b001d6fe4777casi11773064plb.403.2024.01.24.11.39.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 11:39:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-37601-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=kevinlocke.name dmarc=pass fromdomain=kevinlocke.name); spf=pass (google.com: domain of linux-kernel+bounces-37601-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-37601-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kevinlocke.name 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 CFF642862DA for ; Wed, 24 Jan 2024 19:39:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 56FB613340E; Wed, 24 Jan 2024 19:39:48 +0000 (UTC) Received: from vulcan.kevinlocke.name (vulcan.kevinlocke.name [107.191.43.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 545497CF3F; Wed, 24 Jan 2024 19:39:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=107.191.43.88 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706125187; cv=none; b=g64xYSi6d8j92GNnFgedfxMxU9t/GiHJ10SDqWeKZ9weBxJoLGog5vE0RzYiDSYmYudm3oXi6P/ifU9QGo5VFpHxsBSJElrnrXUheH7LbY5ZM81IW+A6dhQRG1PNvY8c1KoIzJ49icbmqNBetPyrc04d5JxbU8m6QkcBlI/Se7Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706125187; c=relaxed/simple; bh=Dn4eBbVr9QVOAUz7Avvf+TmQNYzWT6GQxAJUnj39vkY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=K75a5a7AD+Y71NWrcCk2KA6t8C1yrOncW0yf1HN9G/scKR5pobPF3mw9dFK680rIh5ot/zOiLWtNoIOSRmGARID+V/2fGZQcuwqXPm9j1d4wjkTV5fTu/9Fnl5mai1S63xm5HcXuaibSw0Lo71pM8mk/hDaKAryuVoWjPOI6elA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=kevinlocke.name; spf=pass smtp.mailfrom=kevinlocke.name; arc=none smtp.client-ip=107.191.43.88 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=kevinlocke.name Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kevinlocke.name Received: from kevinolos.kevinlocke.name (2600-6c67-5000-0a52-00e4-35b0-b82a-0c08.res6.spectrum.com [IPv6:2600:6c67:5000:a52:e4:35b0:b82a:c08]) (Authenticated sender: kevin@kevinlocke.name) by vulcan.kevinlocke.name (Postfix) with ESMTPSA id 86E254143C5F; Wed, 24 Jan 2024 19:39:41 +0000 (UTC) Received: by kevinolos.kevinlocke.name (Postfix, from userid 1000) id D511C1300145; Wed, 24 Jan 2024 12:39:38 -0700 (MST) Date: Wed, 24 Jan 2024 12:39:38 -0700 From: Kevin Locke To: Kees Cook Cc: Josh Triplett , Linus Torvalds , John Johansen , Paul Moore , James Morris , "Serge E. Hallyn" , Kentaro Takeda , Tetsuo Handa , Alexander Viro , Christian Brauner , Jan Kara , Eric Biederman , Andrew Morton , Sebastian Andrzej Siewior , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] exec: Check __FMODE_EXEC instead of in_execve for LSMs Message-ID: Mail-Followup-To: Kevin Locke , Kees Cook , Josh Triplett , Linus Torvalds , John Johansen , Paul Moore , James Morris , "Serge E. Hallyn" , Kentaro Takeda , Tetsuo Handa , Alexander Viro , Christian Brauner , Jan Kara , Eric Biederman , Andrew Morton , Sebastian Andrzej Siewior , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org References: <20240124192228.work.788-kees@kernel.org> 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: <20240124192228.work.788-kees@kernel.org> On Wed, 2024-01-24 at 11:22 -0800, Kees Cook wrote: > After commit 978ffcbf00d8 ("execve: open the executable file before > doing anything else"), current->in_execve was no longer in sync with the > open(). This broke AppArmor and TOMOYO which depend on this flag to > distinguish "open" operations from being "exec" operations. > > Instead of moving around in_execve, switch to using __FMODE_EXEC, which > is where the "is this an exec?" intent is stored. Note that TOMOYO still > uses in_execve around cred handling. It solves the AppArmor issue I was experiencing and I don't notice any other issues. Tested-by: Kevin Locke Thanks! Kevin