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 22C7DC433F5 for ; Mon, 15 Nov 2021 11:21:10 +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 DE85F61C32 for ; Mon, 15 Nov 2021 11:21:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org DE85F61C32 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=y8gOrQEck67CbQ q4l8pLFVOL4GU1KlA09qQolkBLRzp2SGtmqVF/gXqAu7SclX0QdL4hxRC3cTdzXrxsC23sR3hrsbY bwco4zOC/OvB+lR3CrPbob8auyLSYkt0CHW0q333jarfu5Vxsw5AxEWFSuuXF0wehu2Gzu1BmA8DQ NYGd0qL+nx5aleRXmIg78H1x14ah2xLD0K4gQ3NGu+k1Im9YsaX6XZ3jTUN6Zie6/1bbWL4egJPRk /wc7UAZB1Y/HXGYQSZy8Jm11z0oUkyCvLTsSVTQgt+5dAHQ5AL7ykaix7NdXkxbRm3eBvjff6XpHV M+QqCWrdIcM73MxlI/1g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mma0s-00FKDs-J3; Mon, 15 Nov 2021 11:19:02 +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 1mma0Q-00FK9R-0y for linux-arm-kernel@lists.infradead.org; Mon, 15 Nov 2021 11:18:35 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id C608C61C15; Mon, 15 Nov 2021 11:18:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1636975113; bh=w5oIXXckLNTqRaq5jRlVsCI6cCEyZWsLVvGoUPHtdmY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LLIJNjOgDYOt6/KsmC9psmQkXg5/ra0OngzLVsqP5GXAVYjR28F2nCal74cKZ9j0a Gk9NCicAnykfDjLpfo5vU2IiaXod7jlDlHH8aTUe/Go2EldjVP5D541rY91yG5aMYO R+CEv9l2YMN9eBntY6ZK2gbL1kdqszIibJaI0Cba1fZk7DS/25mwcj+0ve4ieiUUHM jVcadqSmug9ixBc5P4gdFowDnfp2tx0DK6AeFZwWE9OkGa8axNjxeM5nXBW+bh29Jm 0kUeUSDxOFjeMB4i6wCRN3dlpolPXEWArJKmHMGQ0NdrSJ1eADw8HD9aoVIGAlDYSs tiKZI9zF/fbjQ== 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 v3 3/7] ARM: memset: clean up unwind annotations Date: Mon, 15 Nov 2021 12:18:12 +0100 Message-Id: <20211115111816.3911213-4-ardb@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211115111816.3911213-1-ardb@kernel.org> References: <20211115111816.3911213-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/pANAwAKAcNPIjmS2Y8kAcsmYgBhkkHwAB44pDxM+fIv6AeCNOrvzBdm0b/8CR2NM7cr 3HsPhAGJAbMEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCYZJB8AAKCRDDTyI5ktmPJPhGC/ 90qMTj7IxVyerinExLojWo1+mH0s+qmkUQdkLUuhMACBAi+yT22dmylQYy0aY9MtK1R/LAU+vjWw1V fMsiL/uCuRx/rgNfm7oLl6GIYTMRXy13mg+DAUgtmS4ZB3QMQFNMsaZh8zDXf/Gil59OnSEexJIknO lLOnNvP2lD3DDyzpS64Tbe858p3Cy3RA0t4EosoWboh46LB3p9CYm6orWICyZBa99fUQeKKXWCd8hN hLLVVJvGRcoJzzq+xnsMSuZyoBvD5DljHkVg4MewqoGbftOjAoh77SSTbNYrT3dxADr+hEv/VLuYdT sJFgINjBR7VPOQVQTW/39bGYxhDexZTbjgbxs4MchMd622FyqVZ3a8k5Noi7el72RnHE9pIikc3jD7 KbMZ7aMyuNXxJpOoBb9MzggFsVPjjR2HDrWyBmVjT8Hc1thLhW4vIcpD2D9DnFl4Loae1cuu/N4+CX SztRI2Z6pRQ77L4e2RQanvwKy9jqcPTkHvtB8x/7eXAYI= 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-20211115_031834_114585_77DAC382 X-CRM114-Status: GOOD ( 13.91 ) 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