Message ID | 20221209152048.3517080-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 A5EDEC4332F for <linux-arm-kernel@archiver.kernel.org>; Fri, 9 Dec 2022 15:22:06 +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=X+EWiH5rbDrmXCZr1dqmlsn11PBk05HbwX+axH21n/c=; b=uxHvgd1UFGHaei XQGfHl04APZb4vm+qkARG5DW4sIAww/5llfSm2iQzc8H3cuBwLoN9V3D8kpjJQbd7WxhXxZJbif4i C0sRHjP7EvfcZrLYqUHF3waWvbpPegRAS2x6I5QxzbxxM3enF3DPp5ZAiKl2GtlE+v5lMicR244Ve 87b7igBhWzoCMj3mkYq69kZTTa5i3voDAPIKlqQ2jn/ZjF4ORxAyWKIaD3PvwJfp2npqnvbA0uKzW HWBGh7Wtt3sN+xy6i3kz3JAQr6WerENWvAv+Wc5jLdgiNkEMAU8va6wxhQ4ZzLNqjdvKDIFJzP+0w 1BPEThASF7iWJjYI4sIQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p3fBW-008wEl-8X; Fri, 09 Dec 2022 15:21:10 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1p3fBQ-008wCe-44 for linux-arm-kernel@lists.infradead.org; Fri, 09 Dec 2022 15:21:08 +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 ams.source.kernel.org (Postfix) with ESMTPS id 8949FB8287F; Fri, 9 Dec 2022 15:21:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ABD6FC43396; Fri, 9 Dec 2022 15:20:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1670599261; bh=Mh+IoswhbapuQ7iNCDxmLomZt2cIwbv+py93QYg2OkA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cc33JzR8XVKdslddOrkpbLI7I9A61UGHZdZSUjJteV2j6J/AufnVYkxtD+N+SM3J+ B+ndL0uiRxMA8K8Shkf/sOM8JcdD+QBA0Dwx6PK4rEhzmPwoLZguq4NpUHl4OllSJ2 W6cay0Jo9KS/i6uE1nZgc9xGCOZOJK5T9gNulEp5/Usj2MV1Jk/WIPCKH1qb5VRYPa mPGxJWpAZN8+zS4gfhrh/6QKaZFAEo//Dh55i/C4PipHoTs4ojrZlkyDnRNuj/1Kfw te0sFaZU7NI2UTKHTJJkdN+MJ8D1h4Ybj9Nok3PsmMtvUHBgYZMiWBDwDTukeXMeyl HgeLDeIODszuw== 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 v3 1/4] arm64: assembler: Force error on misuse of .Lframe_local_offset Date: Fri, 9 Dec 2022 16:20:45 +0100 Message-Id: <20221209152048.3517080-2-ardb@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221209152048.3517080-1-ardb@kernel.org> References: <20221209152048.3517080-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=Mh+IoswhbapuQ7iNCDxmLomZt2cIwbv+py93QYg2OkA=; b=owEB7QES/pANAwAKAcNPIjmS2Y8kAcsmYgBjk1JK91wgxn9PdghDRKkY+euZhZphdvjHFnK82jrQ pE4Wo1SJAbMEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCY5NSSgAKCRDDTyI5ktmPJHzuDA C9GIKSSPwOCBsDhtdfmYWvvcLAsrBVziDKqOXKU5v8aGuiclDVx6Kg9wzH3PiHOJ+4Ozh3sU5+Gyqi d2Oxemh2NC4PEzbAmH1WDDoaPJjxmHzuiU0K/+5LuvFHOfQkL+I0rkNfF0Ov+beKKS9OnhS+dHSdoU zVRIbAljI6r0w3YuBTiqQErIhCLcr8RjOH3VC70AKSDYR4DqkhQfbhPOoYCzXvAU1V4ndAZemPy7i9 gwi/xNadb6k9e7dV+rJgjpEXOX8P77PS8LS4d5WmveJguGTCGKyCgOktdmwAZ37b3hcNcbtTq8PXMB Palv7/iz/XjJFVAs25YJckBJ5br5/9pps59nxgXVov8bXElGwBHBfyZpXtRWuM329m92s7PJQpw1+M 8I58+qkiHX453dYfDHK8bcgYAaKpTa4JjMe2nRcif2yuASwdwoNZipbiNzxQHA/3nnGP62zY71PWY7 fi+E91yHgYIfYpKt9TC7KxdWDWSEvTsnF0HFfrsuCy+B4= 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-20221209_072104_320836_5CC95DC8 X-CRM114-Status: GOOD ( 10.72 ) 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 e5957a53be3983ac..1c04701e4fda8458 100644 --- a/arch/arm64/include/asm/assembler.h +++ b/arch/arm64/include/asm/assembler.h @@ -758,6 +758,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(+)