# HG changeset patch # User Paul Boddie # Date 1709421365 -3600 # Node ID d0929d9fcca9e4341eeb284b3d03e00c0aae13f1 # Parent e96c7cbee506769de204b23a97b72a70c6940b68 Introduced cache synchronisation for mapped regions. Without this, executable code may not be read properly on real hardware after a page fault, resulting in erroneous instruction execution and seemingly nonsensical instruction results. diff -r e96c7cbee506 -r d0929d9fcca9 libmem/lib/src/ipc.cc --- a/libmem/lib/src/ipc.cc Sun Mar 03 00:12:41 2024 +0100 +++ b/libmem/lib/src/ipc.cc Sun Mar 03 00:16:05 2024 +0100 @@ -1,7 +1,7 @@ /* * Interprocess communication utilities. * - * Copyright (C) 2021, 2022 Paul Boddie + * Copyright (C) 2021, 2022, 2024 Paul Boddie * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -21,6 +21,7 @@ #include #include +#include #include #include @@ -55,6 +56,12 @@ if (!send_flexpage.order) return -L4_ERANGE; + /* Make sure that the instruction cache is updated if the content is going + to be executed. */ + + l4_cache_coherent(send_flexpage.base_addr, + send_flexpage.base_addr + (1UL << send_flexpage.order)); + region->fpage = ipc_get_fpage(&send_flexpage); region->snd_base = hot_spot;