From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-44.freemail.mail.aliyun.com (out30-44.freemail.mail.aliyun.com [115.124.30.44]) (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 508317B for ; Wed, 23 Feb 2022 09:06:00 +0000 (UTC) X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R931e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04426;MF=ashimida@linux.alibaba.com;NM=1;PH=DS;RN=20;SR=0;TI=SMTPD_---0V5HHvjC_1645606221; Received: from 192.168.193.152(mailfrom:ashimida@linux.alibaba.com fp:SMTPD_---0V5HHvjC_1645606221) by smtp.aliyun-inc.com(127.0.0.1); Wed, 23 Feb 2022 16:50:22 +0800 Message-ID: <69d351c6-a69d-6ebb-53bc-b46dfe4da08a@linux.alibaba.com> Date: Wed, 23 Feb 2022 00:50:21 -0800 Precedence: bulk X-Mailing-List: llvm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.0 Subject: Re: [PATCH] [PATCH] AARCH64: Add gcc Shadow Call Stack support Content-Language: en-US To: Nathan Chancellor Cc: catalin.marinas@arm.com, will@kernel.org, ndesaulniers@google.com, keescook@chromium.org, masahiroy@kernel.org, tglx@linutronix.de, akpm@linux-foundation.org, mark.rutland@arm.com, samitolvanen@google.com, npiggin@gmail.com, linux@roeck-us.net, mhiramat@kernel.org, ojeda@kernel.org, luc.vanoostenryck@gmail.com, elver@google.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, llvm@lists.linux.dev, linux-hardening@vger.kernel.org References: <20220222095736.24898-1-ashimida@linux.alibaba.com> From: Dan Li In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2/22/22 08:16, Nathan Chancellor wrote: > On Tue, Feb 22, 2022 at 01:57:36AM -0800, Dan Li wrote: >> Shadow call stack is available in GCC > 11.2.0, this patch makes >> the corresponding kernel configuration available when compiling >> the kernel with gcc. >> config SHADOW_CALL_STACK >> - bool "Clang Shadow Call Stack" >> - depends on CC_IS_CLANG && ARCH_SUPPORTS_SHADOW_CALL_STACK >> + bool "Shadow Call Stack" >> + depends on ARCH_SUPPORTS_SHADOW_CALL_STACK >> depends on DYNAMIC_FTRACE_WITH_REGS || !FUNCTION_GRAPH_TRACER >> help >> - This option enables Clang's Shadow Call Stack, which uses a >> + This option enables Clang/GCC's Shadow Call Stack, which uses a > > I wonder if we want to just ditch the mention of the compiler if both > support it? > My intention is to remind users that this is a compiler feature. But since there is also a hint in CC_HAVE_SHADOW_CALL_STACK: +# Supported by clang >= 7.0 or GCC ... Removing the specific compiler here also looks fine to me. Would this look better? "This option enables Shadow Call Stack, which uses a ..." or maybe: "This option enables compiler's Shadow Call Stack, which uses a ..." >> shadow stack to protect function return addresses from being >> overwritten by an attacker. More information can be found in >> Clang's documentation: >> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig >> index 09b885cc4db5..a48a604301aa 100644 >> --- a/arch/arm64/Kconfig >> +++ b/arch/arm64/Kconfig >> @@ -1255,7 +1255,7 @@ config HW_PERF_EVENTS >> config ARCH_HAS_FILTER_PGPROT >> def_bool y >> >> -# Supported by clang >= 7.0 >> +# Supported by clang >= 7.0 or GCC > 11.2.0 > > Same thing here, although eventually there may be a minimum GCC version > bump to something newer than 11.2.0, which would allow us to just drop > CONFIG_CC_HAVE_SHADOW_CALL_STACK altogether. No strong opinion. > As Guenter said, I thought maybe we could mark the minimum available version for users :) Thanks, Dan. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2E80CC433F5 for ; Wed, 23 Feb 2022 08:51:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=qQhY7j7okdvpmxDLYGJRqRpP9N9S6ZnxiYp9vJCSVss=; b=E7j+7wVkiVKLyQ c9bEia3Ol3jU6HUBw160tTFvZjeXJrPUfistVZy9lqZ/GiXGEuT8+WIW061bqPRSEkuUrYP2GnSwn mjjcWR2CiEC9KiwxKbsuvooahcSv1Ahx4A1Kq1tqyTTIsyWNlrX4ck6HyplU/Un/01Uq/YNrM0AAB 7nf1D1xPdJSFxvHfkYE+P8lpEvepN/Xd4yV5BJr4RizmEwZ4DU121AW6fm7wWXpUhJev87zm6PQrO NDkhj3Q+i3RVXslX3U9GA8+qtK3I8m8aCC6Cx0M2h79NND/3DcX2M64fRbrzQUc/x+dSG7FnmkT5l dimhz3es71DiHUCEg+wA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nMnMB-00DKBm-Io; Wed, 23 Feb 2022 08:50:43 +0000 Received: from out199-9.us.a.mail.aliyun.com ([47.90.199.9]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nMnLx-00DK6y-5e for linux-arm-kernel@lists.infradead.org; Wed, 23 Feb 2022 08:50:31 +0000 X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R931e4; CH=green; DM=||false|; DS=||; FP=0|-1|-1|-1|0|-1|-1|-1; HT=e01e04426; MF=ashimida@linux.alibaba.com; NM=1; PH=DS; RN=20; SR=0; TI=SMTPD_---0V5HHvjC_1645606221; Received: from 192.168.193.152(mailfrom:ashimida@linux.alibaba.com fp:SMTPD_---0V5HHvjC_1645606221) by smtp.aliyun-inc.com(127.0.0.1); Wed, 23 Feb 2022 16:50:22 +0800 Message-ID: <69d351c6-a69d-6ebb-53bc-b46dfe4da08a@linux.alibaba.com> Date: Wed, 23 Feb 2022 00:50:21 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.0 Subject: Re: [PATCH] [PATCH] AARCH64: Add gcc Shadow Call Stack support Content-Language: en-US To: Nathan Chancellor Cc: catalin.marinas@arm.com, will@kernel.org, ndesaulniers@google.com, keescook@chromium.org, masahiroy@kernel.org, tglx@linutronix.de, akpm@linux-foundation.org, mark.rutland@arm.com, samitolvanen@google.com, npiggin@gmail.com, linux@roeck-us.net, mhiramat@kernel.org, ojeda@kernel.org, luc.vanoostenryck@gmail.com, elver@google.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, llvm@lists.linux.dev, linux-hardening@vger.kernel.org References: <20220222095736.24898-1-ashimida@linux.alibaba.com> From: Dan Li In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220223_005029_517434_94BB4524 X-CRM114-Status: GOOD ( 16.63 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2/22/22 08:16, Nathan Chancellor wrote: > On Tue, Feb 22, 2022 at 01:57:36AM -0800, Dan Li wrote: >> Shadow call stack is available in GCC > 11.2.0, this patch makes >> the corresponding kernel configuration available when compiling >> the kernel with gcc. >> config SHADOW_CALL_STACK >> - bool "Clang Shadow Call Stack" >> - depends on CC_IS_CLANG && ARCH_SUPPORTS_SHADOW_CALL_STACK >> + bool "Shadow Call Stack" >> + depends on ARCH_SUPPORTS_SHADOW_CALL_STACK >> depends on DYNAMIC_FTRACE_WITH_REGS || !FUNCTION_GRAPH_TRACER >> help >> - This option enables Clang's Shadow Call Stack, which uses a >> + This option enables Clang/GCC's Shadow Call Stack, which uses a > > I wonder if we want to just ditch the mention of the compiler if both > support it? > My intention is to remind users that this is a compiler feature. But since there is also a hint in CC_HAVE_SHADOW_CALL_STACK: +# Supported by clang >= 7.0 or GCC ... Removing the specific compiler here also looks fine to me. Would this look better? "This option enables Shadow Call Stack, which uses a ..." or maybe: "This option enables compiler's Shadow Call Stack, which uses a ..." >> shadow stack to protect function return addresses from being >> overwritten by an attacker. More information can be found in >> Clang's documentation: >> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig >> index 09b885cc4db5..a48a604301aa 100644 >> --- a/arch/arm64/Kconfig >> +++ b/arch/arm64/Kconfig >> @@ -1255,7 +1255,7 @@ config HW_PERF_EVENTS >> config ARCH_HAS_FILTER_PGPROT >> def_bool y >> >> -# Supported by clang >= 7.0 >> +# Supported by clang >= 7.0 or GCC > 11.2.0 > > Same thing here, although eventually there may be a minimum GCC version > bump to something newer than 11.2.0, which would allow us to just drop > CONFIG_CC_HAVE_SHADOW_CALL_STACK altogether. No strong opinion. > As Guenter said, I thought maybe we could mark the minimum available version for users :) Thanks, Dan. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel