Skip to content

Commit 7cd6750

Browse files
puranjaymohanAlexei Starovoitov
authored andcommitted
selftests/bpf: Test PROBE_MEM of VSYSCALL_ADDR on x86-64
The vsyscall is a legacy API for fast execution of system calls. It maps a page at address VSYSCALL_ADDR into the userspace program. This address is in the top 10MB of the address space: ffffffffff600000 - ffffffffff600fff | 4 kB | legacy vsyscall ABI The last commit fixes the x86-64 BPF JIT to skip accessing addresses in this memory region. Add this address to bpf_testmod_return_ptr() so we can make sure that it is fixed. After this change and without the previous commit, subprogs_extable selftest will crash the kernel. Signed-off-by: Puranjay Mohan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent b599d7d commit 7cd6750

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,9 @@ __weak noinline struct file *bpf_testmod_return_ptr(int arg)
205205
case 5: return (void *)~(1ull << 30); /* trigger extable */
206206
case 6: return &f; /* valid addr */
207207
case 7: return (void *)((long)&f | 1); /* kernel tricks */
208+
#ifdef CONFIG_X86_64
209+
case 8: return (void *)VSYSCALL_ADDR; /* vsyscall page address */
210+
#endif
208211
default: return NULL;
209212
}
210213
}

0 commit comments

Comments
 (0)