Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1261180rdb; Wed, 24 Jan 2024 09:25:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IHIRBaWBI9mR1ZVlsIeJgugA/Q3oAV+ji4KdZmqhgEi2rLIoGLQRgO0pYotYJ5ZNFm3DGHP X-Received: by 2002:a17:907:a708:b0:a2f:1466:a3e4 with SMTP id vw8-20020a170907a70800b00a2f1466a3e4mr1284256ejc.25.1706117154310; Wed, 24 Jan 2024 09:25:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706117154; cv=pass; d=google.com; s=arc-20160816; b=sflSD2JkH5lcOgGcQCsaYDdsMVpRa3QzTd4rB4c9bq9o72g8gMkZMdv+ylvDFy9d7c qRVAU+vUWwARstweEyd9CM67UfTvLApHFlThFE/yOJBZaEYrtjmVWu0DeNr92KYnZYlt vkR8uzFWgbVNU/8mnyqSkHkpnXesruQbTVPoXj6Ht8lsGpAPEznBnUu0LcC6D42qIiGd ZYNYxPv2H9sfwmaIHxN3Rwua1uolWUsVcvlZvbXKmUuRQMHZfrRQ2jkZRfcpOoXmKYoa qO2fcK4C2BgbBOuPMPeTPpqDFCg7orJ0uVtGPs4ZuLstyv4UrvSQKzYeb63josQpJzWR H9ww== 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=o3H+ezh5j15p10TUIQ78gJT0AbI3MbNz0EQ5MG5g6Js=; fh=LNd4Pnsv7g8vqjJOk5DC09YihPPugcLoiV7xeUa1dxE=; b=tFEG3TnL9iQjvQNfU12bJGnDjmFyxLb+0BqFIfOwGYE5TBC9fnIAENKzjO1hBR/0Pt uoE4i0ALuc7+05mIJBGsosVWntKshT9CcICZjie0WelNgtodhL4jKpVcGzjIRe7ES+UC nWUL7uq6VibVpws0bRK19bYqNP1MUoKVwfGSQtHrt2M+8B2uNE9djGEOTP6AjGlYOZyt 4IEkH18qCxBZQKL32SGgk5QO1dBpwrPxkyR17wUlUuFOT7U09tTUnZdnn6XFRMJ7abH6 t7espxShcqzfyl3yrVot5qaTx+SIZ95x1OugV8CaQw2ZpdSNFr0paWDerqaMDKXnh42O kVEw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=KloGb6hc; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-37415-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-37415-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id hb26-20020a170906b89a00b00a30f19a507bsi85411ejb.517.2024.01.24.09.25.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 09:25:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-37415-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=KloGb6hc; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-37415-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-37415-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.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 am.mirrors.kernel.org (Postfix) with ESMTPS id D99F51F2B9B9 for ; Wed, 24 Jan 2024 17:25:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 42D2F7E789; Wed, 24 Jan 2024 17:21:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="KloGb6hc" Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) (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 13D3981AD7 for ; Wed, 24 Jan 2024 17:21:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706116877; cv=none; b=VxApK8ptXyVwa3wfjEZiPj/Kx+0vWKDyCMLokT5yX0t3d7V/9F7fno6YBErAVcLDWs6sSD8k5f4eS2nva64mrWApBWCmY5Mn3ZFxfVAbDH89Y/ov3RVE1kM+GdwIyN4a8tYb+cdjFKn5U2pIo2po7ewCA0BDyr2/qWJwvVnJn4I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706116877; c=relaxed/simple; bh=i0fh2fvqUB6h0Bq9w6eV538kz5PYIbRga3q0Tr+/O4g=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=lpboCd/l7NaY9QcVzUPaqDBO2tTUXFmGAkFYlxpODgt1+r9PiDBZcqUkYeRLCxsRf4yQWHiQkp0LzCwMOQuNCcJS7e9ylTvXtI9YkKQF50F3Ym2fX+NmgR22XWLlVYTHV6WeRl3dYubiWWyxvP9ODflU5/McIFRsPwwOrt/GU4w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=KloGb6hc; arc=none smtp.client-ip=209.85.215.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pg1-f169.google.com with SMTP id 41be03b00d2f7-5cfd95130c6so1517494a12.1 for ; Wed, 24 Jan 2024 09:21:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1706116875; x=1706721675; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=o3H+ezh5j15p10TUIQ78gJT0AbI3MbNz0EQ5MG5g6Js=; b=KloGb6hcbTufAwdkYqlBSsWZOgn0F6LTXmIJSgH9nORprcQx8B2lRFJwhTiC2pO2+4 fLHqqbiXPDUjPxlVt+kyLdHcTMULTYXLTqLdPOT55mTc8/XIaUU9S4krI65CVfTFFBuL WzleLev4QZD/VY7xznAXEGiD/XokWkniDoLr0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706116875; x=1706721675; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=o3H+ezh5j15p10TUIQ78gJT0AbI3MbNz0EQ5MG5g6Js=; b=nFxbYHiL8C+K47QbFUBBOlBpoe5oBgsQkmI12U8kjsqKefuxxrdn24sgBev43rzAmy ZpTJM+dpzD9YeB1k5X7Kt83VW+GS0P3rJiEX5ilocHOISsrbGhwSA3FLx3YaYwIk8tbs axxx87AVsJD3eceXw+qAy/Gd1N1vyHaIEqLBuScCcSXoqV0oneoNhqUcR1xZafCEzzKu dfS1cQ/LJCKHWUpQWYttHWBL8D51dbSRXY+UYCDUx/kVpghimoIvGbomSMIbd+/pvQxs FJGYI1kOJy53gX6wkBR9MBrHtl4oTu2LyQ1ceGS47f96g8vV6jTCu4FIvqup6UbbceSb 6row== X-Gm-Message-State: AOJu0Yx46iN4Pe1wf7hLJc3PoJnhKarBrIizxA3gbHKKur+lCmSFQ8SN kf33D675CwxN7LwH4IJ13WByyiOCQLqNhI+wknq4N9ETuWkS5nhPkOEFO3hkGg== X-Received: by 2002:a17:90a:cf87:b0:28d:c7bf:3a12 with SMTP id i7-20020a17090acf8700b0028dc7bf3a12mr4364083pju.8.1706116875365; Wed, 24 Jan 2024 09:21:15 -0800 (PST) Received: from www.outflux.net ([198.0.35.241]) by smtp.gmail.com with ESMTPSA id st13-20020a17090b1fcd00b0028cf59fea33sm13880703pjb.42.2024.01.24.09.21.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 09:21:14 -0800 (PST) Date: Wed, 24 Jan 2024 09:21:14 -0800 From: Kees Cook To: Linus Torvalds Cc: Kevin Locke , John Johansen , Josh Triplett , Mateusz Guzik , Al Viro , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org Subject: Re: [6.8-rc1 Regression] Unable to exec apparmor_parser from virt-aa-helper Message-ID: <202401240916.044E6A6A7A@keescook> References: <202401240832.02940B1A@keescook> 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: On Wed, Jan 24, 2024 at 09:10:58AM -0800, Linus Torvalds wrote: > On Wed, 24 Jan 2024 at 08:54, Linus Torvalds > wrote: > > > > Hmm. That whole thing is disgusting. I think it should have checked > > FMODE_EXEC, and I have no idea why it doesn't. > > Maybe because FMODE_EXEC gets set for uselib() calls too? I dunno. I > think it would be even better if we had the 'intent' flags from > 'struct open_flags' available, but they aren't there in the > file_open() security chain. I think there were other problems that I might have already fixed when I reorganized things in commit 0fd338b2d2cd ("exec: move path_noexec() check earlier") to more correctly map to LSM checks. > Anyway, moving current->in_execve earlier looks fairly trivial, but I > worry about the randomness. I'd be *so*( much happier if this crazy > flag went away, and it got changed to look at the open intent instead. > > Attached patch is ENTIRELY UNTESTED. And disgusting. I opted to tie "current->in_execve" lifetime to bprm lifetime just to have a clean boundary (i.e. strictly in alloc/free_bprm()). -Kees -- Kees Cook