[RFC PATCH v2 04/45] arm64: hibernate: Restore DAIF state on error
Jinjie Ruan
ruanjinjie at huawei.com
Mon Jul 27 18:16:48 PDT 2026
在 2026/7/28 0:34, Vladimir Murzin 写道:
> Sashiko AI has reported that if swsusp_mte_save_tags() for some reason
> fails we return from swsusp_arch_suspend() with DAIF being masked -
> that is not what we'd expect. Restore the saved DAIF state before
> returning from the error path.
>
> Fixes: ee11f332af96 ("arm64: mte: Save tags when hibernating")
> Signed-off-by: Vladimir Murzin <vladimir.murzin at arm.com>
> ---
> arch/arm64/kernel/hibernate.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/kernel/hibernate.c b/arch/arm64/kernel/hibernate.c
> index 1eb1c1074c5b..7bf117427777 100644
> --- a/arch/arm64/kernel/hibernate.c
> +++ b/arch/arm64/kernel/hibernate.c
> @@ -348,8 +348,10 @@ int swsusp_arch_suspend(void)
> crash_prepare_suspend();
>
> ret = swsusp_mte_save_tags();
> - if (ret)
> + if (ret) {
> + local_daif_restore(flags);
> return ret;
> + }
We can use a label to reuse the exit path, otherwise LGTM
Reviewed-by: Jinjie Ruan <ruanjinjie at huawei.com>
--- a/arch/arm64/kernel/hibernate.c
+++ b/arch/arm64/kernel/hibernate.c
@@ -349,7 +349,7 @@ int swsusp_arch_suspend(void)
ret = swsusp_mte_save_tags();
if (ret)
- return ret;
+ goto restore_daif;
sleep_cpu = smp_processor_id();
ret = swsusp_save();
@@ -391,6 +391,7 @@ int swsusp_arch_suspend(void)
spectre_v4_enable_mitigation(NULL);
}
+restore_daif:
local_daif_restore(flags);
return ret;
>
> sleep_cpu = smp_processor_id();
> ret = swsusp_save();
More information about the linux-arm-kernel
mailing list