Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp2754933rdb; Mon, 5 Feb 2024 17:28:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IFN85QcCs08GyL/IylOubVXGfgak+PKUIDAOps7ulBG8IlEAPJRQjIlY+3FSYs5Kr/Yaf5n X-Received: by 2002:a17:906:f8d3:b0:a37:7bbf:1032 with SMTP id lh19-20020a170906f8d300b00a377bbf1032mr482048ejb.65.1707182934327; Mon, 05 Feb 2024 17:28:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707182934; cv=pass; d=google.com; s=arc-20160816; b=Ax8TreB/Do0Yn//2aTLvPIX0ikoX3BV5Hb0zFNn9jxI2fkfdPgDDvbZ9Vf4x70hgyT lL3t9fy1yNprhez1YVNajf5vgl1Kyo3gQVfNVR+6pq981dixzCpGywGdGgwz2lVTJIav wCe4gXAZd0kttsqg8Fh1vxGP79/TqEcuSJxuo7Nlh2qggTvWVpbJqjvdlS57sCOryX4t pUR0WvVtIO24FHDwK9EQIcO7X3uVpx1+vxeVBJnHDHiMyFAVu4OkZeu7Z1eoUk5POQ/k tuOPPH85evxcBlObp1l0Y8bZfLdLD13ug51sZKKHs7fg4XAUsZSMLGuLEvJ6YuUgA8tI 9++A== 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=2msMjp7qi9MQjJWycq0lFARLqZB5NGDH+vxogNf6TwE=; fh=FCDo0A59ZmhEsN5kWH0mK6pKTmkCyMALr3j9JrZIhf0=; b=i0q1DQIhVdCWBrVJTmbxFUcLOLtrpCmclmSID3h3hTV8vTl+UJW+cte2fSQZ9okrq9 7Y03nxahldUZx0oc37yQaQ2cxj32/xpAMztlSMWH0XeF1P9s9dufPIOOhcXYECdpMJ6X UKlI0rNZ/k3t6dUL9fbrI/vR6rHrhQYNpODUtpCbpoBg7UFtU187UfrHNqbgBPACTDHv i9a6U19MDHNmqo1RYi4dn2Lb2dPTYFyLGk5L8wADVbl3YwcdIYIVB4dKD99QqY7zn4DI 2PsTfjPjncrKCN8lG4fNhbzFu73sO8KOiJ3y01hq7v48DNPiB7Lt5jxzCMqPvmzEa3/D 8lMA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eo+yWVfu; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-54152-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54152-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCWIyc85ACOaeSJvNZ1jgsUyBl/glmIxcwewjkrP43DNHaAli0zbtmhmRlI0oWz2tM5la470Zc8gar9qPr5DncKgYgBji3OqXVA6kFlI6g== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id u11-20020a170906068b00b00a36cb0ec095si436830ejb.499.2024.02.05.17.28.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 17:28:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-54152-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=@kernel.org header.s=k20201202 header.b=eo+yWVfu; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-54152-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54152-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 1918D1F25041 for ; Tue, 6 Feb 2024 01:28:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 07BA21362; Tue, 6 Feb 2024 01:28:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="eo+yWVfu" 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 231EF4A12; Tue, 6 Feb 2024 01:28:38 +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=1707182919; cv=none; b=NNsd2MHE5N7p9Ykall8fn8LXUNfeAuBUBlfFVCJxJyslYAzKl8DKUQi8WEq40pY8BolMNMLyUqXtnpvlEkeGSdmGWmlq9z2+o917DG843+sxIsvAym6ULomiJa4KkLrNWMLTOYF0v0sCmccy4MWsoOl1Ot5krgdbPcORaoR+kQ8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707182919; c=relaxed/simple; bh=QYynlXCJIaRqirBsQY44in81LETdg2sbfbHwxOyF3eM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=oxONZ+QJUAMsfngo1kgZ74fXlXfNRtTF41pxZOgHr5pmHsdftVOZwYm4J+tLVw4UhbjkOjCFnWUlY5WBM3Lm212DBhAmc5fZRQhzCdeAmq4Z+Tr1HF6fhQ9v/sMSrLSdvWu5T0Y/6VnxzW8Cp9RdKLcpupRwuv4hsXjeqtQsPJs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eo+yWVfu; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A526C433F1; Tue, 6 Feb 2024 01:28:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707182918; bh=QYynlXCJIaRqirBsQY44in81LETdg2sbfbHwxOyF3eM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=eo+yWVfuelWwmRzpCVrimfvhnQxEfqkeMD6EGK/xaMY/z8pmZiFRXS01L/0OUE0XU EvKd72oJiF64QGNg9qOJT1JdbcaKJL0AJo/R72zV8xUSoQtVSgCAiMr9S7TO58bG2L 02rr2dTK7PNMik1kFC9nj8uCYPwa2qtqYdI5KIOl6RJCtV8PW6dP8BmSEP/BEDkfcY j9x4efhb7kC+N7upswSEpJc9x7viZpM/1adzYgKPQ6eeV0g6EhV5Rz0EcmMePfs7qS Ag6BsCJxvatkC/tXS+OFTkHLH6KcE0lrc9i8Y/jwq3HDnm7ojIKHpMC92SvxkyPPHU ORg0pqti2Frxw== Date: Mon, 5 Feb 2024 18:28:36 -0700 From: Nathan Chancellor To: Heiko Carstens Cc: Kees Cook , Nick Desaulniers , linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, Vasily Gorbik , Alexander Gordeev Subject: Re: [PATCH 1/2] Compiler Attributes: Add __uninitialized macro Message-ID: <20240206012836.GA2616098@dev-arch.thelio-3990X> References: <20240205154844.3757121-1-hca@linux.ibm.com> <20240205154844.3757121-2-hca@linux.ibm.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: <20240205154844.3757121-2-hca@linux.ibm.com> On Mon, Feb 05, 2024 at 04:48:43PM +0100, Heiko Carstens wrote: > With INIT_STACK_ALL_PATTERN or INIT_STACK_ALL_ZERO enabled the kernel will > be compiled with -ftrivial-auto-var-init=<...> which causes initialization > of stack variables at function entry time. > > In order to avoid the performance impact that comes with this users can use > the "uninitialized" attribute to prevent such initialization. > > Therefore provide the __uninitialized macro which can be used for cases > where INIT_STACK_ALL_PATTERN or INIT_STACK_ALL_ZERO is enabled, but only > selected variables should not be initialized. > > Signed-off-by: Heiko Carstens Reviewed-by: Nathan Chancellor > --- > include/linux/compiler_attributes.h | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/include/linux/compiler_attributes.h b/include/linux/compiler_attributes.h > index 28566624f008..f5859b8c68b4 100644 > --- a/include/linux/compiler_attributes.h > +++ b/include/linux/compiler_attributes.h > @@ -333,6 +333,18 @@ > */ > #define __section(section) __attribute__((__section__(section))) > > +/* > + * Optional: only supported since gcc >= 12 > + * > + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-uninitialized-variable-attribute > + * clang: https://clang.llvm.org/docs/AttributeReference.html#uninitialized > + */ > +#if __has_attribute(__uninitialized__) > +# define __uninitialized __attribute__((__uninitialized__)) > +#else > +# define __uninitialized > +#endif > + > /* > * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-unused-function-attribute > * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Type-Attributes.html#index-unused-type-attribute > -- > 2.40.1 >