Commit fc93308f authored by Robert Sesek's avatar Robert Sesek Committed by Commit Bot

Disable ParameterRestrictions.ptrace* tests on Android < N.

Bug: 934930
Change-Id: I0c9bae607e06a921c4587fcfb50ebc574c830c7e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1540281Reviewed-by: default avatarJorge Lucangeli Obes <jorgelo@chromium.org>
Commit-Queue: Robert Sesek <rsesek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#644811}
parent 1d6b43ae
...@@ -36,7 +36,12 @@ ...@@ -36,7 +36,12 @@
#include "sandbox/linux/system_headers/linux_time.h" #include "sandbox/linux/system_headers/linux_time.h"
#include "sandbox/linux/tests/unit_tests.h" #include "sandbox/linux/tests/unit_tests.h"
#if !defined(OS_ANDROID) #if defined(OS_ANDROID)
#include <sys/system_properties.h>
#include "base/android/build_info.h"
#include "base/strings/string_number_conversions.h"
#else
#include "third_party/lss/linux_syscall_support.h" // for MAKE_PROCESS_CPUCLOCK #include "third_party/lss/linux_syscall_support.h" // for MAKE_PROCESS_CPUCLOCK
#endif #endif
...@@ -415,11 +420,33 @@ class PtraceTestHarness { ...@@ -415,11 +420,33 @@ class PtraceTestHarness {
DISALLOW_COPY_AND_ASSIGN(PtraceTestHarness); DISALLOW_COPY_AND_ASSIGN(PtraceTestHarness);
}; };
// Fails on Android L and M. static bool IsAndroidLessThanN() {
// See https://crbug.com/934930 #if defined(OS_ANDROID)
static const int sdk_int = []() -> int {
char sdk_version[PROP_VALUE_MAX];
if (__system_property_get("ro.build.version.sdk", sdk_version) > 0) {
int sdk_int;
if (base::StringToInt(sdk_version, &sdk_int))
return sdk_int;
}
return -1;
}();
return sdk_int < base::android::SDK_VERSION_NOUGAT;
#else
return false;
#endif
}
BPF_TEST_C(ParameterRestrictions, BPF_TEST_C(ParameterRestrictions,
DISABLED_ptrace_getregs_allowed, ptrace_getregs_allowed,
RestrictPtracePolicy) { RestrictPtracePolicy) {
if (IsAndroidLessThanN()) {
// On 32-bit kernel Android devices, these tests hang for reasons unknown
// (https://crbug.com/934930). While Android N does not require a 64-bit
// kernel, all Pixel devices do have them starting with N.
return;
}
auto tracer = [](pid_t pid) { auto tracer = [](pid_t pid) {
#if defined(__arm__) #if defined(__arm__)
user_regs regs; user_regs regs;
...@@ -437,11 +464,16 @@ BPF_TEST_C(ParameterRestrictions, ...@@ -437,11 +464,16 @@ BPF_TEST_C(ParameterRestrictions,
PtraceTestHarness(tracer, false).Run(); PtraceTestHarness(tracer, false).Run();
} }
// Fails on Android L and M.
// See https://crbug.com/934930
BPF_TEST_C(ParameterRestrictions, BPF_TEST_C(ParameterRestrictions,
DISABLED_ptrace_syscall_blocked, ptrace_syscall_blocked,
RestrictPtracePolicy) { RestrictPtracePolicy) {
if (IsAndroidLessThanN()) {
// On 32-bit kernel Android devices, these tests hang for reasons unknown
// (https://crbug.com/934930). While Android N does not require a 64-bit
// kernel, all Pixel devices do have them starting with N.
return;
}
auto tracer = [](pid_t pid) { auto tracer = [](pid_t pid) {
// The tracer is about to die. Make sure the tracee is not stopped so it // The tracer is about to die. Make sure the tracee is not stopped so it
// can reap it and inspect its death signal. // can reap it and inspect its death signal.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment