Message ID | 20221129141803.1746898-2-ardb@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org> 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 F3289C4321E for <linux-arm-kernel@archiver.kernel.org>; Tue, 29 Nov 2022 14:19:16 +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-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: 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: List-Owner; bh=yfPqQSp8hkL8sKC99oZMiIbbMSW6zUs0RJEk0+KlpLw=; b=B0KadDUhvPXEVt w6rEG7Ub9EdLJJHyTV8Y5fW0Nj3FcHLm8rDGOwDV+JMPaw9zlHSjWusjdK6z+zri5gR59xohkamx8 AYkXu5dZ0551jjulh4j64Oq60wcclcZDK6V3EiwH0tpvPT+Q/R8i1pZqUBa02jwUr1tByAT7UoIzd ceUWtfuv1pfVmZ1bYWm0DuTyiwszZamLZLuKvw+XWSgyRpQz1PAKZMliAYhkqpeUFmSJDMiin3oMd rm+JWnjWNRkmOExIiJi821JdzEPwHv4kPIPjSoqs6fK8Pbm7K3BbTGxsyKBXBq3dBdPHEC43VeiOD dZllBONFWLYkjVSNnX5A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p01RD-009AHQ-6x; Tue, 29 Nov 2022 14:18:19 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1p01R7-009AEk-Ed for linux-arm-kernel@lists.infradead.org; Tue, 29 Nov 2022 14:18:14 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 052D96175C; Tue, 29 Nov 2022 14:18:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 151AAC433D7; Tue, 29 Nov 2022 14:18:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669731492; bh=yoIOK1L/FcjLo8o+n+d0GVBySgN8By0KnxnZeV4z3Y4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ntau9BLlBVIt35fzuJniGd7d3o6azjLZ8fnIyqXXvZIU11UVu2Sn6/ZAsVDjGEucQ e0oAFWCeqRgL7IDX7YFTPRXiGMfEKxZ6MXd+H3MnQSqG2TbV4ep2F+yMU2wkyMdvls j5/60I65PMFcBcRLSzJ2EFo8DRwi6oNR8SmWQOnf9qAv7cXaXBpvKs/TQtfm1FRyJ8 YB1T9xANgToLYveIH/X9Hgv7YqyFCNDtYyKFn/OtgDEdmF9tOiltcwvUu96eeDwO8z r90/G6ityDhNBOz7OBMQkVcbgEkcUQqfQCy8k4++fOGBuGPvw8MQg6k0S1xU8B7IeW rWU89usKlGVZA== From: Ard Biesheuvel <ardb@kernel.org> To: linux-arm-kernel@lists.infradead.org Cc: Ard Biesheuvel <ardb@kernel.org>, Marc Zyngier <maz@kernel.org>, Will Deacon <will@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Kees Cook <keescook@chromium.org>, Catalin Marinas <catalin.marinas@arm.com>, Mark Brown <broonie@kernel.org> Subject: [PATCH 1/4] arm64: assembler: Force error on misuse of .Lframe_local_offset Date: Tue, 29 Nov 2022 15:18:00 +0100 Message-Id: <20221129141803.1746898-2-ardb@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221129141803.1746898-1-ardb@kernel.org> References: <20221129141803.1746898-1-ardb@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1032; i=ardb@kernel.org; h=from:subject; bh=yoIOK1L/FcjLo8o+n+d0GVBySgN8By0KnxnZeV4z3Y4=; b=owEB7QES/pANAwAKAcNPIjmS2Y8kAcsmYgBjhhSVqdI0xiGpsx73If8ITz6dgm1Px74nNCABgCOK e17LKXqJAbMEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCY4YUlQAKCRDDTyI5ktmPJHZuC/ 48wLsfGx1i2DQnNv1Lk0LwZN3YZFGYUDq4c8H9CD88N0aRCZzZ2PBMOX4gjCoyGx7unrc+hziJ3ukZ DVcWoMiKoZRLa2guCa1lWjHJ/kSbfkd2rr5WcikV99UVn5V3Y0aJwnIIUqnglQxbY39elRVEW4Y7mf g3sWbMKAUTfBWRvE9lEl4W+LR27roerpTjJwKPzxvR4PLVpSOgk2oni+bialebnvJKAjH4hVLCysBg Pkw/bZYO+jgIuVkJ0RRrPJP7YrVOjeU1IDiAYODm+4Meut6+2Scygxyfgb0zAB5sWqpLK0a5blMcss r9aaHX503q5M1A8U3YM+GYehe3TnTZdY/0CsLhtICs3P5vNDD3RuszAABLFixds5Up4AxnPhlLN7KT Wukdq3AnwoE7lNtgE+snz2QM8Neyu91ugLiYs4mLynUpOZDfL2HbhZiRLmX+61wDDP2ZOQDhSGZm/z 63oqKl5ofGfR/SSDS1qyCTzDVC7mKjCXvkI+EGnPDor1c= 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-20221129_061813_582178_B0FA4A8B X-CRM114-Status: GOOD ( 11.30 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
arm64: Add return address protection to asm code
|
expand
|
diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/assembler.h index 30eee6473cf0c0ea..3d1714a7eb6411ba 100644 --- a/arch/arm64/include/asm/assembler.h +++ b/arch/arm64/include/asm/assembler.h @@ -752,6 +752,7 @@ alternative_endif .endif ldp x29, x30, [sp], #.Lframe_local_offset + .Lframe_extra .set .Lframe_regcount, -1 + .set .Lframe_local_offset, frame_local_offset_error .endif .endm
The frame_push macro sets a local symbol .Lframe_local_offset to the offset where the local variable area resides in the stack frame. However, while we take care not to nest frame_push and frame_pop sequences, .Lframe_local_offset retains its most recent value, allowing it to be referenced erroneously from outside a frame_push/frame_pop pair. So set it to an obviously wrong value that is guaranteed to trigger a link error in frame_pop. Signed-off-by: Ard Biesheuvel <ardb@kernel.org> --- arch/arm64/include/asm/assembler.h | 1 + 1 file changed, 1 insertion(+)