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 2816DC48BC3 for ; Tue, 20 Feb 2024 15:32:08 +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:Message-ID:In-Reply-To: Date:From:Cc:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Owner; bh=TtM5jN6zihvyzhw43UOYsM/7rg/tQj4DF9lwcBI3lRA=; b=sVd4PfPPQPCf9G 7Ta4EoXy43yeRWlkqwdbUw4rHOCIXO0j4R0otldTPyo+dLEo3yvePUvOZAZpwsOVpSnmpdcuPGbe4 Gs0gdVqKHrVzJOrLGetG+0SRHxPUQvryCfdiSVrGPJ5wz5l2a3HeibArEHK6528l1pxd7MZk0Xi74 rNox7I7jXlPpcPWbZhb5SYHmKGCBKamK6W9Xo6UzwiMjRFI6OklAw6KonQ/Ji4Z+mMESbVRmTwV6j l+PFQfOTwIZ2gwj/PGPuH9e3DkWWmQvXbI/xg8BjGi3m3xDfnvq+gH7PB+6ovt5W/SqfNTi7HvRLP HnjtlMBQsp1Ikj9mFJRA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcS68-0000000FGv7-1VoE; Tue, 20 Feb 2024 15:31:56 +0000 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcS64-0000000FGtq-49wj for linux-arm-kernel@lists.infradead.org; Tue, 20 Feb 2024 15:31:54 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 4CCB4CE1A24; Tue, 20 Feb 2024 15:31:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1BC03C433F1; Tue, 20 Feb 2024 15:31:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1708443110; bh=EmyGNaXj58eQuR9iygjRcB0V+XGXLBM/ip9vX1lQA74=; h=Subject:To:Cc:From:Date:In-Reply-To:From; b=Ph9ovlLZ7EYAnCi6ZcbSA/I8ook3VhcfVCxGqwIzc3Guf65ODuUWZ0dY8Q6EiPaQv KEfORsjmeGWRnizgWFlR78qazzKxqTYbqK2EVuv/yZcaERHmevI8enSgKwMqgcebA4 IzFe9mSpzb8/ueZykWY3LMsmphtwfqeVRs0dpFkY= Subject: Patch "Revert "arm64: Stash shadow stack pointer in the task struct on interrupt"" has been added to the 5.10-stable tree To: ardb@kernel.org,catalin.marinas@arm.com,gregkh@linuxfoundation.org,keescook@chromium.org,liaochang1@huawei.com,linux-arm-kernel@lists.infradead.org,mark.rutland@arm.com,will@kernel.org,xiangyang3@huawei.com,xiujianfeng@huawei.com Cc: From: Date: Tue, 20 Feb 2024 16:31:47 +0100 In-Reply-To: <20240219132153.378265-1-xiangyang3@huawei.com> Message-ID: <2024022047-democrat-persuader-ef91@gregkh> MIME-Version: 1.0 X-stable: commit X-Patchwork-Hint: ignore X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240220_073153_409858_A5656111 X-CRM114-Status: GOOD ( 14.73 ) 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 This is a note to let you know that I've just added the patch titled Revert "arm64: Stash shadow stack pointer in the task struct on interrupt" to the 5.10-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: revert-arm64-stash-shadow-stack-pointer-in-the-task-struct-on-interrupt.patch and it can be found in the queue-5.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >From xiangyang3@huawei.com Tue Feb 20 16:30:54 2024 From: Xiang Yang Date: Mon, 19 Feb 2024 21:21:53 +0800 Subject: Revert "arm64: Stash shadow stack pointer in the task struct on interrupt" To: , , , Cc: , , , , , , Message-ID: <20240219132153.378265-1-xiangyang3@huawei.com> This reverts commit 3f225f29c69c13ce1cbdb1d607a42efeef080056 which is commit 59b37fe52f49955791a460752c37145f1afdcad1 upstream. The shadow call stack for irq now is stored in current task's thread info in irq_stack_entry. There is a possibility that we have some soft irqs pending at the end of hard irq, and when we process softirq with the irq enabled, irq_stack_entry will enter again and overwrite the shadow call stack whitch stored in current task's thread info, leading to the incorrect shadow call stack restoration for the first entry of the hard IRQ, then the system end up with a panic. task A | task A -------------------------------------+------------------------------------ el1_irq //irq1 enter | irq_handler //save scs_sp1 | gic_handle_irq | irq_exit | __do_softirq | | el1_irq //irq2 enter | irq_handler //save scs_sp2 | //overwrite scs_sp1 | ... | irq_stack_exit //restore scs_sp2 irq_stack_exit //restore wrong | //scs_sp2 | So revert this commit to fix it. Fixes: 3f225f29c69c ("arm64: Stash shadow stack pointer in the task struct on interrupt") Signed-off-by: Xiang Yang Acked-by: Ard Biesheuvel Signed-off-by: Greg Kroah-Hartman --- arch/arm64/kernel/entry.S | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -431,7 +431,9 @@ SYM_CODE_END(__swpan_exit_el0) .macro irq_stack_entry mov x19, sp // preserve the original sp - scs_save tsk // preserve the original shadow stack +#ifdef CONFIG_SHADOW_CALL_STACK + mov x24, scs_sp // preserve the original shadow stack +#endif /* * Compare sp with the base of the task stack. @@ -465,7 +467,9 @@ SYM_CODE_END(__swpan_exit_el0) */ .macro irq_stack_exit mov sp, x19 - scs_load_current +#ifdef CONFIG_SHADOW_CALL_STACK + mov scs_sp, x24 +#endif .endm /* GPRs used by entry code */ Patches currently in stable-queue which might be from xiangyang3@huawei.com are queue-5.10/revert-arm64-stash-shadow-stack-pointer-in-the-task-struct-on-interrupt.patch _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel