1. 30 6月, 2017 1 次提交
    • D
      bpf: prevent leaking pointer via xadd on unpriviledged · 6bdf6abc
      Daniel Borkmann 提交于
      Leaking kernel addresses on unpriviledged is generally disallowed,
      for example, verifier rejects the following:
      
        0: (b7) r0 = 0
        1: (18) r2 = 0xffff897e82304400
        3: (7b) *(u64 *)(r1 +48) = r2
        R2 leaks addr into ctx
      
      Doing pointer arithmetic on them is also forbidden, so that they
      don't turn into unknown value and then get leaked out. However,
      there's xadd as a special case, where we don't check the src reg
      for being a pointer register, e.g. the following will pass:
      
        0: (b7) r0 = 0
        1: (7b) *(u64 *)(r1 +48) = r0
        2: (18) r2 = 0xffff897e82304400 ; map
        4: (db) lock *(u64 *)(r1 +48) += r2
        5: (95) exit
      
      We could store the pointer into skb->cb, loose the type context,
      and then read it out from there again to leak it eventually out
      of a map value. Or more easily in a different variant, too:
      
         0: (bf) r6 = r1
         1: (7a) *(u64 *)(r10 -8) = 0
         2: (bf) r2 = r10
         3: (07) r2 += -8
         4: (18) r1 = 0x0
         6: (85) call bpf_map_lookup_elem#1
         7: (15) if r0 == 0x0 goto pc+3
         R0=map_value(ks=8,vs=8,id=0),min_value=0,max_value=0 R6=ctx R10=fp
         8: (b7) r3 = 0
         9: (7b) *(u64 *)(r0 +0) = r3
        10: (db) lock *(u64 *)(r0 +0) += r6
        11: (b7) r0 = 0
        12: (95) exit
      
        from 7 to 11: R0=inv,min_value=0,max_value=0 R6=ctx R10=fp
        11: (b7) r0 = 0
        12: (95) exit
      
      Prevent this by checking xadd src reg for pointer types. Also
      add a couple of test cases related to this.
      
      Fixes: 1be7f75d ("bpf: enable non-root eBPF programs")
      Fixes: 17a52670 ("bpf: verifier (add verifier core)")
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NAlexei Starovoitov <ast@kernel.org>
      Acked-by: NMartin KaFai Lau <kafai@fb.com>
      Acked-by: NEdward Cree <ecree@solarflare.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6bdf6abc
  2. 20 6月, 2017 1 次提交
  3. 09 6月, 2017 10 次提交
    • P
      rcu: Remove RCU CPU stall warnings from Tiny RCU · 6d48152e
      Paul E. McKenney 提交于
      Tiny RCU's job is to be tiny, so this commit removes its RCU CPU
      stall warning code.  After this, there is no longer any need for
      rcu_sched_ctrlblk and rcu_bh_ctrlblk to be in tiny_plugin.h, so this
      commit also moves them to tiny.c.
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      6d48152e
    • P
      rcu: Eliminate NOCBs CPU-state Kconfig options · 44c65ff2
      Paul E. McKenney 提交于
      The CONFIG_RCU_NOCB_CPU_ALL, CONFIG_RCU_NOCB_CPU_NONE, and
      CONFIG_RCU_NOCB_CPU_ZERO Kconfig options are used only in testing and
      are redundant with the rcu_nocbs= boot parameter.  This commit therefore
      removes these three Kconfig options and adjusts the rcutorture scripts
      to use the boot parameter instead.
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      44c65ff2
    • P
      rcu: Remove debugfs tracing · ae91aa0a
      Paul E. McKenney 提交于
      RCU's debugfs tracing used to be the only reasonable low-level debug
      information available, but ftrace and event tracing has since surpassed
      the RCU debugfs level of usefulness.  This commit therefore removes
      RCU's debugfs tracing.
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      ae91aa0a
    • P
      srcu: Remove Classic SRCU · bd8cc5a0
      Paul E. McKenney 提交于
      Classic SRCU was only ever intended to be a fallback in case of issues
      with Tree/Tiny SRCU, and the latter two are doing quite well in testing.
      This commit therefore removes Classic SRCU.
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      bd8cc5a0
    • P
      rcu: Remove SPARSE_RCU_POINTER Kconfig option · 41a2901e
      Paul E. McKenney 提交于
      The sparse-based checking for non-RCU accesses to RCU-protected pointers
      has been around for a very long time, and it is now the only type of
      sparse-based checking that is optional.  This commit therefore makes
      it unconditional.
      Reported-by: NIngo Molnar <mingo@kernel.org>
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Fengguang Wu <fengguang.wu@intel.com>
      41a2901e
    • P
      rcu: Remove the now-obsolete PROVE_RCU_REPEATEDLY Kconfig option · c4a09ff7
      Paul E. McKenney 提交于
      The PROVE_RCU_REPEATEDLY Kconfig option was initially added due to
      the volume of messages from PROVE_RCU: Doing just one per boot would
      have required excessive numbers of boots to locate them all.  However,
      PROVE_RCU messages are now relatively rare, so there is no longer any
      reason to need more than one such message per boot.  This commit therefore
      removes the PROVE_RCU_REPEATEDLY Kconfig option.
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      c4a09ff7
    • P
      rcu: Remove nohz_full full-system-idle state machine · fe5ac724
      Paul E. McKenney 提交于
      The NO_HZ_FULL_SYSIDLE full-system-idle capability was added in 2013
      by commit 0edd1b17 ("nohz_full: Add full-system-idle state machine"),
      but has not been used.  This commit therefore removes it.
      
      If it turns out to be needed later, this commit can always be reverted.
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Acked-by: NLinus Torvalds <torvalds@linux-foundation.org>
      fe5ac724
    • P
      rcu: Remove the RCU_KTHREAD_PRIO Kconfig option · f7a10a97
      Paul E. McKenney 提交于
      Anything that can be done with the RCU_KTHREAD_PRIO Kconfig option can
      also be done with the rcutree.kthread_prio kernel boot parameter.
      This commit therefore removes this Kconfig option.
      Reported-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Rik van Riel <riel@redhat.com>
      f7a10a97
    • P
      rcu: Remove *_SLOW_* Kconfig options · 90040c9e
      Paul E. McKenney 提交于
      The RCU_TORTURE_TEST_SLOW_PREINIT, RCU_TORTURE_TEST_SLOW_PREINIT_DELAY,
      RCU_TORTURE_TEST_SLOW_PREINIT_DELAY, RCU_TORTURE_TEST_SLOW_INIT,
      RCU_TORTURE_TEST_SLOW_INIT_DELAY, RCU_TORTURE_TEST_SLOW_CLEANUP,
      and RCU_TORTURE_TEST_SLOW_CLEANUP_DELAY Kconfig options are only
      useful for torture testing, and there are the rcutree.gp_cleanup_delay,
      rcutree.gp_init_delay, and rcutree.gp_preinit_delay kernel boot parameters
      that rcutorture can use instead.  The effect of these parameters is to
      artificially slow down grace period initialization and cleanup in order
      to make some types of race conditions happen more often.
      
      This commit therefore simplifies Tree RCU a bit by removing the Kconfig
      options and adding the corresponding kernel parameters to rcutorture's
      .boot files instead.  However, this commit also leaves out the kernel
      parameters for TREE02, TREE04, and TREE07 in order to have about the
      same number of tests slowed as not slowed.  TREE01, TREE03, TREE05,
      and TREE06 are slowed, and the rest are not slowed.
      Reported-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      90040c9e
    • D
      bpf, tests: fix endianness selection · 78a5a93c
      Daniel Borkmann 提交于
      I noticed that test_l4lb was failing in selftests:
      
        # ./test_progs
        test_pkt_access:PASS:ipv4 77 nsec
        test_pkt_access:PASS:ipv6 44 nsec
        test_xdp:PASS:ipv4 2933 nsec
        test_xdp:PASS:ipv6 1500 nsec
        test_l4lb:PASS:ipv4 377 nsec
        test_l4lb:PASS:ipv6 544 nsec
        test_l4lb:FAIL:stats 6297600000 200000
        test_tcp_estats:PASS: 0 nsec
        Summary: 7 PASSED, 1 FAILED
      
      Tracking down the issue actually revealed that endianness selection
      in bpf_endian.h is broken when compiled with clang with bpf target.
      test_pkt_access.c, test_l4lb.c is compiled with __BYTE_ORDER as
      __BIG_ENDIAN, test_xdp.c as __LITTLE_ENDIAN! test_l4lb noticeably
      fails, because the test accounts bytes via bpf_ntohs(ip6h->payload_len)
      and bpf_ntohs(iph->tot_len), and compares them against a defined
      value and given a wrong endianness, the test outcome is different,
      of course.
      
      Turns out that there are actually two bugs: i) when we do __BYTE_ORDER
      comparison with __LITTLE_ENDIAN/__BIG_ENDIAN, then depending on the
      include order we see different outcomes. Reason is that __BYTE_ORDER
      is undefined due to missing endian.h include. Before we include the
      asm/byteorder.h (e.g. through linux/in.h), then __BYTE_ORDER equals
      __LITTLE_ENDIAN since both are undefined, after the include which
      correctly pulls in linux/byteorder/little_endian.h, __LITTLE_ENDIAN
      is defined, but given __BYTE_ORDER is still undefined, we match on
      __BYTE_ORDER equals to __BIG_ENDIAN since __BIG_ENDIAN is also
      undefined at that point, sigh. ii) But even that would be wrong,
      since when compiling the test cases with clang, one can select between
      bpfeb and bpfel targets for cross compilation. Hence, we can also not
      rely on what the system's endian.h provides, but we need to look at
      the compiler's defined endianness. The compiler defines __BYTE_ORDER__,
      and we can match __ORDER_LITTLE_ENDIAN__ and __ORDER_BIG_ENDIAN__,
      which also reflects targets bpf (native), bpfel, bpfeb correctly,
      thus really only rely on that. After patch:
      
        # ./test_progs
        test_pkt_access:PASS:ipv4 74 nsec
        test_pkt_access:PASS:ipv6 42 nsec
        test_xdp:PASS:ipv4 2340 nsec
        test_xdp:PASS:ipv6 1461 nsec
        test_l4lb:PASS:ipv4 400 nsec
        test_l4lb:PASS:ipv6 530 nsec
        test_tcp_estats:PASS: 0 nsec
        Summary: 7 PASSED, 0 FAILED
      
      Fixes: 43bcf707 ("bpf: fix _htons occurences in test_progs")
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      78a5a93c
  4. 08 6月, 2017 13 次提交
  5. 07 6月, 2017 1 次提交
  6. 27 5月, 2017 1 次提交
  7. 26 5月, 2017 1 次提交
  8. 19 5月, 2017 1 次提交
    • M
      selftests/powerpc: Fix TM resched DSCR test with some compilers · fe06fe86
      Michael Ellerman 提交于
      The tm-resched-dscr test has started failing sometimes, depending on
      what compiler it's built with, eg:
      
        test: tm_resched_dscr
        Check DSCR TM context switch: tm-resched-dscr: tm-resched-dscr.c:76: test_body: Assertion `rv' failed.
        !! child died by signal 6
      
      When it fails we see that the compiler doesn't initialise rv to 1 before
      entering the inline asm block. Although that's counter intuitive, it
      is allowed because we tell the compiler that the inline asm will write
      to rv (using "=r"), meaning the original value is irrelevant.
      
      Marking it as a read/write parameter would presumably work, but it seems
      simpler to fix it by setting the initial value of rv in the inline asm.
      
      Fixes: 96d01610 ("powerpc: Correct DSCR during TM context switch")
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Acked-by: NMichael Neuling <mikey@neuling.org>
      fe06fe86
  9. 18 5月, 2017 3 次提交
  10. 16 5月, 2017 1 次提交
  11. 12 5月, 2017 4 次提交
  12. 09 5月, 2017 1 次提交
  13. 04 5月, 2017 2 次提交