Skip to content
  1. Oct 21, 2017
  2. Oct 20, 2017
  3. Oct 18, 2017
    • Jakub Kicinski's avatar
      bpf: disallow arithmetic operations on context pointer · 28e33f9d
      Jakub Kicinski authored
      
      
      Commit f1174f77 ("bpf/verifier: rework value tracking")
      removed the crafty selection of which pointer types are
      allowed to be modified.  This is OK for most pointer types
      since adjust_ptr_min_max_vals() will catch operations on
      immutable pointers.  One exception is PTR_TO_CTX which is
      now allowed to be offseted freely.
      
      The intent of aforementioned commit was to allow context
      access via modified registers.  The offset passed to
      ->is_valid_access() verifier callback has been adjusted
      by the value of the variable offset.
      
      What is missing, however, is taking the variable offset
      into account when the context register is used.  Or in terms
      of the code adding the offset to the value passed to the
      ->convert_ctx_access() callback.  This leads to the following
      eBPF user code:
      
           r1 += 68
           r0 = *(u32 *)(r1 + 8)
           exit
      
      being translated to this in kernel space:
      
         0: (07) r1 += 68
         1: (61) r0 = *(u32 *)(r1 +180)
         2: (95) exit
      
      Offset 8 is corresponding to 180 in the kernel, but offset
      76 is valid too.  Verifier will "accept" access to offset
      68+8=76 but then "convert" access to offset 8 as 180.
      Effective access to offset 248 is beyond the kernel context.
      (This is a __sk_buff example on a debug-heavy kernel -
      packet mark is 8 -> 180, 76 would be data.)
      
      Dereferencing the modified context pointer is not as easy
      as dereferencing other types, because we have to translate
      the access to reading a field in kernel structures which is
      usually at a different offset and often of a different size.
      To allow modifying the pointer we would have to make sure
      that given eBPF instruction will always access the same
      field or the fields accessed are "compatible" in terms of
      offset and size...
      
      Disallow dereferencing modified context pointers and add
      to selftests the test case described here.
      
      Fixes: f1174f77 ("bpf/verifier: rework value tracking")
      Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
      Acked-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Acked-by: default avatarEdward Cree <ecree@solarflare.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      28e33f9d
  4. Oct 13, 2017
  5. Oct 06, 2017
  6. Oct 05, 2017
    • Shuah Khan's avatar
      selftests: mqueue: fix regression in silencing output from RUN_TESTS · ea344f6a
      Shuah Khan authored
      
      
      Fix fix regression in silencing output from RUN_TESTS introduced by
      commit <8230b905> selftests: mqueue: Use full path to run tests
      from Makefile
      
      Signed-off-by: default avatarShuah Khan <shuahkh@osg.samsung.com>
      ea344f6a
    • Shuah Khan's avatar
      selftests: x86: sysret_ss_attrs doesn't build on a PIE build · 3346a6a4
      Shuah Khan authored
      
      
      sysret_ss_attrs fails to compile leading x86 test run to fail on systems
      configured to build using PIE by default. Add -no-pie fix it.
      
      Relocation might still fail if relocated above 4G. For now this change
      fixes the build and runs x86 tests.
      
      tools/testing/selftests/x86$ make
      gcc -m64 -o .../tools/testing/selftests/x86/single_step_syscall_64 -O2
      -g -std=gnu99 -pthread -Wall  single_step_syscall.c -lrt -ldl
      gcc -m64 -o .../tools/testing/selftests/x86/sysret_ss_attrs_64 -O2 -g
      -std=gnu99 -pthread -Wall  sysret_ss_attrs.c thunks.S -lrt -ldl
      /usr/bin/ld: /tmp/ccS6pvIh.o: relocation R_X86_64_32S against `.text'
      can not be used when making a shared object; recompile with -fPIC
      /usr/bin/ld: final link failed: Nonrepresentable section on output
      collect2: error: ld returned 1 exit status
      Makefile:49: recipe for target
      '.../tools/testing/selftests/x86/sysret_ss_attrs_64' failed
      make: *** [.../tools/testing/selftests/x86/sysret_ss_attrs_64] Error 1
      
      Suggested-by: default avatarAndy Lutomirski <luto@kernel.org>
      Signed-off-by: default avatarShuah Khan <shuahkh@osg.samsung.com>
      3346a6a4
  7. Sep 25, 2017
  8. Sep 21, 2017
  9. Sep 19, 2017
  10. Sep 18, 2017
  11. Sep 15, 2017
  12. Sep 09, 2017
Loading