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 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 E5753C433F5 for ; Mon, 22 Nov 2021 09:53:05 +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=1HNd+oBeddcrESNjJXmw41pgwFqyNg5qgY/JtViMRMY=; b=rf591glDejalOZ FjpnQOXHG+icih8mVtEKQYv427VxPtJIQETKN45afZlPs7A0YYZz4zrsYdF82dwVwbUIRCVzaMxOb JofAnrQavhfE/ecrwkdV/0UIkREITPEdHav8wGPzrOm6NtG1CWn7XxdLfa063JBvSfQoxqJ27nUM/ RdR0aHmgMxsXkEbIiGtIcgbHwKgkLKmNxZUy5rDhPp3Baxs/I1URxyz+5o68xFlZFlVwm90r0bA5z nsTMI0S1oYruax+JNeCIkARHWK6pXOGdcIMoZx0EdkjtdcT4aayrLlvfSEuv0AShTb1seefQ9/a27 9/UUNblGMLIRIYmWx62A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mp5yK-00FgpA-Tq; Mon, 22 Nov 2021 09:50:50 +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 1mp5co-00FaPf-7N for linux-arm-kernel@lists.infradead.org; Mon, 22 Nov 2021 09:28:39 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7495660F5B; Mon, 22 Nov 2021 09:28:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637573313; bh=w5oIXXckLNTqRaq5jRlVsCI6cCEyZWsLVvGoUPHtdmY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pOVnNA/jcCecXgQ9DVoKqHRsDJ0vA9UoVP72/y5gPAiFyJrnD4RCRjHXV/UV70qlf Ck83eieHgSK/RBOccIOdOAU5i1Gzke7/ruZ/aA6OEiMz4BnW9XdRCUGDcr8/3k4mWG 7acR3YjdBKAbJ5O0ypqqUav/G4fSp5nKKz+ZC0e2+aKfKWK5VEgqadqoiitzo6qLyP aTMNEoxhd5F3ila698WRrV6UsXH8TuKak1tEilcUO45Vok6jgTLjTIWAL1SyOYGWl+ reMP5VZpOkpnYDYsapV4O5WXV24xM4nIFn7xnBIm9+evXdbZ3IWLKw1tBzKS48uJ59 hZXyzGOkvefDw== From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Cc: Ard Biesheuvel , Russell King , Nicolas Pitre , Arnd Bergmann , Kees Cook , Keith Packard , Linus Walleij , Nick Desaulniers , Tony Lindgren Subject: [PATCH v4 3/7] ARM: memset: clean up unwind annotations Date: Mon, 22 Nov 2021 10:28:12 +0100 Message-Id: <20211122092816.2865873-4-ardb@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211122092816.2865873-1-ardb@kernel.org> References: <20211122092816.2865873-1-ardb@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1788; h=from:subject; bh=w5oIXXckLNTqRaq5jRlVsCI6cCEyZWsLVvGoUPHtdmY=; b=owEB7QES/pANAwAKAcNPIjmS2Y8kAcsmYgBhm2KpAB44pDxM+fIv6AeCNOrvzBdm0b/8CR2NM7cr 3HsPhAGJAbMEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCYZtiqQAKCRDDTyI5ktmPJEN7C/ 9T+4Yl+BmUGIXnmKsJnI5TTrgrtel2BQuCEJ59clXUIpKnRnPz3R6SJYYQqnxQ3i/4qFdBacLF1sGP PUU3tUzHaX5VNBm8B6My81x39s33hc5gOtbW//E0bBgbEHq7fF+pbVDV+camfK/kr0G703bBot9qXr Qvv8zDG22oDsguM8jhgv5EUb4ersLwyi80KyYl2E6heE9dZQ+uB3AsFuTB7k0n/estlGJY1zS2DKXo 7XfONtCjDLj8iHiAJ6IQQwA92fRgAYmFMT4RlaJmloEa4awzfwO5XqH2BCEgsQrcyH/XxIGMVyBu1c gtn6rO9yR4kOeJW1N3AOYbmu7+m2JUh5nDs/telY3I64WfsDITh7SNXFZJvw16M5gI6FFzWZZ5GW7t qaWDPJ4CXxasf8e3JsWQ+Gnd9w9LEcNCfNwNugKlc1mgvEl6oKp0Zr5NTBQ7ZpbElgt+8Hqj+7ehFI B1LfeVq/9FahwFU0kGOYgyWhd7FCVGm6rF2ycnsdORd2U= 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-20211122_012834_346672_ED644E10 X-CRM114-Status: GOOD ( 13.94 ) 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 The memset implementation carves up the code in different sections, each covered with their own unwind info. In this case, it is done in a way similar to how the compiler might do it, to disambiguate between parts where the return address is in LR and the SP is unmodified, and parts where a stack frame is live, and the unwinder needs to know the size of the stack frame and the location of the return address within it. Only the placement of the unwind directives is slightly odd: the stack pushes are placed in the wrong sections, which may confuse the unwinder when attempting to unwind with PC pointing at the stack push in question. So let's fix this up, by reordering the directives and instructions as appropriate. Signed-off-by: Ard Biesheuvel Tested-by: Keith Packard --- arch/arm/lib/memset.S | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/arm/lib/memset.S b/arch/arm/lib/memset.S index 9817cb258c1a..d71ab61430b2 100644 --- a/arch/arm/lib/memset.S +++ b/arch/arm/lib/memset.S @@ -28,16 +28,16 @@ UNWIND( .fnstart ) mov r3, r1 7: cmp r2, #16 blt 4f +UNWIND( .fnend ) #if ! CALGN(1)+0 /* * We need 2 extra registers for this loop - use r8 and the LR */ - stmfd sp!, {r8, lr} -UNWIND( .fnend ) UNWIND( .fnstart ) UNWIND( .save {r8, lr} ) + stmfd sp!, {r8, lr} mov r8, r1 mov lr, r3 @@ -66,10 +66,9 @@ UNWIND( .fnend ) * whole cache lines at once. */ - stmfd sp!, {r4-r8, lr} -UNWIND( .fnend ) UNWIND( .fnstart ) UNWIND( .save {r4-r8, lr} ) + stmfd sp!, {r4-r8, lr} mov r4, r1 mov r5, r3 mov r6, r1 -- 2.30.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel