1. Feb 09, 2021
  2. Feb 05, 2021
  3. Feb 04, 2021
  4. Feb 03, 2021
    • Yang Li's avatar
      samples: bpf: Remove unneeded semicolon · 1132b998
      Yang Li authored
      
      
      Eliminate the following coccicheck warning:
      ./samples/bpf/cookie_uid_helper_example.c:316:3-4: Unneeded semicolon
      
      Reported-by: default avatarAbaci Robot <abaci@linux.alibaba.com>
      Signed-off-by: default avatarYang Li <yang.lee@linux.alibaba.com>
      Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      Link: https://lore.kernel.org/bpf/1612322248-35398-1-git-send-email-yang.lee@linux.alibaba.com
      1132b998
    • KP Singh's avatar
      selftests/bpf: Fix a compiler warning in local_storage test · 15075bb7
      KP Singh authored
      Some compilers trigger a warning when tmp_dir_path is allocated
      with a fixed size of 64-bytes and used in the following snprintf:
      
        snprintf(tmp_exec_path, sizeof(tmp_exec_path), "%s/copy_of_rm",
      	   tmp_dir_path);
      
        warning: ‘/copy_of_rm’ directive output may be truncated writing 11
        bytes into a region of size between 1 and 64 [-Wformat-truncation=]
      
      This is because it assumes that tmp_dir_path can be a maximum of 64
      bytes long and, therefore, the end-result can get truncated. Fix it by
      not using a fixed size in the initialization of tmp_dir_path which
      allows the compiler to track actual size of the array better.
      
      Fixes: 2f94ac19
      
       ("bpf: Update local storage test to check handling of null ptrs")
      Signed-off-by: default avatarKP Singh <kpsingh@kernel.org>
      Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      Link: https://lore.kernel.org/bpf/20210202213730.1906931-1-kpsingh@kernel.org
      15075bb7
    • Brendan Jackman's avatar
      bpf: Propagate stack bounds to registers in atomics w/ BPF_FETCH · 37086bfd
      Brendan Jackman authored
      
      
      When BPF_FETCH is set, atomic instructions load a value from memory
      into a register. The current verifier code first checks via
      check_mem_access whether we can access the memory, and then checks
      via check_reg_arg whether we can write into the register.
      
      For loads, check_reg_arg has the side-effect of marking the
      register's value as unkonwn, and check_mem_access has the side effect
      of propagating bounds from memory to the register. This currently only
      takes effect for stack memory.
      
      Therefore with the current order, bounds information is thrown away,
      but by simply reversing the order of check_reg_arg
      vs. check_mem_access, we can instead propagate bounds smartly.
      
      A simple test is added with an infinite loop that can only be proved
      unreachable if this propagation is present. This is implemented both
      with C and directly in test_verifier using assembly.
      
      Suggested-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Signed-off-by: default avatarBrendan Jackman <jackmanb@google.com>
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Link: https://lore.kernel.org/bpf/20210202135002.4024825-1-jackmanb@google.com
      37086bfd
    • Tiezhu Yang's avatar
      samples/bpf: Add include dir for MIPS Loongson64 to fix build errors · 058107ab
      Tiezhu Yang authored
      
      
      There exists many build errors when make M=samples/bpf on the Loongson
      platform. This issue is MIPS related, x86 compiles just fine.
      
      Here are some errors:
      
        CLANG-bpf  samples/bpf/sockex2_kern.o
      In file included from samples/bpf/sockex2_kern.c:2:
      In file included from ./include/uapi/linux/in.h:24:
      In file included from ./include/linux/socket.h:8:
      In file included from ./include/linux/uio.h:8:
      In file included from ./include/linux/kernel.h:11:
      In file included from ./include/linux/bitops.h:32:
      In file included from ./arch/mips/include/asm/bitops.h:19:
      In file included from ./arch/mips/include/asm/barrier.h:11:
      ./arch/mips/include/asm/addrspace.h:13:10: fatal error: 'spaces.h' file not found
               ^~~~~~~~~~
      1 error generated.
      
        CLANG-bpf  samples/bpf/sockex2_kern.o
      In file included from samples/bpf/sockex2_kern.c:2:
      In file included from ./include/uapi/linux/in.h:24:
      In file included from ./include/linux/socket.h:8:
      In file included from ./include/linux/uio.h:8:
      In file included from ./include/linux/kernel.h:11:
      In file included from ./include/linux/bitops.h:32:
      In file included from ./arch/mips/include/asm/bitops.h:22:
      In file included from ./arch/mips/include/asm/cpu-features.h:13:
      In file included from ./arch/mips/include/asm/cpu-info.h:15:
      In file included from ./include/linux/cache.h:6:
      ./arch/mips/include/asm/cache.h:12:10: fatal error: 'kmalloc.h' file not found
               ^~~~~~~~~~~
      1 error generated.
      
        CLANG-bpf  samples/bpf/sockex2_kern.o
      In file included from samples/bpf/sockex2_kern.c:2:
      In file included from ./include/uapi/linux/in.h:24:
      In file included from ./include/linux/socket.h:8:
      In file included from ./include/linux/uio.h:8:
      In file included from ./include/linux/kernel.h:11:
      In file included from ./include/linux/bitops.h:32:
      In file included from ./arch/mips/include/asm/bitops.h:22:
      ./arch/mips/include/asm/cpu-features.h:15:10: fatal error: 'cpu-feature-overrides.h' file not found
               ^~~~~~~~~~~~~~~~~~~~~~~~~
      1 error generated.
      
      $ find arch/mips/include/asm -name spaces.h | sort
      arch/mips/include/asm/mach-ar7/spaces.h
      ...
      arch/mips/include/asm/mach-generic/spaces.h
      ...
      arch/mips/include/asm/mach-loongson64/spaces.h
      ...
      arch/mips/include/asm/mach-tx49xx/spaces.h
      
      $ find arch/mips/include/asm -name kmalloc.h | sort
      arch/mips/include/asm/mach-generic/kmalloc.h
      arch/mips/include/asm/mach-ip32/kmalloc.h
      arch/mips/include/asm/mach-tx49xx/kmalloc.h
      
      $ find arch/mips/include/asm -name cpu-feature-overrides.h | sort
      arch/mips/include/asm/mach-ath25/cpu-feature-overrides.h
      ...
      arch/mips/include/asm/mach-generic/cpu-feature-overrides.h
      ...
      arch/mips/include/asm/mach-loongson64/cpu-feature-overrides.h
      ...
      arch/mips/include/asm/mach-tx49xx/cpu-feature-overrides.h
      
      In the arch/mips/Makefile, there exists the following board-dependent
      options:
      
      include arch/mips/Kbuild.platforms
      cflags-y += -I$(srctree)/arch/mips/include/asm/mach-generic
      
      So we can do the similar things in samples/bpf/Makefile, just add
      platform specific and generic include dir for MIPS Loongson64 to
      fix the build errors.
      
      Signed-off-by: default avatarTiezhu Yang <yangtiezhu@loongson.cn>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Link: https://lore.kernel.org/bpf/1611669925-25315-1-git-send-email-yangtiezhu@loongson.cn
      058107ab
  5. Jan 29, 2021
  6. Jan 28, 2021
  7. Jan 27, 2021
  8. Jan 26, 2021