소스 검색

bpf: enable bpf syscall on x64 and i386

done as separate commit to ease conflict resolution

Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Alexei Starovoitov 11 년 전
부모
커밋
749730ce42
5개의 변경된 파일10개의 추가작업 그리고 2개의 파일을 삭제
  1. 1 0
      arch/x86/syscalls/syscall_32.tbl
  2. 1 0
      arch/x86/syscalls/syscall_64.tbl
  3. 2 1
      include/linux/syscalls.h
  4. 3 1
      include/uapi/asm-generic/unistd.h
  5. 3 0
      kernel/sys_ni.c

+ 1 - 0
arch/x86/syscalls/syscall_32.tbl

@@ -363,3 +363,4 @@
 354	i386	seccomp			sys_seccomp
 354	i386	seccomp			sys_seccomp
 355	i386	getrandom		sys_getrandom
 355	i386	getrandom		sys_getrandom
 356	i386	memfd_create		sys_memfd_create
 356	i386	memfd_create		sys_memfd_create
+357	i386	bpf			sys_bpf

+ 1 - 0
arch/x86/syscalls/syscall_64.tbl

@@ -327,6 +327,7 @@
 318	common	getrandom		sys_getrandom
 318	common	getrandom		sys_getrandom
 319	common	memfd_create		sys_memfd_create
 319	common	memfd_create		sys_memfd_create
 320	common	kexec_file_load		sys_kexec_file_load
 320	common	kexec_file_load		sys_kexec_file_load
+321	common	bpf			sys_bpf
 
 
 #
 #
 # x32-specific system call numbers start at 512 to avoid cache impact
 # x32-specific system call numbers start at 512 to avoid cache impact

+ 2 - 1
include/linux/syscalls.h

@@ -65,6 +65,7 @@ struct old_linux_dirent;
 struct perf_event_attr;
 struct perf_event_attr;
 struct file_handle;
 struct file_handle;
 struct sigaltstack;
 struct sigaltstack;
+union bpf_attr;
 
 
 #include <linux/types.h>
 #include <linux/types.h>
 #include <linux/aio_abi.h>
 #include <linux/aio_abi.h>
@@ -875,5 +876,5 @@ asmlinkage long sys_seccomp(unsigned int op, unsigned int flags,
 			    const char __user *uargs);
 			    const char __user *uargs);
 asmlinkage long sys_getrandom(char __user *buf, size_t count,
 asmlinkage long sys_getrandom(char __user *buf, size_t count,
 			      unsigned int flags);
 			      unsigned int flags);
-
+asmlinkage long sys_bpf(int cmd, union bpf_attr *attr, unsigned int size);
 #endif
 #endif

+ 3 - 1
include/uapi/asm-generic/unistd.h

@@ -705,9 +705,11 @@ __SYSCALL(__NR_seccomp, sys_seccomp)
 __SYSCALL(__NR_getrandom, sys_getrandom)
 __SYSCALL(__NR_getrandom, sys_getrandom)
 #define __NR_memfd_create 279
 #define __NR_memfd_create 279
 __SYSCALL(__NR_memfd_create, sys_memfd_create)
 __SYSCALL(__NR_memfd_create, sys_memfd_create)
+#define __NR_bpf 280
+__SYSCALL(__NR_bpf, sys_bpf)
 
 
 #undef __NR_syscalls
 #undef __NR_syscalls
-#define __NR_syscalls 280
+#define __NR_syscalls 281
 
 
 /*
 /*
  * All syscalls below here should go away really,
  * All syscalls below here should go away really,

+ 3 - 0
kernel/sys_ni.c

@@ -218,3 +218,6 @@ cond_syscall(sys_kcmp);
 
 
 /* operate on Secure Computing state */
 /* operate on Secure Computing state */
 cond_syscall(sys_seccomp);
 cond_syscall(sys_seccomp);
+
+/* access BPF programs and maps */
+cond_syscall(sys_bpf);