1. 10 Apr, 2022 4 commits
    • Jakub Kicinski's avatar
      tls: rx: simplify async wait · 37943f04
      Jakub Kicinski authored
      Since we are protected from async completions by decrypt_compl_lock
      we can drop the async_notify and reinit the completion before we
      start waiting.
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      37943f04
    • Jakub Kicinski's avatar
      tls: rx: wrap decryption arguments in a structure · 4175eac3
      Jakub Kicinski authored
      We pass zc as a pointer to bool a few functions down as an in/out
      argument. This is error prone since C will happily evalue a pointer
      as a boolean (IOW forgetting *zc and writing zc leads to loss of
      developer time..). Wrap the arguments into a structure.
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4175eac3
    • Jakub Kicinski's avatar
      tls: rx: don't report text length from the bowels of decrypt · 9bdf75cc
      Jakub Kicinski authored
      We plumb pointer to chunk all the way to the decryption method.
      It's set to the length of the text when decrypt_skb_update()
      returns.
      
      I think the code is written this way because original TLS
      implementation passed &chunk to zerocopy_from_iter() and this
      was carried forward as the code gotten more complex, without
      any refactoring.
      
      The fix for peek() introduced a new variable - to_decrypt
      which for all practical purposes is what chunk is going to
      get set to. Spare ourselves the pointer passing, use to_decrypt.
      
      Use this opportunity to clean things up a little further.
      
      Note that chunk / to_decrypt was mostly needed for the async
      path, since the sync path would access rxm->full_len (decryption
      transforms full_len from record size to text size). Use the
      right source of truth more explicitly.
      
      We have three cases:
       - async - it's TLS 1.2 only, so chunk == to_decrypt, but we
                 need the min() because to_decrypt is a whole record
      	   and we don't want to underflow len. Note that we can't
      	   handle partial record by falling back to sync as it
      	   would introduce reordering against records in flight.
       - zc - again, TLS 1.2 only for now, so chunk == to_decrypt,
              we don't do zc if len < to_decrypt, no need to check again.
       - normal - it already handles chunk > len, we can factor out the
                  assignment to rxm->full_len and share it with zc.
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9bdf75cc
    • Jakub Kicinski's avatar
      tls: rx: drop unnecessary arguments from tls_setup_from_iter() · d4bd88e6
      Jakub Kicinski authored
      sk is unused, remove it to make it clear the function
      doesn't poke at the socket.
      
      size_used is always 0 on input and @length on success.
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d4bd88e6
  2. 09 Apr, 2022 2 commits
    • Colin Foster's avatar
      net: mdio: mscc-miim: add local dev variable to cleanup probe function · 626a5aaa
      Colin Foster authored
      Create a local device *dev in order to not dereference the platform_device
      several times throughout the probe function.
      Signed-off-by: default avatarColin Foster <colin.foster@in-advantage.com>
      Reviewed-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      626a5aaa
    • Jakub Kicinski's avatar
      Merge https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next · 34ba23b4
      Jakub Kicinski authored
      Daniel Borkmann says:
      
      ====================
      pull-request: bpf-next 2022-04-09
      
      We've added 63 non-merge commits during the last 9 day(s) which contain
      a total of 68 files changed, 4852 insertions(+), 619 deletions(-).
      
      The main changes are:
      
      1) Add libbpf support for USDT (User Statically-Defined Tracing) probes.
         USDTs are an abstraction built on top of uprobes, critical for tracing
         and BPF, and widely used in production applications, from Andrii Nakryiko.
      
      2) While Andrii was adding support for x86{-64}-specific logic of parsing
         USDT argument specification, Ilya followed-up with USDT support for s390
         architecture, from Ilya Leoshkevich.
      
      3) Support name-based attaching for uprobe BPF programs in libbpf. The format
         supported is `u[ret]probe/binary_path:[raw_offset|function[+offset]]`, e.g.
         attaching to libc malloc can be done in BPF via SEC("uprobe/libc.so.6:malloc")
         now, from Alan Maguire.
      
      4) Various load/store optimizations for the arm64 JIT to shrink the image
         size by using arm64 str/ldr immediate instructions. Also enable pointer
         authentication to verify return address for JITed code, from Xu Kuohai.
      
      5) BPF verifier fixes for write access checks to helper functions, e.g.
         rd-only memory from bpf_*_cpu_ptr() must not be passed to helpers that
         write into passed buffers, from Kumar Kartikeya Dwivedi.
      
      6) Fix overly excessive stack map allocation for its base map structure and
         buckets which slipped-in from cleanups during the rlimit accounting removal
         back then, from Yuntao Wang.
      
      7) Extend the unstable CT lookup helpers for XDP and tc/BPF to report netfilter
         connection tracking tuple direction, from Lorenzo Bianconi.
      
      8) Improve bpftool dump to show BPF program/link type names, Milan Landaverde.
      
      9) Minor cleanups all over the place from various others.
      
      * https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next: (63 commits)
        bpf: Fix excessive memory allocation in stack_map_alloc()
        selftests/bpf: Fix return value checks in perf_event_stackmap test
        selftests/bpf: Add CO-RE relos into linked_funcs selftests
        libbpf: Use weak hidden modifier for USDT BPF-side API functions
        libbpf: Don't error out on CO-RE relos for overriden weak subprogs
        samples, bpf: Move routes monitor in xdp_router_ipv4 in a dedicated thread
        libbpf: Allow WEAK and GLOBAL bindings during BTF fixup
        libbpf: Use strlcpy() in path resolution fallback logic
        libbpf: Add s390-specific USDT arg spec parsing logic
        libbpf: Make BPF-side of USDT support work on big-endian machines
        libbpf: Minor style improvements in USDT code
        libbpf: Fix use #ifdef instead of #if to avoid compiler warning
        libbpf: Potential NULL dereference in usdt_manager_attach_usdt()
        selftests/bpf: Uprobe tests should verify param/return values
        libbpf: Improve string parsing for uprobe auto-attach
        libbpf: Improve library identification for uprobe binary path resolution
        selftests/bpf: Test for writes to map key from BPF helpers
        selftests/bpf: Test passing rdonly mem to global func
        bpf: Reject writes for PTR_TO_MAP_KEY in check_helper_mem_access
        bpf: Check PTR_TO_MEM | MEM_RDONLY in check_helper_mem_access
        ...
      ====================
      
      Link: https://lore.kernel.org/r/20220408231741.19116-1-daniel@iogearbox.netSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      34ba23b4
  3. 08 Apr, 2022 34 commits