Skip to content

Commit

Permalink
workaround sandbox_linux_unittests test failure
Browse files Browse the repository at this point in the history
clock_gettime() doesn't call syscall SYS_clock_gettime when VDSO is enabled.
some unittests would fail.

This is happening on aarch64 kernel w/ CL
"arm64: Add support for CLOCK_MONOTONIC_RAW in clock_gettime() vDSO".

enforce to use syscall to SYS_clock_gettime to get around the failure

Bug: internal b/110172084
Test: local test
Cq-Include-Trybots: master.tryserver.chromium.android:android_compile_x64_dbg;master.tryserver.chromium.android:android_compile_x86_dbg
Change-Id: Idc824403faaba7b8504bf89ba10f0ba50422c3f5
Reviewed-on: https://chromium-review.googlesource.com/1187586
Commit-Queue: Yi Fan <yfa@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#585885}
  • Loading branch information
Yi Fan authored and Commit Bot committed Aug 24, 2018
1 parent 6c26f33 commit 7499662
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ BPF_DEATH_TEST_C(BaselinePolicy,
DEATH_SEGV_MESSAGE(sandbox::GetErrorMessageContentForTests()),
BaselinePolicy) {
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
syscall(SYS_clock_gettime, CLOCK_MONOTONIC_RAW, &ts);
}

#if !defined(GRND_RANDOM)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ BPF_DEATH_TEST_C(ParameterRestrictions,
DEATH_SEGV_MESSAGE(sandbox::GetErrorMessageContentForTests()),
RestrictClockIdPolicy) {
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
syscall(SYS_clock_gettime, CLOCK_MONOTONIC_RAW, &ts);
}

#if !defined(OS_ANDROID)
Expand Down

0 comments on commit 7499662

Please sign in to comment.