1. 10 3月, 2018 1 次提交
  2. 27 2月, 2018 1 次提交
    • M
      idr: Fix handling of IDs above INT_MAX · 4b0ad076
      Matthew Wilcox 提交于
      Khalid reported that the kernel selftests are currently failing:
      
      selftests: test_bpf.sh
      ========================================
      test_bpf: [FAIL]
      not ok 1..8 selftests:  test_bpf.sh [FAIL]
      
      He bisected it to 6ce711f2 ("idr: Make
      1-based IDRs more efficient").
      
      The root cause is doing a signed comparison in idr_alloc_u32() instead
      of an unsigned comparison.  I went looking for any similar problems and
      found a couple (which would each result in the failure to warn in two
      situations that aren't supposed to happen).
      
      I knocked up a few test-cases to prove that I was right and added them
      to the test-suite.
      Reported-by: NKhalid Aziz <khalid.aziz@oracle.com>
      Tested-by: NKhalid Aziz <khalid.aziz@oracle.com>
      Signed-off-by: NMatthew Wilcox <mawilcox@microsoft.com>
      4b0ad076
  3. 23 2月, 2018 2 次提交
  4. 22 2月, 2018 2 次提交
  5. 12 2月, 2018 2 次提交
  6. 08 2月, 2018 1 次提交
    • A
      vsprintf: avoid misleading "(null)" for %px · 3a129cc2
      Adam Borowski 提交于
      Like %pK already does, print "00000000" instead.
      
      This confused people -- the convention is that "(null)" means you tried to
      dereference a null pointer as opposed to printing the address.
      
      Link: http://lkml.kernel.org/r/20180204174521.21383-1-kilobyte@angband.pl
      To: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
      To: Steven Rostedt <rostedt@goodmis.org>
      To: linux-kernel@vger.kernel.org
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Joe Perches <joe@perches.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: "Roberts, William C" <william.c.roberts@intel.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: David Laight <David.Laight@ACULAB.COM>
      Cc: Randy Dunlap <rdunlap@infradead.org>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: NAdam Borowski <kilobyte@angband.pl>
      Signed-off-by: NPetr Mladek <pmladek@suse.com>
      3a129cc2
  7. 07 2月, 2018 25 次提交
  8. 05 2月, 2018 1 次提交
    • Y
      bpf: fix selftests/bpf test_kmod.sh failure when CONFIG_BPF_JIT_ALWAYS_ON=y · 09584b40
      Yonghong Song 提交于
      With CONFIG_BPF_JIT_ALWAYS_ON is defined in the config file,
      tools/testing/selftests/bpf/test_kmod.sh failed like below:
        [root@localhost bpf]# ./test_kmod.sh
        sysctl: setting key "net.core.bpf_jit_enable": Invalid argument
        [ JIT enabled:0 hardened:0 ]
        [  132.175681] test_bpf: #297 BPF_MAXINSNS: Jump, gap, jump, ... FAIL to prog_create err=-524 len=4096
        [  132.458834] test_bpf: Summary: 348 PASSED, 1 FAILED, [340/340 JIT'ed]
        [ JIT enabled:1 hardened:0 ]
        [  133.456025] test_bpf: #297 BPF_MAXINSNS: Jump, gap, jump, ... FAIL to prog_create err=-524 len=4096
        [  133.730935] test_bpf: Summary: 348 PASSED, 1 FAILED, [340/340 JIT'ed]
        [ JIT enabled:1 hardened:1 ]
        [  134.769730] test_bpf: #297 BPF_MAXINSNS: Jump, gap, jump, ... FAIL to prog_create err=-524 len=4096
        [  135.050864] test_bpf: Summary: 348 PASSED, 1 FAILED, [340/340 JIT'ed]
        [ JIT enabled:1 hardened:2 ]
        [  136.442882] test_bpf: #297 BPF_MAXINSNS: Jump, gap, jump, ... FAIL to prog_create err=-524 len=4096
        [  136.821810] test_bpf: Summary: 348 PASSED, 1 FAILED, [340/340 JIT'ed]
        [root@localhost bpf]#
      
      The test_kmod.sh load/remove test_bpf.ko multiple times with different
      settings for sysctl net.core.bpf_jit_{enable,harden}. The failed test #297
      of test_bpf.ko is designed such that JIT always fails.
      
      Commit 290af866 (bpf: introduce BPF_JIT_ALWAYS_ON config)
      introduced the following tightening logic:
          ...
              if (!bpf_prog_is_dev_bound(fp->aux)) {
                      fp = bpf_int_jit_compile(fp);
          #ifdef CONFIG_BPF_JIT_ALWAYS_ON
                      if (!fp->jited) {
                              *err = -ENOTSUPP;
                              return fp;
                      }
          #endif
          ...
      With this logic, Test #297 always gets return value -ENOTSUPP
      when CONFIG_BPF_JIT_ALWAYS_ON is defined, causing the test failure.
      
      This patch fixed the failure by marking Test #297 as expected failure
      when CONFIG_BPF_JIT_ALWAYS_ON is defined.
      
      Fixes: 290af866 (bpf: introduce BPF_JIT_ALWAYS_ON config)
      Signed-off-by: NYonghong Song <yhs@fb.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      09584b40
  9. 02 2月, 2018 2 次提交
  10. 27 1月, 2018 2 次提交
  11. 24 1月, 2018 1 次提交
    • S
      vsprintf: Do not have bprintf dereference pointers · 841a915d
      Steven Rostedt (VMware) 提交于
      When trace_printk() was introduced, it was discussed that making it be as
      low overhead as possible, that the processing of the format string should be
      delayed until it is read. That is, a "trace_printk()" should not convert
      the %d into numbers and so on, but instead, save the fmt string and all the
      args in the buffer at the time of recording. When the trace_printk() data is
      read, it would then parse the format string and do the conversions of the
      saved arguments in the tracing buffer.
      
      The code to perform this was added to vsprintf where vbin_printf() would
      save the arguments of a specified format string in a buffer, then
      bstr_printf() could be used to convert the buffer with the same format
      string into the final output, as if vsprintf() was called in one go.
      
      The issue arises when dereferenced pointers are used. The problem is that
      something like %*pbl which reads a bitmask, will save the pointer to the
      bitmask in the buffer. Then the reading of the buffer via bstr_printf() will
      then look at the pointer to process the final output. Obviously the value of
      that pointer could have changed since the time it was recorded to the time
      the buffer is read. Worse yet, the bitmask could be unmapped, and the
      reading of the trace buffer could actually cause a kernel oops.
      
      Another problem is that user space tools such as perf and trace-cmd do not
      have access to the contents of these pointers, and they become useless when
      the tracing buffer is extracted.
      
      Instead of having vbin_printf() simply save the pointer in the buffer for
      later processing, have it perform the formatting at the time bin_printf() is
      called. This will fix the issue of dereferencing pointers at a later time,
      and has the extra benefit of having user space tools understand these
      values.
      
      Since perf and trace-cmd already can handle %p[sSfF] via saving kallsyms,
      their pointers are saved and not processed during vbin_printf(). If they
      were converted, it would break perf and trace-cmd, as they would not know
      how to deal with the conversion.
      
      Link: http://lkml.kernel.org/r/20171228204025.14a71d8f@gandalf.local.homeReported-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NSteven Rostedt (VMware) <rostedt@goodmis.org>
      841a915d