mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-15 18:34:47 +08:00
6039ca2549
The pkey test code keeps a "shadow" of the pkey register around. This
ensures that any bugs which might write to the register can be caught more
quickly.
Generally, userspace has a good idea when the kernel is going to write to
the register. For instance, alloc_pkey() is passed a permission mask.
The caller of alloc_pkey() can update the shadow based on the return value
and the mask.
But, the kernel can also modify the pkey register in a more sneaky way.
For mprotect(PROT_EXEC) mappings, the kernel will allocate a pkey and
write the pkey register to create an execute-only mapping. The kernel
never tells userspace what key it uses for this.
This can cause the test to fail with messages like:
protection_keys_64.2: pkey-helpers.h:132: _read_pkey_reg: Assertion `pkey_reg == shadow_pkey_reg' failed.
because the shadow was not updated with the new kernel-set value.
Forcibly update the shadow value immediately after an mprotect().
Link: https://lkml.kernel.org/r/20210611164200.EF76AB73@viggo.jf.intel.com
Fixes:
|
||
---|---|---|
.. | ||
.gitignore | ||
charge_reserved_hugetlb.sh | ||
check_config.sh | ||
compaction_test.c | ||
config | ||
gup_test.c | ||
hmm-tests.c | ||
hugepage-mmap.c | ||
hugepage-shm.c | ||
hugetlb_reparenting_test.sh | ||
khugepaged.c | ||
madv_populate.c | ||
Makefile | ||
map_fixed_noreplace.c | ||
map_hugetlb.c | ||
map_populate.c | ||
mlock2-tests.c | ||
mlock2.h | ||
mlock-random-test.c | ||
mremap_dontunmap.c | ||
mremap_test.c | ||
on-fault-limit.c | ||
pkey-helpers.h | ||
pkey-powerpc.h | ||
pkey-x86.h | ||
protection_keys.c | ||
run_vmtests.sh | ||
split_huge_page_test.c | ||
test_hmm.sh | ||
test_vmalloc.sh | ||
thuge-gen.c | ||
transhuge-stress.c | ||
userfaultfd.c | ||
va_128TBswitch.c | ||
virtual_address_range.c | ||
write_hugetlb_memory.sh | ||
write_to_hugetlbfs.c |