Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp1374662rdb; Fri, 16 Feb 2024 13:52:49 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV8DhLayIPCm3BNiGl9AqbH6AOiVwVV7gYUpCn9Yg/xlKa4OHKZsd+9WYdmBmeMJQX/YlVhDuhfBJwEkdCvMR61WAZp5UQl4URv5Vzz4g== X-Google-Smtp-Source: AGHT+IEadzv+NwSCOVYCSNnWsBoMXuSN/h036pM8hy3XdZ1yNCUp4NzeYTaHA/0zDu6XH9q4kDmG X-Received: by 2002:a17:902:930c:b0:1d8:e4b8:95e5 with SMTP id bc12-20020a170902930c00b001d8e4b895e5mr5859994plb.32.1708120368908; Fri, 16 Feb 2024 13:52:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708120368; cv=pass; d=google.com; s=arc-20160816; b=kqORKjrUtLNWQFlnOYrchExVg9cCOg8N/kwkeHik8eZinsOS8nqNVU2KFydgdwgDV8 FRx6YPJ6a9QJ9+JUdlyk321aSSF+QJIN8jJI1HgqX8qm4Z4FxrauRABYuNSdenrY/L5x dBeucJPvAm8rocyG5L6gP77unL2mxjte06wOOyUjLgDEmOJfXnbJ/5GJjEUonUZRjBdP miuwBSAINpu25/YpH1d7SYnPUCRgxXW2y36IiHiM6j1D83bzWT2s1logNtYBBF7TmE9P o2BvI2rmsGnBPursJkHSGgCh9WPHChoKl/JquAPZjfS9sQSZhkGjDmopftlVAdWwCPYf 4Prg== 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=rtsFfzG8a5Y4gKlVc4iSnotBnYQWJOU2Pi/S9waSvFY=; fh=yGdV7utNEkGFdkSFSg2lpEHS6l++EDPl7aMh129rTIM=; b=hN42CwBsYCrEjzcs2/2GgLNTJH6Dycea1ZLRCFYis9WIrGEiVTAUdxmikoL3/d+6Fq 5QhEctk94RZSiVwgOvWxQz1kfMwS0pi9q1a4gABlrFz+exkNHOVu3s8toDKVeolz/1TY 1/COoaIkHWmMqTMRUnNsZbWBYA4LMPRaSAs15aOVzD/fX/xDggloqeoiLKZ3JMmXZiSD BgvyOs8pL59nvZdkJgBtRy7kyG+6/GYUrIMHZ+YqOUsRlOPmwdSF3kDmXA9UuRHFhMvD bFtAqpx1chPdOL81eRvubzLJqspifEwGFkiJZHmLWuDmn0UzUgp85CFOuycHZk+QwmMK pibQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=fr+cdO3g; 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-69363-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69363-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id jf7-20020a170903268700b001d948510d39si432669plb.429.2024.02.16.13.52.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 13:52:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69363-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=@chromium.org header.s=google header.b=fr+cdO3g; 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-69363-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69363-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 50CDDB2D9F1 for ; Fri, 16 Feb 2024 21:22:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 59C32145B3D; Fri, 16 Feb 2024 21:21:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="fr+cdO3g" Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (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 1E0FD145B18 for ; Fri, 16 Feb 2024 21:21:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708118512; cv=none; b=CvNVw9pnt+hCaHKXgaD3jvg9ojDTT2zVbrKxxZI1BkCd/kQIRRy/dF3+rqCVCm/v6fmohDp9vvZpk3XhjTmytMMpmcoqn1oA2Hz5lBlnmUWoEhk8J+Js/vntKKtc3tPsS/z+rO7qB5oTgBhkduaGf+nQXrFYQYbadxDWM9k8NjI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708118512; c=relaxed/simple; bh=8RkIdklDyDDa8h8JrnVfHzosWxPgtS0o2uyCwRZpqro=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=UHSuCPGNfnrJw2M0odQuLdDgYpdHwngoqcESMPPEnNsIS0zpyBp4tsA2buafkqXuXLilaTOBnSy0srGLw127us5TbfqCjMW20A3M5AbjSrrCDSgsPJIUZprydl37oXT/5H/3XBYEG9GRZWL4AcSyOdspyZfoUcF3VC2nqT2r/xg= 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=fr+cdO3g; arc=none smtp.client-ip=209.85.214.171 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-pl1-f171.google.com with SMTP id d9443c01a7336-1db562438e0so22865825ad.3 for ; Fri, 16 Feb 2024 13:21:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1708118510; x=1708723310; 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=rtsFfzG8a5Y4gKlVc4iSnotBnYQWJOU2Pi/S9waSvFY=; b=fr+cdO3gU2g2Jzz9eIVWQCdnY7kih0gn2m0N+DsRcYsxRG2umJf0xApOZ7Jo8QmZeU yUR3nlJ8Wc2erGfOAhoNPfE152p9DdMVPywICl2KAVuqUJIDNfUT+ymcvH2f4IWu2oey Ty7+54DGru9WZ9ap4H+jYpm3yS7LBSrlnwbMQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708118510; x=1708723310; 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=rtsFfzG8a5Y4gKlVc4iSnotBnYQWJOU2Pi/S9waSvFY=; b=GQArT3I8oF6kCp34MaQEz4IkhVtAvINoNwUf++X+ae/fxLcQqsozrL2GOyUt2Xl+Nf Sn5+boM6f+EVme44KAvAJj4UGy9uUJxe5rUCnC1k93fVmu8BGpZ31rbZ2x6vWyQJKmUN LKA0BgFdY77kp0Bo1yyfhEj7/sbDyPaBAc+7lBC+K8hHAVNACZ2Lptw+g4A1PQDXjNa3 DeZtgc4kVnZhpcBYG3IKFI9QqbGBan76mF1EasL1K37EfmoUOwZr2g7x+Fn1ISm4NnSU HsKDU37DOAdhoqXg72E/dPuJ1sWCgw92aBk2HlrGrcgzEyQpMQAKicGoT7X12fAnsbg2 zJOg== X-Forwarded-Encrypted: i=1; AJvYcCVZSvgQkIkdnN9iQjIUWQd2rfL6x7yG0M8rhv+HsSrON7pQ5uY8isXzI8+FYkA579+R7fsRdcdnuumYZ1BP5GQ7rhYFsXvW3sMaPEec X-Gm-Message-State: AOJu0Yz/9uoSH8PDU2A7qaW6yY6F8vDVC+OX/F93rUhQim67u4N7+J6A XrP8T4ETGUFdelIghDErIrIpoU85Xw3IWamOINZCP+Yu7URu+gMmD18lLc6w0Q== X-Received: by 2002:a17:902:784e:b0:1d9:ba26:effc with SMTP id e14-20020a170902784e00b001d9ba26effcmr5713961pln.51.1708118510303; Fri, 16 Feb 2024 13:21:50 -0800 (PST) Received: from www.outflux.net ([198.0.35.241]) by smtp.gmail.com with ESMTPSA id y12-20020a170903010c00b001d974ffa1fcsm292574plc.173.2024.02.16.13.21.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 13:21:49 -0800 (PST) Date: Fri, 16 Feb 2024 13:21:49 -0800 From: Kees Cook To: Arnd Bergmann Cc: Alexander Viro , Christian Brauner , Arnd Bergmann , Jan Kara , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Andrew Morton , Andi Kleen , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH] fs/select: rework stack allocation hack for clang Message-ID: <202402161321.B0B1D6F@keescook> References: <20240216202352.2492798-1-arnd@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: <20240216202352.2492798-1-arnd@kernel.org> On Fri, Feb 16, 2024 at 09:23:34PM +0100, Arnd Bergmann wrote: > From: Arnd Bergmann > > A while ago, we changed the way that select() and poll() preallocate > a temporary buffer just under the size of the static warning limit of > 1024 bytes, as clang was frequently going slightly above that limit. > > The warnings have recently returned and I took another look. As it turns > out, clang is not actually inherently worse at reserving stack space, > it just happens to inline do_select() into core_sys_select(), while gcc > never inlines it. > > Annotate do_select() to never be inlined and in turn remove the special > case for the allocation size. This should give the same behavior for > both clang and gcc all the time and once more avoids those warnings. > > Fixes: ad312f95d41c ("fs/select: avoid clang stack usage warning") > Signed-off-by: Arnd Bergmann Reviewed-by: Kees Cook -- Kees Cook