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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32EFFC433F5 for ; Tue, 26 Oct 2021 08:30:10 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id E75E760E96 for ; Tue, 26 Oct 2021 08:30:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E75E760E96 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=6gIgKdFhk9YGSQ8s/zztQwetOnT0kQcpCGVOIDeb9Sc=; b=3wJHUH5WbTSbMQ 8RmQjl2swUafsVo/Fczngbiy4HnSLZ6JNvOEqpew1dA87JEdWJVY1ellEDLQac7La5bXJvgXIeLOA ijiC4imzmlQtIIdWKYX5R+Cf9GvGUYSLmVsUHV69sOnIp9/4i4Fk2SVnePlBtlJzh5RyX28m79ICC +wU5KkNyu4ohugXKn1crqH3Am91Z2triwTk1tnc7mEAn246ERoMQ1Toj9l8zmR0rWcI4nflZnaqSd zVGTcHvKA8ufb6Lhlpw20pmIvHisOH1lJdu5Xrz9lO1bfkEt6mQa6EeKqc6VM2/2OHWu8U6AO9AWp tkeARs1l/WC0iIaep8nQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mfHol-0011tf-BO; Tue, 26 Oct 2021 08:28:23 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mfHoi-0011tJ-5k for linux-arm-kernel@lists.infradead.org; Tue, 26 Oct 2021 08:28:21 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 18F7260FC2; Tue, 26 Oct 2021 08:28:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1635236899; bh=ZEQ+RvJ/6fnn6ToVzHkXKibmYwtpZUsMH0klrgu89bE=; h=From:To:Cc:Subject:Date:From; b=bRks0vYYs1qYJbgWUrJRjCSHVtvwURlZaz1P5vvykRyj/bYXE88pt1yH/RBNsyBSd Jnk5dl23q8VH9G/YYaS9f3hqoAjr2ZOYBL8kIrudQyZ11WYJGqmJ4Gt5amWxcsteXj sga/Cp0MWOdgysteWegw8U9U58pO+JcjqBLWGTkrAhdUi1cDfFexR3xSMJbNBzBNTf Y6Oqr3TYJLUzvuDVCWufLmypQ2fUEaai36gsUijm29sabwzUiviYFfv013QMAFsH43 6ODZSARsXRaKukOcw+XCZDA3yob6iSLqCv0G2YB2VufBRZAtSCXtEjY0zRgLMv3Njc kbQv3aigWc5qg== From: Ard Biesheuvel To: linux@armlinux.org.uk Cc: linus.walleij@linaro.org, arnd@arndb.de, keescook@chromium.org, linux-arm-kernel@lists.infradead.org, Ard Biesheuvel Subject: [PATCH] ARM: decompressor: disable stack protector Date: Tue, 26 Oct 2021 10:27:52 +0200 Message-Id: <20211026082752.3519140-1-ardb@kernel.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2405; h=from:subject; bh=ZEQ+RvJ/6fnn6ToVzHkXKibmYwtpZUsMH0klrgu89bE=; b=owEB7QES/pANAwAKAcNPIjmS2Y8kAcsmYgBhd7wHugKWndCq4YyJlBGUhm+3bKemXF7I9lLJC0Ue +olIOpqJAbMEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCYXe8BwAKCRDDTyI5ktmPJAX+DA CyiCVBCv4r8f1OhgUHbiGZZHKu986w4tuFUXye+QJZoLa7uw2fA4Ppp5PKzoRUrRUmNrzpuH8f9xTk IR2vV35bue5GAIGXsPEC1Z6eWk4wNxbHO2cToKNRFl0NCD0n94SWTn/8/8oWDolmNf5gqEfMT8L43J +V+16JRZMxzktMcVAREXCPD8d3zsTrKv5nXwLpE+6oQI8YI1bXRdyCg1c7kyZ7/qDMeVZJpaa17ToS ndFoo0QmbJJo9UxE2Md5lkSdN6xxy8Wo6W7rpv+zca4+IVaaUvPY1BXi/uDXUmkcyvLQcryyvd8SHV /9ndUXmIXJS9Pmg7z2/1AOf9vKHSt8X85qNT4olup6KRb9UYPKhett5DD+rVD7gvLxw87uUoxDYd4v WirKbosP3+qSquDLEMZfYmI6ac4ank+n5hyck4kbV1idJXTdE91ef8URs4zNCF15GNQmT4QudCEuPo wXPnsXUoYjljAvvZLvWlxx5yX7W2muxJIEN9AwSXmst6s= X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211026_012820_282174_A20CB89B X-CRM114-Status: GOOD ( 10.72 ) 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Enabling the stack protector in the decompressor is of dubious value, given that it uses a fixed value for the canary, cannot print any output unless CONFIG_DEBUG_LL is enabled (which relies on board specific build time settings), and is already disabled for a good chunk of the code (libfdt). So let's just disable it in the decompressor. This will make it easier in the future to manage the command line options that would need to be removed again in this context for the TLS register based stack protector. Signed-off-by: Ard Biesheuvel --- arch/arm/boot/compressed/Makefile | 6 +----- arch/arm/boot/compressed/misc.c | 7 ------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile index 91265e7ff672..e2bd084b1cdf 100644 --- a/arch/arm/boot/compressed/Makefile +++ b/arch/arm/boot/compressed/Makefile @@ -93,11 +93,6 @@ ifeq ($(CONFIG_USE_OF),y) OBJS += $(libfdt_objs) fdt_check_mem_start.o endif -# -fstack-protector-strong triggers protection checks in this code, -# but it is being used too early to link to meaningful stack_chk logic. -$(foreach o, $(libfdt_objs) atags_to_fdt.o fdt_check_mem_start.o, \ - $(eval CFLAGS_$(o) := -I $(srctree)/scripts/dtc/libfdt -fno-stack-protector)) - targets := vmlinux vmlinux.lds piggy_data piggy.o \ lib1funcs.o ashldi3.o bswapsdi2.o \ head.o $(OBJS) @@ -107,6 +102,7 @@ clean-files += lib1funcs.S ashldi3.S bswapsdi2.S hyp-stub.S KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING ccflags-y := -fpic $(call cc-option,-mno-single-pic-base,) -fno-builtin \ + -I$(srctree)/scripts/dtc/libfdt -fno-stack-protector \ -I$(obj) $(DISABLE_ARM_SSP_PER_TASK_PLUGIN) ccflags-remove-$(CONFIG_FUNCTION_TRACER) += -pg asflags-y := -DZIMAGE diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c index e1e9a5dde853..c3c66ff2d696 100644 --- a/arch/arm/boot/compressed/misc.c +++ b/arch/arm/boot/compressed/misc.c @@ -128,13 +128,6 @@ asmlinkage void __div0(void) error("Attempting division by 0!"); } -const unsigned long __stack_chk_guard = 0x000a0dff; - -void __stack_chk_fail(void) -{ - error("stack-protector: Kernel stack is corrupted\n"); -} - extern int do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x)); -- 2.30.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel