1. 22 5月, 2018 1 次提交
  2. 19 5月, 2018 7 次提交
    • D
      Merge branch 'bpf-sk-msg-fields' · d849f9f9
      Daniel Borkmann 提交于
      John Fastabend says:
      
      ====================
      In this series we add the ability for sk msg programs to read basic
      sock information about the sock they are attached to. The second
      patch adds the tests to the selftest test_verifier.
      
      One observation that I had from writing this seriess is lots of the
      ./net/core/filter.c code is almost duplicated across program types.
      I thought about building a template/macro that we could use as a
      single block of code to read sock data out for multiple programs,
      but I wasn't convinced it was worth it yet. The result was using a
      macro saved a couple lines of code per block but made the code
      a bit harder to read IMO. We can probably revisit the idea later
      if we get more duplication.
      
      v2: add errstr field to negative test_verifier test cases to ensure
          we get the expected err string back from the verifier.
      ====================
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      d849f9f9
    • J
      bpf: add sk_msg prog sk access tests to test_verifier · 4da0dcab
      John Fastabend 提交于
      Add tests for BPF_PROG_TYPE_SK_MSG to test_verifier for read access
      to new sk fields.
      Signed-off-by: NJohn Fastabend <john.fastabend@gmail.com>
      Acked-by: NMartin KaFai Lau <kafai@fb.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      4da0dcab
    • J
      bpf: allow sk_msg programs to read sock fields · 303def35
      John Fastabend 提交于
      Currently sk_msg programs only have access to the raw data. However,
      it is often useful when building policies to have the policies specific
      to the socket endpoint. This allows using the socket tuple as input
      into filters, etc.
      
      This patch adds ctx access to the sock fields.
      Signed-off-by: NJohn Fastabend <john.fastabend@gmail.com>
      Acked-by: NMartin KaFai Lau <kafai@fb.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      303def35
    • D
      Merge branch 'bpf-nfp-shift-insns' · 1cb61381
      Daniel Borkmann 提交于
      Jiong Wang says:
      
      ====================
      NFP eBPF JIT is missing logic indirect shifts (both left and right) and
      arithmetic right shift (both indirect shift and shift by constant).
      
      This patch adds support for them.
      
      For indirect shifts, shift amount is not specified as constant, NFP needs
      to get the shift amount through the low 5 bits of source A operand in
      PREV_ALU, therefore extra instructions are needed compared with shifts by
      constants.
      
      Because NFP is 32-bit, so we are using register pair for 64-bit shifts and
      therefore would need different instruction sequences depending on whether
      shift amount is less than 32 or not.
      
      NFP branch-on-bit-test instruction emitter is added by this patch set and
      is used for efficient runtime check on shift amount. We'd think the shift
      amount is less than 32 if bit 5 is clear and greater or equal then 32
      otherwise. Shift amount is greater than or equal to 64 will result in
      undefined behavior.
      
      This patch also use range info to avoid generating unnecessary runtime code
      if we are certain shift amount is less than 32 or not.
      ====================
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      1cb61381
    • J
      nfp: bpf: support arithmetic indirect right shift (BPF_ARSH | BPF_X) · c217abcc
      Jiong Wang 提交于
      Code logic is similar with arithmetic right shift by constant, and NFP
      get indirect shift amount through source A operand of PREV_ALU.
      
      It is possible to fall back to logic right shift if the MSB is known to be
      zero from range info, however there is no benefit to do this given logic
      indirect right shift use the same number and cycle of instruction sequence.
      
      Suppose the MSB of regX is the bit we want to replicate to fill in all the
      vacant positions, and regY contains the shift amount, then we could use
      single instruction to set up both.
      
        [alu, --, regY, OR, regX]
      
        --
        NOTE: the PREV_ALU result doesn't need to write to any destination
              register.
      Signed-off-by: NJiong Wang <jiong.wang@netronome.com>
      Reviewed-by: NJakub Kicinski <jakub.kicinski@netronome.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      c217abcc
    • J
      nfp: bpf: support arithmetic right shift by constant (BPF_ARSH | BPF_K) · f43d0f17
      Jiong Wang 提交于
      Code logic is similar with logic right shift except we also need to set
      PREV_ALU result properly, the MSB of which is the bit that will be
      replicated to fill in all the vacant positions.
      Signed-off-by: NJiong Wang <jiong.wang@netronome.com>
      Reviewed-by: NJakub Kicinski <jakub.kicinski@netronome.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      f43d0f17
    • J
      nfp: bpf: support logic indirect shifts (BPF_[L|R]SH | BPF_X) · 991f5b36
      Jiong Wang 提交于
      For indirect shifts, shift amount is not specified as constant, NFP needs
      to get the shift amount through the low 5 bits of source A operand in
      PREV_ALU, therefore extra instructions are needed compared with shifts by
      constants.
      
      Because NFP is 32-bit, so we are using register pair for 64-bit shifts and
      therefore would need different instruction sequences depending on whether
      shift amount is less than 32 or not.
      
      NFP branch-on-bit-test instruction emitter is added by this patch and is
      used for efficient runtime check on shift amount. We'd think the shift
      amount is less than 32 if bit 5 is clear and greater or equal than 32
      otherwise. Shift amount is greater than or equal to 64 will result in
      undefined behavior.
      
      This patch also use range info to avoid generating unnecessary runtime code
      if we are certain shift amount is less than 32 or not.
      Signed-off-by: NJiong Wang <jiong.wang@netronome.com>
      Reviewed-by: NJakub Kicinski <jakub.kicinski@netronome.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      991f5b36
  3. 18 5月, 2018 7 次提交
  4. 17 5月, 2018 25 次提交