userspace: fix x86 issue with adding partitions

On x86, if a supervisor thread belonging to a memory domain
adds a new partition to that domain, subsequent context switches
to another thread in the same domain, or dropping itself to user
mode, does not have the correct setup in the page tables.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
Andrew Boie 2019-03-01 15:58:14 -08:00 committed by Anas Nashif
commit 6dc3fd8e50
5 changed files with 79 additions and 33 deletions

View file

@ -178,6 +178,13 @@ void k_mem_domain_add_partition(struct k_mem_domain *domain,
domain->num_partitions++;
/* Handle architecture-specific remove
* only if it is the current thread.
*/
if (_current->mem_domain_info.mem_domain == domain) {
_arch_mem_domain_partition_add(domain, p_idx);
}
k_spin_unlock(&lock, key);
}