1. 02 May, 2017 5 commits
    • David Miller's avatar
      bpf: Do not dereference user pointer in bpf_test_finish(). · 78e52272
      David Miller authored
      Instead, pass the kattr in which has a kernel side copy of this
      data structure from userspace already.
      
      Fix based upon a suggestion from Alexei Starovoitov.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Acked-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      78e52272
    • David S. Miller's avatar
      selftests: bpf: Use bpf_endian.h in test_xdp.c · 4e9c3a66
      David S. Miller authored
      This fixes the testcase on big-endian.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4e9c3a66
    • Jakub Kicinski's avatar
      xdp: fix parameter kdoc for extack · b5d60989
      Jakub Kicinski authored
      Fix kdoc parameter spelling from extact to extack.
      Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b5d60989
    • Daniel Borkmann's avatar
      bpf, samples: fix build warning in cookie_uid_helper_example · eb6211d3
      Daniel Borkmann authored
      Fix the following warnings triggered by 51570a5a ("A Sample of
      using socket cookie and uid for traffic monitoring"):
      
        In file included from /home/foo/net-next/samples/bpf/cookie_uid_helper_example.c:54:0:
        /home/foo/net-next/samples/bpf/cookie_uid_helper_example.c: In function 'prog_load':
        /home/foo/net-next/samples/bpf/cookie_uid_helper_example.c:119:27: warning: overflow in implicit constant conversion [-Woverflow]
           -32 + offsetof(struct stats, uid)),
                                 ^
        /home/foo/net-next/samples/bpf/libbpf.h:135:12: note: in definition of macro 'BPF_STX_MEM'
         .off   = OFF,     \
                  ^
        /home/foo/net-next/samples/bpf/cookie_uid_helper_example.c:121:27: warning: overflow in implicit constant conversion [-Woverflow]
           -32 + offsetof(struct stats, packets), 1),
                                 ^
        /home/foo/net-next/samples/bpf/libbpf.h:155:12: note: in definition of macro 'BPF_ST_MEM'
         .off   = OFF,     \
                  ^
        /home/foo/net-next/samples/bpf/cookie_uid_helper_example.c:129:27: warning: overflow in implicit constant conversion [-Woverflow]
           -32 + offsetof(struct stats, bytes)),
                                 ^
        /home/foo/net-next/samples/bpf/libbpf.h:135:12: note: in definition of macro 'BPF_STX_MEM'
         .off   = OFF,     \
                  ^
        HOSTLD  /home/foo/net-next/samples/bpf/per_socket_stats_example
      
      Fixes: 51570a5a ("A Sample of using socket cookie and uid for traffic monitoring")
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      eb6211d3
    • David S. Miller's avatar
      sparc64: Fix BPF JIT wrt. branches and ldimm64 instructions. · e3bf4c61
      David S. Miller authored
      Like other JITs, sparc64 maintains an array of instruction offsets but
      stores the entries off by one.  This is done because jumps to the
      exit block are indexed to one past the last BPF instruction.
      
      So if we size the array by the program length, we need to record
      the previous instruction in order to stay within the array bounds.
      
      This is explained in ARM JIT commit 8eee539d ("arm64: bpf: fix
      out-of-bounds read in bpf2a64_offset()").
      
      But this scheme requires a little bit of careful handling when
      the instruction before the branch destination is a 64-bit load
      immediate.  It takes up 2 BPF instruction slots.
      
      Therefore, we have to fill in the array entry for the second
      half of the 64-bit load immediate instruction rather than for
      the one for the beginning of that instruction.
      
      Fixes: 7a12b503 ("sparc64: Add eBPF JIT.")
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e3bf4c61
  2. 01 May, 2017 35 commits