Commit c2352bce authored by hidehiko's avatar hidehiko Committed by Commit bot

Remove #include <asm/unistd.h> from linux_syscall_ranges.h and syscall.cc.

The header is included for __NR_SYSCALL_BASE and __ARM_NR_BASE.
Some toolchain (in particular, PNaCl toolchain) does not provide
asm/unistd.h (so that neither __NR_SYSCALL_BASE nor __ARM_NR_BASE
is provided).
This CL removes the dependency to asm/unistd.h from linux_syscall_ranges.h,
instead define the values if necessary.

Also, this CL removes the include from syscall.cc, too, which is
unused.

TEST=Ran bots.
BUG=358465

Review URL: https://codereview.chromium.org/1071653002

Cr-Commit-Position: refs/heads/master@{#324371}
parent bcaa4439
...@@ -5,8 +5,6 @@ ...@@ -5,8 +5,6 @@
#ifndef SANDBOX_LINUX_BPF_DSL_LINUX_SYSCALL_RANGES_H_ #ifndef SANDBOX_LINUX_BPF_DSL_LINUX_SYSCALL_RANGES_H_
#define SANDBOX_LINUX_BPF_DSL_LINUX_SYSCALL_RANGES_H_ #define SANDBOX_LINUX_BPF_DSL_LINUX_SYSCALL_RANGES_H_
#include <asm/unistd.h> // For __NR_SYSCALL_BASE
#if defined(__x86_64__) #if defined(__x86_64__)
#define MIN_SYSCALL 0u #define MIN_SYSCALL 0u
...@@ -25,15 +23,19 @@ ...@@ -25,15 +23,19 @@
// and a "ghost syscall private to the kernel", cmpxchg, // and a "ghost syscall private to the kernel", cmpxchg,
// at |__ARM_NR_BASE+0x00fff0|. // at |__ARM_NR_BASE+0x00fff0|.
// See </arch/arm/include/asm/unistd.h> in the Linux kernel. // See </arch/arm/include/asm/unistd.h> in the Linux kernel.
#define MIN_SYSCALL ((unsigned int)__NR_SYSCALL_BASE)
// __NR_SYSCALL_BASE is 0 in thumb and ARM EABI.
#define MIN_SYSCALL 0u
#define MAX_PUBLIC_SYSCALL (MIN_SYSCALL + 1024u) #define MAX_PUBLIC_SYSCALL (MIN_SYSCALL + 1024u)
#define MIN_PRIVATE_SYSCALL ((unsigned int)__ARM_NR_BASE) // __ARM_NR_BASE is __NR_SYSCALL_BASE + 0xf0000u
#define MIN_PRIVATE_SYSCALL 0xf0000u
#define MAX_PRIVATE_SYSCALL (MIN_PRIVATE_SYSCALL + 16u) #define MAX_PRIVATE_SYSCALL (MIN_PRIVATE_SYSCALL + 16u)
#define MIN_GHOST_SYSCALL ((unsigned int)__ARM_NR_BASE + 0xfff0u) #define MIN_GHOST_SYSCALL (MIN_PRIVATE_SYSCALL + 0xfff0u)
#define MAX_SYSCALL (MIN_GHOST_SYSCALL + 4u) #define MAX_SYSCALL (MIN_GHOST_SYSCALL + 4u)
#elif defined(__mips__) && (_MIPS_SIM == _ABIO32) #elif defined(__mips__) && (_MIPS_SIM == _ABIO32)
#include <asm/unistd.h> // for __NR_O32_Linux and __NR_Linux_syscalls
#define MIN_SYSCALL __NR_O32_Linux #define MIN_SYSCALL __NR_O32_Linux
#define MAX_PUBLIC_SYSCALL (MIN_SYSCALL + __NR_Linux_syscalls) #define MAX_PUBLIC_SYSCALL (MIN_SYSCALL + __NR_Linux_syscalls)
#define MAX_SYSCALL MAX_PUBLIC_SYSCALL #define MAX_SYSCALL MAX_PUBLIC_SYSCALL
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include "sandbox/linux/seccomp-bpf/syscall.h" #include "sandbox/linux/seccomp-bpf/syscall.h"
#include <asm/unistd.h>
#include <errno.h> #include <errno.h>
#include <stdint.h> #include <stdint.h>
......
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