Skip to content
  1. May 11, 2015
    • Nicolas Schichan's avatar
      ARM: net: delegate filter to kernel interpreter when imm_offset() return value... · 0b59d880
      Nicolas Schichan authored
      
      ARM: net: delegate filter to kernel interpreter when imm_offset() return value can't fit into 12bits.
      
      The ARM JIT code emits "ldr rX, [pc, #offset]" to access the literal
      pool. #offset maximum value is 4095 and if the generated code is too
      large, the #offset value can overflow and not point to the expected
      slot in the literal pool. Additionally, when overflow occurs, bits of
      the overflow can end up changing the destination register of the ldr
      instruction.
      
      Fix that by detecting the overflow in imm_offset() and setting a flag
      that is checked for each BPF instructions converted in
      build_body(). As of now it can only be detected in the second pass. As
      a result the second build_body() call can now fail, so add the
      corresponding cleanup code in that case.
      
      Using multiple literal pools in the JITed code is going to require
      lots of intrusive changes to the JIT code (which would better be done
      as a feature instead of fix), just delegating to the kernel BPF
      interpreter in that case is a more straight forward, minimal fix and
      easy to backport.
      
      Fixes: ddecdfce ("ARM: 7259/3: net: JIT compiler for packet filters")
      Signed-off-by: default avatarNicolas Schichan <nschichan@freebox.fr>
      Acked-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0b59d880
    • Nicolas Schichan's avatar
      ARM: net fix emit_udiv() for BPF_ALU | BPF_DIV | BPF_K intruction. · 19fc99d0
      Nicolas Schichan authored
      
      
      In that case, emit_udiv() will be called with rn == ARM_R0 (r_scratch)
      and loading rm first into ARM_R0 will result in jit_udiv() function
      being called the same dividend and divisor. Fix that by loading rn
      first into ARM_R1 and then rm into ARM_R0.
      
      Signed-off-by: default avatarNicolas Schichan <nschichan@freebox.fr>
      Cc: <stable@vger.kernel.org> # v3.13+
      Fixes: aee636c4 (bpf: do not use reciprocal divide)
      Acked-by: default avatarMircea Gherzan <mgherzan@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      19fc99d0
  2. May 10, 2015
  3. May 07, 2015
  4. May 06, 2015
  5. May 05, 2015
  6. May 04, 2015