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 64DA9C433EF for ; Fri, 8 Oct 2021 07:44:05 +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 3394361027 for ; Fri, 8 Oct 2021 07:44:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3394361027 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: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=nHgibTRxhRsT6mFzImaztxrxp/k+pA7uOEh9MD7ICMs=; b=10ffzBBR452R8h Yg4ZZkBneDgQmCFl7uMXviryS4eQ94YenQaYEgC65TT+mREy+ocX0/R7jsO96K6oKJvG29Yfn1tO1 rH6E6siSvA5k0Qof9FHUy7gC1JfSmKSogXPH0uMnOl0MyhbbL6HVkpgn3wJSbn4pAVxjBw+U+UC2p QEZxUtzM7T66XaeoI5OtX50mnljut9AQwVMbenjAdEsYF/JilYpb728c3Bmy5P+yYz6M0ILBA7WN9 n+9nxDa/iPGjsXsJpgOdCtksUBAyMX6RpONSbSwSunIoHUeiDKumRKc0QCgm4lRfep4w0KKds3RYX /iVv2uB6yRzQTkfIb4Iw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mYkWK-001tOu-1X; Fri, 08 Oct 2021 07:42:20 +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 1mYkVq-001tLq-Pz for linux-arm-kernel@lists.infradead.org; Fri, 08 Oct 2021 07:41:52 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 97EC360E9C; Fri, 8 Oct 2021 07:41:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1633678910; bh=ELR07nPh+Q4kT8e3MwavV/0RnxMLWBck40WXUC+M2Wo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U1hF2SoFbQpeBsUgNs9MvyQuQFAIL3RZlfbdBL2mzlDmNRrqxZvszF5u/T6JCtFXQ UIemSwDvh1tAc5LPd+iZfJrKu6dE0E1r4E2UOS+1jI/efRqY/eGjvymVm/V1Nyahqe sqz6+k96y6bBHRPTv6bywzxDGffVyguEiTGJofUvAZoriZb1bZc1eMqZ3Cb1/TzOBe GPmesBNi7g7cgKojH7PahBtH5EwlXIRDECgWtdJgp0ydPGGwb1mhv3Q76USj6pIoMx 6Rk1LJiIUrPT6A8o3FmJAnvUAJcuejEZgAse7CrRlXdhsgQ2ek6QM8RvRNdyZt1dhp s2abUIVDSP8rA== From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, linux@armlinux.org.uk Cc: Ard Biesheuvel , Nicolas Pitre , Arnd Bergmann , Kees Cook , Keith Packard , Linus Walleij Subject: [PATCH 3/5] ARM: memset: clean up unwind annotations Date: Fri, 8 Oct 2021 09:41:25 +0200 Message-Id: <20211008074127.435364-4-ardb@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211008074127.435364-1-ardb@kernel.org> References: <20211008074127.435364-1-ardb@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1740; h=from:subject; bh=ELR07nPh+Q4kT8e3MwavV/0RnxMLWBck40WXUC+M2Wo=; b=owEB7QES/pANAwAKAcNPIjmS2Y8kAcsmYgBhX/YeqEaHq02xoc1gJ9efr8EKnG8SektS3YfZJeGB OeDeYSCJAbMEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCYV/2HgAKCRDDTyI5ktmPJDVgC/ 9MLUWCn49STG8tmxTz+7wxKoQZsRcGAyMMCTuQ+85HDFpY7xA9BaRyCNY/+RO2OdAJhES4ANNzXW6G ITHEeI1uf96UMD1p/6Fx6wu1cQQrg+tDJnxMgblph3ia3FExDwwqiqU61WKBAy6/e4h+LCUmQrjO7x a0m31G8t/WiftyJa9SIM1/xQvVCaciccR+S0A0zmP46w7FYjqigIyaA/Ni78PU2h8WrTaef4qrCDJI UPeAr2IhsZvZS4RdBxdsjfib5MA+nANprCyfyzMNrxWRqFGcYNR2TpvVUqW/ALzmbeZcvyZJVzsljL 0Y5XNbLEe/beqPgCgH1UW0U7wTqTU+5pTKwjhmmGki5PDQ0hO8FaPQ8j1Z8nzRxdJo/NtiuCjPSB0Y wIeA9KHDzymZq5dpWckTLY8wetGba3EqBRNv1Rit5buVDi3FkTJ7eDCmYjSYIccwQJm6xAhDaOn7Hf YPtSVwXZXIRRKz4vjkqfCq9vSBU/zLE8fVhLwSj1DV2Nk= 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-20211008_004150_885370_EC70FE27 X-CRM114-Status: GOOD ( 13.29 ) 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 --- 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