From patchwork Wed Sep 10 05:09:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexei Starovoitov X-Patchwork-Id: 387548 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 7ED0C140131 for ; Wed, 10 Sep 2014 15:15:53 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751844AbaIJFPb (ORCPT ); Wed, 10 Sep 2014 01:15:31 -0400 Received: from mail-pa0-f51.google.com ([209.85.220.51]:45888 "EHLO mail-pa0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750784AbaIJFKd (ORCPT ); Wed, 10 Sep 2014 01:10:33 -0400 Received: by mail-pa0-f51.google.com with SMTP id kx10so6881975pab.24 for ; Tue, 09 Sep 2014 22:10:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=JHB1p2fuK1m4FhFVcu+7iSbPNmEvYbOGStvVcFxb9zE=; b=mJZN/cYgpv/BXrZAGHULKpBaqxcT0frZu6MZOxj2OwBLx8MzT+Pf1it9Z2F7RhrfvB /H9vWtYINg/p091wBZ/TfPWGxunpQKoRXHTDEjTbx4FPdY4R+iZvI/hLiu3ea78kqFBP T+4+p/NsfOQ7k3jFsxI/+VFp9067xEM6PIKmgrbMyiYHswr/HhC0+QNr/KcOpGnRNsBp gXf4YXJSGfHQAJ9UwG7cbawmLqX4fmNe/6NY61/yY5GzGULNk7Ctt7zOC7+1mX5s8M5+ +YkiPPQLY+qYu00UaqMpx6AS1681Px3AUYKUfVLzU7fg6iS/tZEGt1jt5BxUGBz7BKwL CR/Q== X-Gm-Message-State: ALoCoQlY3pwpOdf8Hyf9vVvm+FE28iknN+F3epbSm0jCnHQ5fObiBI6J9lIaef89gljVs8X9nD8v X-Received: by 10.66.163.65 with SMTP id yg1mr63243069pab.33.1410325833448; Tue, 09 Sep 2014 22:10:33 -0700 (PDT) Received: from pg-vmw-gw1.plumgrid.com ([12.229.56.226]) by mx.google.com with ESMTPSA id gr5sm13139806pbc.33.2014.09.09.22.10.31 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 09 Sep 2014 22:10:32 -0700 (PDT) From: Alexei Starovoitov To: "David S. Miller" Cc: Ingo Molnar , Linus Torvalds , Andy Lutomirski , Steven Rostedt , Daniel Borkmann , Hannes Frederic Sowa , Chema Gonzalez , Eric Dumazet , Peter Zijlstra , Pablo Neira Ayuso , "H. Peter Anvin" , Andrew Morton , Kees Cook , linux-api@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v11 net-next 02/12] bpf: enable bpf syscall on x64 and i386 Date: Tue, 9 Sep 2014 22:09:58 -0700 Message-Id: <1410325808-3657-3-git-send-email-ast@plumgrid.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1410325808-3657-1-git-send-email-ast@plumgrid.com> References: <1410325808-3657-1-git-send-email-ast@plumgrid.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org done as separate commit to ease conflict resolution Signed-off-by: Alexei Starovoitov --- arch/x86/syscalls/syscall_32.tbl | 1 + arch/x86/syscalls/syscall_64.tbl | 1 + include/linux/syscalls.h | 3 ++- include/uapi/asm-generic/unistd.h | 4 +++- kernel/sys_ni.c | 3 +++ 5 files changed, 10 insertions(+), 2 deletions(-) diff --git a/arch/x86/syscalls/syscall_32.tbl b/arch/x86/syscalls/syscall_32.tbl index 028b78168d85..9fe1b5d002f0 100644 --- a/arch/x86/syscalls/syscall_32.tbl +++ b/arch/x86/syscalls/syscall_32.tbl @@ -363,3 +363,4 @@ 354 i386 seccomp sys_seccomp 355 i386 getrandom sys_getrandom 356 i386 memfd_create sys_memfd_create +357 i386 bpf sys_bpf diff --git a/arch/x86/syscalls/syscall_64.tbl b/arch/x86/syscalls/syscall_64.tbl index 35dd922727b9..281150b539a2 100644 --- a/arch/x86/syscalls/syscall_64.tbl +++ b/arch/x86/syscalls/syscall_64.tbl @@ -327,6 +327,7 @@ 318 common getrandom sys_getrandom 319 common memfd_create sys_memfd_create 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 diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 0f86d85a9ce4..bda9b81357cc 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h @@ -65,6 +65,7 @@ struct old_linux_dirent; struct perf_event_attr; struct file_handle; struct sigaltstack; +union bpf_attr; #include #include @@ -875,5 +876,5 @@ asmlinkage long sys_seccomp(unsigned int op, unsigned int flags, const char __user *uargs); asmlinkage long sys_getrandom(char __user *buf, size_t count, unsigned int flags); - +asmlinkage long sys_bpf(int cmd, union bpf_attr *attr, unsigned int size); #endif diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h index 11d11bc5c78f..22749c134117 100644 --- a/include/uapi/asm-generic/unistd.h +++ b/include/uapi/asm-generic/unistd.h @@ -705,9 +705,11 @@ __SYSCALL(__NR_seccomp, sys_seccomp) __SYSCALL(__NR_getrandom, sys_getrandom) #define __NR_memfd_create 279 __SYSCALL(__NR_memfd_create, sys_memfd_create) +#define __NR_bpf 280 +__SYSCALL(__NR_bpf, sys_bpf) #undef __NR_syscalls -#define __NR_syscalls 280 +#define __NR_syscalls 281 /* * All syscalls below here should go away really, diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c index 391d4ddb6f4b..b4b5083f5f5e 100644 --- a/kernel/sys_ni.c +++ b/kernel/sys_ni.c @@ -218,3 +218,6 @@ cond_syscall(sys_kcmp); /* operate on Secure Computing state */ cond_syscall(sys_seccomp); + +/* access BPF programs and maps */ +cond_syscall(sys_bpf);