Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754551AbaFKWXI (ORCPT ); Wed, 11 Jun 2014 18:23:08 -0400 Received: from mail-ve0-f170.google.com ([209.85.128.170]:50218 "EHLO mail-ve0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754481AbaFKWXC (ORCPT ); Wed, 11 Jun 2014 18:23:02 -0400 MIME-Version: 1.0 In-Reply-To: <5398D59A.3030900@zytor.com> References: <9e11cd988a0f120606e37b5e275019754e2774da.1402517933.git.luto@amacapital.net> <5398D59A.3030900@zytor.com> From: Andy Lutomirski Date: Wed, 11 Jun 2014 15:22:40 -0700 Message-ID: Subject: Re: [RFC 5/5] x86,seccomp: Add a seccomp fastpath To: "H. Peter Anvin" Cc: Alexei Starovoitov , "linux-kernel@vger.kernel.org" , Kees Cook , Will Drewry , Oleg Nesterov , X86 ML , "linux-arm-kernel@lists.infradead.org" , linux-mips@linux-mips.org, linux-arch , LSM List Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 11, 2014 at 3:18 PM, H. Peter Anvin wrote: > On 06/11/2014 02:56 PM, Andy Lutomirski wrote: >> >> 13ns is with the simplest nonempty filter. I hope that empty filters >> don't work. >> > > Why wouldn't they? Is it permissible to fall off the end of a BPF program? I'm getting EINVAL trying to install an actual empty filter. The filter I tested with was: #include #include #include #include #include #include #include #include int main(int argc, char **argv) { int rc; struct sock_filter filter[] = { BPF_STMT(BPF_RET+BPF_K, SECCOMP_RET_ALLOW), }; struct sock_fprog prog = { .len = (unsigned short)(sizeof(filter)/sizeof(filter[0])), .filter = filter, }; if (argc < 2) { printf("Usage: null_seccomp PATH ARGS...\n"); return 1; } if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)) err(1, "PR_SET_NO_NEW_PRIVS"); if (prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &prog)) err(1, "PR_SET_SECCOMP"); execv(argv[1], argv + 1); err(1, argv[1]); } --Andy -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/