1. 24 5月, 2014 1 次提交
    • A
      lib/test_bpf.c: don't use gcc union shortcut · ece80490
      Andrew Morton 提交于
      Older gcc's (mine is gcc-4.4.4) make a mess of this.
      
      lib/test_bpf.c:74: error: unknown field 'insns' specified in initializer
      lib/test_bpf.c:75: warning: missing braces around initializer
      lib/test_bpf.c:75: warning: (near initialization for 'tests[0].<anonymous>.insns[0]')
      lib/test_bpf.c:76: error: extra brace group at end of initializer
      lib/test_bpf.c:76: error: (near initialization for 'tests[0].<anonymous>')
      lib/test_bpf.c:76: warning: excess elements in union initializer
      lib/test_bpf.c:76: warning: (near initialization for 'tests[0].<anonymous>')
      lib/test_bpf.c:77: error: extra brace group at end of initializer
      
      Cc: Alexei Starovoitov <ast@plumgrid.com>
      Cc: David S. Miller <davem@davemloft.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Acked-by: NAlexei Starovoitov <ast@plumgrid.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ece80490
  2. 22 5月, 2014 1 次提交
    • A
      net: filter: cleanup invocation of internal BPF · 5fe821a9
      Alexei Starovoitov 提交于
      Kernel API for classic BPF socket filters is:
      
      sk_unattached_filter_create() - validate classic BPF, convert, JIT
      SK_RUN_FILTER() - run it
      sk_unattached_filter_destroy() - destroy socket filter
      
      Cleanup internal BPF kernel API as following:
      
      sk_filter_select_runtime() - final step of internal BPF creation.
        Try to JIT internal BPF program, if JIT is not available select interpreter
      SK_RUN_FILTER() - run it
      sk_filter_free() - free internal BPF program
      
      Disallow direct calls to BPF interpreter. Execution of the BPF program should
      be done with SK_RUN_FILTER() macro.
      
      Example of internal BPF create, run, destroy:
      
        struct sk_filter *fp;
      
        fp = kzalloc(sk_filter_size(prog_len), GFP_KERNEL);
        memcpy(fp->insni, prog, prog_len * sizeof(fp->insni[0]));
        fp->len = prog_len;
      
        sk_filter_select_runtime(fp);
      
        SK_RUN_FILTER(fp, ctx);
      
        sk_filter_free(fp);
      
      Sockets, seccomp, testsuite, tracing are using different ways to populate
      sk_filter, so first steps of program creation are not common.
      Signed-off-by: NAlexei Starovoitov <ast@plumgrid.com>
      Acked-by: NDaniel Borkmann <dborkman@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5fe821a9
  3. 12 5月, 2014 2 次提交