OSDN Git Service

proc: fix test for "vsyscall=xonly" boot option
authorAlexey Dobriyan <adobriyan@gmail.com>
Tue, 12 Jul 2022 14:51:45 +0000 (17:51 +0300)
committerakpm <akpm@linux-foundation.org>
Mon, 18 Jul 2022 00:31:43 +0000 (17:31 -0700)
commit3adb2d87238dea5e05bab747238bb47306b9cb56
tree2186b0a88121c1e8653c06e7fefd627a76ecde54
parentd919a1e79bac890421537cf02ae773007bf55e6b
proc: fix test for "vsyscall=xonly" boot option

Booting with vsyscall=xonly results in the following vsyscall VMA:

ffffffffff600000-ffffffffff601000 --xp ... [vsyscall]

Test does read from fixed vsyscall address to determine if kernel
supports vsyscall page but it doesn't work because, well, vsyscall
page is execute only.

Fix test by trying to execute from the first byte of the page which
contains gettimeofday() stub. This should work because vsyscall
entry points have stable addresses by design.

Alexey, avoiding parsing .config, /proc/config.gz and
/proc/cmdline at all costs.

Link: https://lkml.kernel.org/r/Ys2KgeiEMboU8Ytu@localhost.localdomain
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Shuah Khan <skhan@linuxfoundation.org>
Cc: <dylanbhatch@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
tools/testing/selftests/proc/proc-pid-vm.c