Re: [PATCH] ARM: hibernate: flush TLB after switching to idmap

From: Linus Walleij

Date: Wed Sep 30 2026 - 06:52:44 EST


On Wed, Sep 30, 2026 at 8:14 AM Chongchong Ding
<chongchong.ding@xxxxxxxxxxx> wrote:

> On 32-bit ARM, hibernate switches to the identity mapping to copy pages.
> The idmap keeps an early RW snapshot of kernel mappings, so
> STRICT_KERNEL_RWX text/rodata can be written during restore.
>
> cpu_switch_mm() does not drop the global TLB entries from swapper.
> copy_page() can therefore still hit the old RO translations and fail to
> restore kernel RO sections.
>
> Flush the local BTB and TLB after installing the idmap, matching
> setup_mm_for_reboot() and the cpu_suspend() resume path.
>
> Signed-off-by: Chongchong Ding <chongchong.ding@xxxxxxxxxxx>

Ooops yes this does look like a real bug, albeit rarely exercised.
Reviewed-by: Linus Walleij <linusw@xxxxxxxxxx>

Please put this into Russell's patch tracker:
https://www.arm.linux.org.uk/developer/patches/

Yours,
Linus Walleij