Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2715321pxm; Mon, 28 Feb 2022 04:59:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJy4vnM4gdvT3+4FX+oDxYbm8Q7gpnjsFsC3XQXOQ9CdPnMReb+MhVGbKd5+EQPzSvbQ2wyj X-Received: by 2002:a17:906:c344:b0:6b4:c768:4a9a with SMTP id ci4-20020a170906c34400b006b4c7684a9amr15179559ejb.151.1646053140266; Mon, 28 Feb 2022 04:59:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646053140; cv=none; d=google.com; s=arc-20160816; b=veYTrtOYwLeyvgnkBztRf4HwXp9fxZtt6E4t9Cqhmm+xKzCnf/kvkUM/YOHAUcM21W rY+kvndrkeO813xIPoTlaQETi10TzRRrWXfH4psi6xGP9+GGXWFjemEyW6KtCEuf+aZ6 3W8fhtXRFcV5jdmTrIVkhDD/kgufwbhGV8O6yLLNDl0THaQ2Bm/mqyNowSn1+fkIND7v mbXgZW4DrlDxtcKFVmSPBrjJm4QgYjARhAzWRAXopJuZeLPKjQzdj2uz7F6SYD77OrDU vKCPbrW9DykMj+vQGGqXSz0qtyYXXklJZ6YLT4DP9KlCaqVXGSKH/jakLBLFPckJYZG3 1fiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=ygESTQbS/hDgazAzmfEwisG9ihdCVndZTGaz8bqHv00=; b=TBXGp89IForrEE8xXtSNDzXaM7+Vb5oRrvOVwBdFNu4VvewFV08Fb15spMpFTnH97y wwRfHwTl1l3pfv+RM2rrd1/7bUyDf+GnDNy3XtPcbbxmsqwEZAakIGKElYxIDQxCJK5A knKesTRyuZPYmWcyl36gGJzKGWIEBX61s9DgmW53k8495124dKk5aHLdmhJEYOSOSb81 ALB3uUjENbSt0c1CiuOBv9kYkYrljND4k4a6lnHkFx5NOnqEq4GeyUUJn/boQbuMoY00 yrBk+4BG6uemH1NLvekk9UgWQKTXBi/o1xJeAmdGsACTFTsk/IO+oa97bpDwxF4XBk9Y +cTg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z12-20020a056402274c00b0041153735385si9722884edd.427.2022.02.28.04.58.37; Mon, 28 Feb 2022 04:59:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233644AbiB1HiY (ORCPT + 99 others); Mon, 28 Feb 2022 02:38:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229882AbiB1HiX (ORCPT ); Mon, 28 Feb 2022 02:38:23 -0500 Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E25612B25B; Sun, 27 Feb 2022 23:37:44 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R181e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04400;MF=ashimida@linux.alibaba.com;NM=1;PH=DS;RN=21;SR=0;TI=SMTPD_---0V5h6dX7_1646033858; Received: from 192.168.193.153(mailfrom:ashimida@linux.alibaba.com fp:SMTPD_---0V5h6dX7_1646033858) by smtp.aliyun-inc.com(127.0.0.1); Mon, 28 Feb 2022 15:37:40 +0800 Message-ID: <26a0a816-bc3e-2ac0-d773-0819d9f225af@linux.alibaba.com> Date: Sun, 27 Feb 2022 23:37:38 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCH] [PATCH v2] AARCH64: Add gcc Shadow Call Stack support Content-Language: en-US To: Miguel Ojeda Cc: Catalin Marinas , Will Deacon , Nathan Chancellor , Nick Desaulniers , Kees Cook , Masahiro Yamada , Thomas Gleixner , Andrew Morton , Mark Rutland , Sami Tolvanen , Nicholas Piggin , Guenter Roeck , Masami Hiramatsu , Miguel Ojeda , Luc Van Oostenryck , Marco Elver , linux-kernel , Linux ARM , llvm@lists.linux.dev, linux-hardening@vger.kernel.org References: <20220225032410.25622-1-ashimida@linux.alibaba.com> From: Dan Li In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/25/22 12:47, Miguel Ojeda wrote: > On Fri, Feb 25, 2022 at 4:24 AM Dan Li wrote: >> >> + - Clang (https://clang.llvm.org/docs/ShadowCallStack.html) >> + - GCC (https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html#Instrumentation-Options) > > Maybe Clang: and GCC: instead of the parenthesis? > Got it. >> +#ifdef CONFIG_SHADOW_CALL_STACK >> +#define __noscs __attribute__((__no_sanitize__("shadow-call-stack"))) >> +#endif > > Since both compilers have it, and I guess the `#ifdef` condition would > work for both, could this be moved into `compiler_types.h` where the > empty `__noscs` definition is, and remove the one from > `compiler-clang.h`? > In the clang documentation I see __has_feature(shadow_call_stack) is used to check if -fsanitize=shadow-call-stack is enabled, so I think maybe it's fine to use "#ifdef CONFIG_SHADOW_CALL_STACK" instead of "#if __has_attribute(__no_sanitize_address__)" here, then move it to `compiler_types.h`. And from the results of my local clang 12 compilation, this doesn't seem to be a problem. Link: https://clang.llvm.org/docs/ShadowCallStack.html#has-feature-shadow-call-stack