Merge "configs for jailed procs to dump code coverage data"
This commit is contained in:
commit
0bc3f6b124
11 changed files with 160 additions and 0 deletions
37
code_coverage/Android.mk
Normal file
37
code_coverage/Android.mk
Normal file
|
@ -0,0 +1,37 @@
|
|||
# policies to allow processes inside minijail to dump code coverage information
|
||||
#
|
||||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := code_coverage.policy
|
||||
LOCAL_MODULE_CLASS := ETC
|
||||
LOCAL_MULTILIB := both
|
||||
|
||||
ifeq ($(TARGET_ARCH), $(filter $(TARGET_ARCH), arm arm64))
|
||||
LOCAL_MODULE_STEM_32 := code_coverage.arm.policy
|
||||
LOCAL_MODULE_STEM_64 := code_coverage.arm64.policy
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET_ARCH), $(filter $(TARGET_ARCH), x86 x86_64))
|
||||
LOCAL_MODULE_STEM_32 := code_coverage.x86.policy
|
||||
LOCAL_MODULE_STEM_64 := code_coverage.x86_64.policy
|
||||
endif
|
||||
|
||||
# different files for different configurations
|
||||
ifeq ($(NATIVE_COVERAGE),true)
|
||||
LOCAL_SRC_FILES_arm := seccomp_policy/code_coverage.arm.policy
|
||||
LOCAL_SRC_FILES_arm64 := seccomp_policy/code_coverage.arm64.policy
|
||||
LOCAL_SRC_FILES_x86 := seccomp_policy/code_coverage.x86.policy
|
||||
LOCAL_SRC_FILES_x86_64 := seccomp_policy/code_coverage.x86_64.policy
|
||||
else
|
||||
LOCAL_SRC_FILES_arm := empty_policy/code_coverage.arm.policy
|
||||
LOCAL_SRC_FILES_arm64 := empty_policy/code_coverage.arm64.policy
|
||||
LOCAL_SRC_FILES_x86 := empty_policy/code_coverage.x86.policy
|
||||
LOCAL_SRC_FILES_x86_64 := empty_policy/code_coverage.x86_64.policy
|
||||
endif
|
||||
|
||||
LOCAL_MODULE_TARGET_ARCH := arm arm64 x86 x86_64
|
||||
LOCAL_MODULE_PATH := $(TARGET_OUT)/etc/seccomp_policy
|
||||
include $(BUILD_PREBUILT)
|
2
code_coverage/empty_policy/code_coverage.arm.policy
Normal file
2
code_coverage/empty_policy/code_coverage.arm.policy
Normal file
|
@ -0,0 +1,2 @@
|
|||
# empty unless code_coverage is enabled.
|
||||
# code_coverage.arm.policy
|
2
code_coverage/empty_policy/code_coverage.arm64.policy
Normal file
2
code_coverage/empty_policy/code_coverage.arm64.policy
Normal file
|
@ -0,0 +1,2 @@
|
|||
# empty unless code_coverage is enabled.
|
||||
# code_coverage.arm64.policy
|
2
code_coverage/empty_policy/code_coverage.x86.policy
Normal file
2
code_coverage/empty_policy/code_coverage.x86.policy
Normal file
|
@ -0,0 +1,2 @@
|
|||
# empty unless code_coverage is enabled.
|
||||
# code_coverage.x86.policy
|
2
code_coverage/empty_policy/code_coverage.x86_64.policy
Normal file
2
code_coverage/empty_policy/code_coverage.x86_64.policy
Normal file
|
@ -0,0 +1,2 @@
|
|||
# empty unless code_coverage is enabled.
|
||||
# code_coverage.x86_64.policy
|
14
code_coverage/seccomp_policy/code_coverage.arm.policy
Normal file
14
code_coverage/seccomp_policy/code_coverage.arm.policy
Normal file
|
@ -0,0 +1,14 @@
|
|||
close: 1
|
||||
mkdirat: 1
|
||||
msync: 1
|
||||
munmap: 1
|
||||
openat: 1
|
||||
write: 1
|
||||
fcntl64: 1
|
||||
fstat64: 1
|
||||
geteuid32: 1
|
||||
_llseek: 1
|
||||
mmap2: 1
|
||||
sigreturn: 1
|
||||
gettimeofday: 1
|
||||
prctl: 1
|
13
code_coverage/seccomp_policy/code_coverage.arm64.policy
Normal file
13
code_coverage/seccomp_policy/code_coverage.arm64.policy
Normal file
|
@ -0,0 +1,13 @@
|
|||
close: 1
|
||||
mkdirat: 1
|
||||
msync: 1
|
||||
munmap: 1
|
||||
openat: 1
|
||||
write: 1
|
||||
fcntl: 1
|
||||
fstat: 1
|
||||
geteuid: 1
|
||||
lseek: 1
|
||||
mmap: 1
|
||||
rt_sigreturn: 1
|
||||
prctl: 1
|
51
code_coverage/seccomp_policy/code_coverage.policy.def
Normal file
51
code_coverage/seccomp_policy/code_coverage.policy.def
Normal file
|
@ -0,0 +1,51 @@
|
|||
// SECCOMP_MODE_STRICT
|
||||
//
|
||||
// minijail allowances for code coverage
|
||||
// this is processed with generate.sh, so we can use appropriate directives
|
||||
// size specific: __LP64__ for 64 bit, else 32 bit
|
||||
// arch specific: __arm__, __aarch64__, __i386__, __x86_64__
|
||||
|
||||
// includes *all* syscalls used during the coverage dumping
|
||||
// no skipping just because they might have been in another policy file.
|
||||
|
||||
// coverage tool uses different operations on different passes
|
||||
// 1st: uses write() to fill the file
|
||||
// 2nd-Nth: uses mmap() to update in place
|
||||
|
||||
close: 1
|
||||
mkdirat: 1
|
||||
msync: 1
|
||||
munmap: 1
|
||||
openat: 1
|
||||
write: 1
|
||||
|
||||
#if defined(__LP64__)
|
||||
fcntl: 1
|
||||
fstat: 1
|
||||
geteuid: 1
|
||||
lseek: 1
|
||||
mmap: 1
|
||||
rt_sigreturn: 1
|
||||
#else
|
||||
fcntl64: 1
|
||||
fstat64: 1
|
||||
geteuid32: 1
|
||||
_llseek: 1
|
||||
mmap2: 1
|
||||
sigreturn: 1
|
||||
#endif
|
||||
|
||||
#if defined(__arm__)
|
||||
gettimeofday: 1
|
||||
#endif
|
||||
|
||||
#if defined(__i386__)
|
||||
madvise: 1
|
||||
#endif
|
||||
|
||||
#if defined(__arm__)
|
||||
prctl: 1
|
||||
#elif defined(__aarch64__)
|
||||
prctl: 1
|
||||
#endif
|
||||
|
13
code_coverage/seccomp_policy/code_coverage.x86.policy
Normal file
13
code_coverage/seccomp_policy/code_coverage.x86.policy
Normal file
|
@ -0,0 +1,13 @@
|
|||
close: 1
|
||||
mkdirat: 1
|
||||
msync: 1
|
||||
munmap: 1
|
||||
openat: 1
|
||||
write: 1
|
||||
fcntl64: 1
|
||||
fstat64: 1
|
||||
geteuid32: 1
|
||||
_llseek: 1
|
||||
mmap2: 1
|
||||
sigreturn: 1
|
||||
madvise: 1
|
12
code_coverage/seccomp_policy/code_coverage.x86_64.policy
Normal file
12
code_coverage/seccomp_policy/code_coverage.x86_64.policy
Normal file
|
@ -0,0 +1,12 @@
|
|||
close: 1
|
||||
mkdirat: 1
|
||||
msync: 1
|
||||
munmap: 1
|
||||
openat: 1
|
||||
write: 1
|
||||
fcntl: 1
|
||||
fstat: 1
|
||||
geteuid: 1
|
||||
lseek: 1
|
||||
mmap: 1
|
||||
rt_sigreturn: 1
|
12
code_coverage/seccomp_policy/generate.sh
Executable file
12
code_coverage/seccomp_policy/generate.sh
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
# generate the arch-specific files from the generic one
|
||||
|
||||
set -ex
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
CPP='cpp -undef -E -P code_coverage.policy.def'
|
||||
$CPP -D__arm__ -o code_coverage.arm.policy
|
||||
$CPP -D__aarch64__ -D__LP64__ -o code_coverage.arm64.policy
|
||||
$CPP -D__i386__ -o code_coverage.x86.policy
|
||||
$CPP -D__x86_64__ -D__LP64__ -o code_coverage.x86_64.policy
|
Loading…
Reference in a new issue