Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Issue 8605003: Add logic for patching calls to the x86-64 vsyscall page (Closed)

Created:
9 years, 1 month ago by Mark Seaborn
Modified:
9 years, 1 month ago
Reviewers:
Markus (顧孟勤)
CC:
chromium-reviews
Visibility:
Public.

Description

Add logic for patching calls to the x86-64 vsyscall page This is necessary on Linux 3.1 because the vsyscalls now make real syscalls to the kernel, rather than just reading memory as they usually did before, which means they fail in seccomp mode. Although the vsyscall page is deprecated, glibc still contains some calls to it. We detect and patch the instruction sequence that matters. (We do this because, unfortunately, the kernel does not let us change the permissions on the vsyscall page to patch it.) glibc still contains a code path that could call vgettimeofday via a different instruction sequence, which is much harder to patch, and we don't try to. libc.so has code to store vgettimeofday's address (0xffffffffff600000) in TLS, but in practice this code path is not used when the vdso is present. To apply the patch we replace the instructions with a syscall, which later gets re-patched to be a jump. BUG=http://code.google.com/p/seccompsandbox/issues/detail?id=17 TEST=test_patching_vsyscall_* on any Linux version, plus test_time and test_sched_getcpu on Linux 3.1 Committed: http://code.google.com/p/seccompsandbox/source/detail?r=178

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+174 lines, -1 line) Patch
M library.cc View 3 chunks +55 lines, -1 line 0 comments Download
M tests/test_patching.cc View 2 chunks +81 lines, -0 lines 0 comments Download
M tests/test_patching_input.S View 1 chunk +38 lines, -0 lines 0 comments Download

Messages

Total messages: 2 (0 generated)
Mark Seaborn
9 years, 1 month ago (2011-11-19 02:35:29 UTC) #1
Markus (顧孟勤)
9 years, 1 month ago (2011-11-19 02:41:18 UTC) #2
lgtm

Powered by Google App Engine
This is Rietveld 408576698