From patchwork Tue Mar 9 12:35:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Suchanek X-Patchwork-Id: 12124929 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96C75C433E0 for ; Tue, 9 Mar 2021 12:37:33 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 25A996523F for ; Tue, 9 Mar 2021 12:37:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 25A996523F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=V7iicvHM15I2J6Sh2XSa9dX9lK89uBggweomvd2lF5E=; b=n6qEwRLZ7UWTS79xNfX6bS36bZ yml3HBRSRdikH+TvYKIERh6bpuJwAw1H5Yj+24UTrcy16Za5ObR/I0IJWim1fw0DEWHSrrK9regXC G53fQaxq+tnopKwnBpzZYKnGcsT8mw2DNyG9wnkTxDwCIJQX5Z90rieadi7gn3IiHRSNIn9m85DYY doGJX1v6qIzvF4fjZaA2MZyraGzUgzE4/9KgqVDOu8zPsnlKR1wBcvrNQWUVggetjb8nZZOT2p8S1 L8rfDffRMf2Kbz9Q00Te2yXc6lkIdmmqOppcR72XpIpCkDhD4Lcqc0rsQnudvK9R+xYnwD9Mq/7Yv hUAmW0Gw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lJbaj-004TDB-Tw; Tue, 09 Mar 2021 12:36:02 +0000 Received: from mx2.suse.de ([195.135.220.15]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lJbaf-004TCp-03 for linux-arm-kernel@lists.infradead.org; Tue, 09 Mar 2021 12:35:58 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id AEF72AB8C; Tue, 9 Mar 2021 12:35:55 +0000 (UTC) From: Michal Suchanek To: linux-arm-kernel@lists.infradead.org Cc: Michal Suchanek , Catalin Marinas , Will Deacon , linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [PATCH] arm64: make STACKPROTECTOR_PER_TASK configurable. Date: Tue, 9 Mar 2021 13:35:44 +0100 Message-Id: <20210309123544.14040-1-msuchanek@suse.de> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210309_123557_254075_E34935C1 X-CRM114-Status: GOOD ( 11.23 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When using dummy-tools STACKPROTECTOR_PER_TASK is unconditionally selected. This defeats the purpose of the all-enabled tool. Description copied from arm Cc: Masahiro Yamada Signed-off-by: Michal Suchanek --- arch/arm64/Kconfig | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index a8ff7cd5f096..f59d391e31a4 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -1549,9 +1549,20 @@ config RANDOMIZE_MODULE_REGION_FULL config CC_HAVE_STACKPROTECTOR_SYSREG def_bool $(cc-option,-mstack-protector-guard=sysreg -mstack-protector-guard-reg=sp_el0 -mstack-protector-guard-offset=0) + config STACKPROTECTOR_PER_TASK - def_bool y + bool "Use a unique stack canary value for each task" depends on STACKPROTECTOR && CC_HAVE_STACKPROTECTOR_SYSREG + default y + help + Due to the fact that GCC uses an ordinary symbol reference from + which to load the value of the stack canary, this value can only + change at reboot time on SMP systems, and all tasks running in the + kernel's address space are forced to use the same canary value for + the entire duration that the system is up. + + Enable this option to switch to a different method that uses a + different canary value for each task. endmenu