Scenario:
- Supervisor thread X modifies the memory domain that it belongs to with k_mem_domain_add_partition(), to add access to region A
- Context switches to User thread Y which belongs to the same domain as thread X
- Thread Y attempts to access region A and faults
Unlike k_mem_domain_remove_partition(), which invokes _arch_mem_domain_partition_remove() if the caller is in the same domain being worked on, k_mem_domain_add_partition() does not call into arch code at all when partitions are added, and there isn't an arch-level API for this even if we wanted to.
x86 doesn't touch the page tables on context switch if the incoming and outgoing threads are in the same memory domain.
This does not seem to be a problem on ARM or ARC.