Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1860714rwr; Fri, 28 Apr 2023 02:55:14 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ52gnvQbcDOCOubv/CaPD5a64udLPm/wrPJd2bJKM7avXIe0Mo+yuPpHOPwQElgONw5y2Eb X-Received: by 2002:a05:6a20:94c9:b0:f0:71d0:153f with SMTP id ht9-20020a056a2094c900b000f071d0153fmr4760067pzb.14.1682675714261; Fri, 28 Apr 2023 02:55:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682675714; cv=none; d=google.com; s=arc-20160816; b=nEX/TDIsoMITKLa90KAyAgKjmREDK8A/LglLMz5xgA/6U5ZgLpDRkErBQfa11F4u6j Dyx2whJO9oq9q1lU8Zav40laP9YHvnWsf0hiUvsLiUXWVgbIcskYpV1k6HYHz8L4wevP ywhwmJLtlpaoSFsyW/RD2E0j5+LmgcW0yhAaJpnriCMdrejzp0DYVb3LS7elP37OuxRk Sf/OqJE3EGP/JMhrOOuIV85BKFEIGke2a9oTA5SalzuGCDL9Hj28v9s6Mpal8R2+Ddt0 RQOR48H3Qmbt6aAPlGJo0mOd2Dz0tESn4LiQNXa0FNz+GqJmRQ4VPvsjoyzg8jdZrkG8 3ppw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=6bAF8OWacQ8TFXQclejb78k1fH0h4CsJv5BTZI+9504=; b=t2gkpBTg1s1HzD9iRqmyVT2j76IIEQaxnlHeT9yswNVDa3FvdiTXGcmRG9uMEuko2a SpA9kmacucEv3tVLQFrWUDoq2Ai6YeJLmeXGrfQIpGpkItVsdm96Hf7dey1nY/Y0t3Wu QzGLv4o8cT4biSGk9EVR22cLQHEzgFhRthasmHcIZruCB41Hut3XGweUSGuRmjxruvW9 taf64hNDefXpw5l2qguAyiuJzw2fWlCzS8yK6ujNh9xSV54fDzKaWrwR//cqBI1epFg6 FHQjsHL1YS6PR7Y8orRvCuXW4L/B3Zk+pTISq2xFCTpKBi/qW/Q4G9lvl33Eu0SAGUGf eXgg== 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=antgroup.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k4-20020a6555c4000000b0051b2893b8c9si21130918pgs.442.2023.04.28.02.55.02; Fri, 28 Apr 2023 02:55:14 -0700 (PDT) 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=antgroup.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345523AbjD1Jyc (ORCPT + 99 others); Fri, 28 Apr 2023 05:54:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345518AbjD1JyS (ORCPT ); Fri, 28 Apr 2023 05:54:18 -0400 Received: from out0-214.mail.aliyun.com (out0-214.mail.aliyun.com [140.205.0.214]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 349B05BB9 for ; Fri, 28 Apr 2023 02:53:51 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R131e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047204;MF=houwenlong.hwl@antgroup.com;NM=1;PH=DS;RN=11;SR=0;TI=SMTPD_---.STFoGN5_1682675562; Received: from localhost(mailfrom:houwenlong.hwl@antgroup.com fp:SMTPD_---.STFoGN5_1682675562) by smtp.aliyun-inc.com; Fri, 28 Apr 2023 17:52:43 +0800 From: "Hou Wenlong" To: linux-kernel@vger.kernel.org Cc: "Thomas Garnier" , "Lai Jiangshan" , "Kees Cook" , "Hou Wenlong" , "Thomas Gleixner" , "Ingo Molnar" , "Borislav Petkov" , "Dave Hansen" , , "H. Peter Anvin" Subject: [PATCH RFC 17/43] x86/pie: Enable stack protector only if per-cpu stack canary is supported Date: Fri, 28 Apr 2023 17:50:57 +0800 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY 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 Since -fPIE option is not incompatible with -mcmode=kernel option, PIE kernel would drop -mcmodel=kernel option. However, GCC would use %fs as segment register for stack protector when -mcmodel=kernel option is dropped. So only enable stack protector for PIE kernel if per-cpu stack canary is supported. Signed-off-by: Hou Wenlong Cc: Thomas Garnier Cc: Lai Jiangshan Cc: Kees Cook --- arch/x86/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 55cce8cdf9bd..b26941ef50ee 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -403,6 +403,7 @@ config PGTABLE_LEVELS config CC_HAS_SANE_STACKPROTECTOR bool + default CC_HAS_CUSTOMIZED_STACKPROTECTOR if X86_PIE default $(success,$(srctree)/scripts/gcc-x86_64-has-stack-protector.sh $(CC) $(CLANG_FLAGS)) if 64BIT default $(success,$(srctree)/scripts/gcc-x86_32-has-stack-protector.sh $(CC) $(CLANG_FLAGS)) help -- 2.31.1