2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-22 01:51:51 +00:00

restore: flush caches during restore

See the previous commit for rationale and architecture-specific details.

[ avagin: tweak code comment ]

Signed-off-by: Ignacio Moreno Gonzalez <Ignacio.MorenoGonzalez@kuka.com>
Signed-off-by: Andrei Vagin <avagin@gmail.com>
This commit is contained in:
Ignacio Moreno Gonzalez 2025-07-16 16:38:13 +02:00 committed by Andrei Vagin
parent 04012eac7f
commit 6f0e4e848b

View File

@ -2569,6 +2569,17 @@ static int remap_restorer_blob(void *addr)
restorer_setup_c_header_desc(&pbd, true);
compel_relocs_apply(addr, addr, &pbd);
/*
* Ensure the infected thread sees the updated code.
*
* On architectures like ARM64, the Data Cache (D-cache) and
* Instruction Cache (I-cache) are not automatically coherent.
* Modifications land in the D-cache, so we must flush (clean) the
* D-cache to push changes to RAM to ensure the CPU fetches the updated
* instructions.
*/
__builtin___clear_cache(addr, addr + pbd.hdr.bsize);
return 0;
}