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 29D4CC433EF for ; Mon, 18 Oct 2021 14:22:02 +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 E59ED60F25 for ; Mon, 18 Oct 2021 14:22:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E59ED60F25 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=1HNd+oBeddcrESNjJXmw41pgwFqyNg5qgY/JtViMRMY=; b=adeSn+68P2Tbtt 9MBki4RDVtzf65kFZ8wYKTVXQyDTigjDh7QskEeQ6q02GCx4lFKDyWHrKXocWLIyWajzt3KWjqw00 2rBLL3ATgGGNXiE29/PDaavQgYeboeTVly8tKTfik9bjYeyRezzby+P+tpaa7It8QQkZ97FX9b1zG H/eJqqUPw0QI58ZT0zWqcXrYLoB6EL5bDpvd/8BqJrDZg4bMIBZB5O7NtCqX8mg0xokwV075/2dz7 9isUQa0vm5qHMh7vssQUv0swUnJlTkyYcLRHPf6ITqiMmwKTn11f54acclT2iSU1FmuX8Ze3spqBr iSiHXnk9Gvs6fNwJEzxg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mcTV4-00G4C1-1I; Mon, 18 Oct 2021 14:20:26 +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 1mcTRN-00G2mO-TP for linux-arm-kernel@lists.infradead.org; Mon, 18 Oct 2021 14:16:39 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 318AB60F9F; Mon, 18 Oct 2021 14:16:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634566597; bh=w5oIXXckLNTqRaq5jRlVsCI6cCEyZWsLVvGoUPHtdmY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GXWhnCu5vYIicKArC8TpjypuiTuE3ebfqzODuFFBsgZEY1oEbBnLEzFs/Tj27fZ5D aPUeU/Rq60gTCAHya5T7XMxhq0J8OwyJvVoq9ecHXw2x5qdlf1G1H4w1UiC8mjVZlz K7Ug/pEazySOc2rz25iaZlbtSWJKoOccMGwpB0o7SzxUeTf06C5xfuMogOXW+NaunP EwK0w9WRaYTdSwl1cT1yeaLBl1b2hQthhENLY8pUTiEDhCd4py/uO3qPLAcJXke/ol qT+bkwIhQHT/PW9Wt3+XkKC85myv53ZLbqGJLqalprKdHhaDC3lu7qx+fBQD1alBCA GhglE4U18aR7Q== 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 Subject: [PATCH v2 3/7] ARM: memset: clean up unwind annotations Date: Mon, 18 Oct 2021 16:16:11 +0200 Message-Id: <20211018141615.682070-4-ardb@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211018141615.682070-1-ardb@kernel.org> References: <20211018141615.682070-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/pANAwAKAcNPIjmS2Y8kAcsmYgBhbYGmAB44pDxM+fIv6AeCNOrvzBdm0b/8CR2NM7cr 3HsPhAGJAbMEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCYW2BpgAKCRDDTyI5ktmPJEOoDA DD89RQA0n6sDwsH7rl9qjvieNAHgyn9pMPlnxGdF3EULNLW/nSonQ+KfCB1A8IPfj/exvchu7zViZY yhQjS8el0U/xr+6bsTupAQYEFBbE173id+IJUcSPKM+UJ2fDF4L8LDw/0twdYnl5dbgfDPxKQryOud GtWbakD3HW0tw2ThosVBDlrHOQS7dlnRrrlEtKJ4TD1xLHJAV7uKxGefowpAcekBw0vWKaMmvMyG7i zzaYosJRDVDo/anSoY5f3rUQ8zcVFIICYxsOAC7r+ZESgOoc0+XUbATmQxyo12zsadr3hk+LvJ8JFG JGYeWkz3c6SipHqahA6XJnNqhoKRJaOpDCY36b3wBFQPOfoOz3We6/WGABNECJfs9bo+saw521P6Zw f0Zw5OUwTf7/AZgCMV3RGd7lUzePAo6T/CbIgnxQA3YR7pqZ7gJQaOMhk1sNuiA/nAJ0ZLViwlcWwz 0GC7dmRbJXTIcZDINR8vRESL5pqrGMAQl9qtAcOEIfDbI= 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-20211018_071638_050198_3F749710 X-CRM114-Status: GOOD ( 13.67 ) 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