Skip to content
  1. Sep 30, 2022
    • Martin KaFai Lau's avatar
      bpf: Add __bpf_prog_{enter,exit}_struct_ops for struct_ops trampoline · 64696c40
      Martin KaFai Lau authored
      
      
      The struct_ops prog is to allow using bpf to implement the functions in
      a struct (eg. kernel module).  The current usage is to implement the
      tcp_congestion.  The kernel does not call the tcp-cc's ops (ie.
      the bpf prog) in a recursive way.
      
      The struct_ops is sharing the tracing-trampoline's enter/exit
      function which tracks prog->active to avoid recursion.  It is
      needed for tracing prog.  However, it turns out the struct_ops
      bpf prog will hit this prog->active and unnecessarily skipped
      running the struct_ops prog.  eg.  The '.ssthresh' may run in_task()
      and then interrupted by softirq that runs the same '.ssthresh'.
      Skip running the '.ssthresh' will end up returning random value
      to the caller.
      
      The patch adds __bpf_prog_{enter,exit}_struct_ops for the
      struct_ops trampoline.  They do not track the prog->active
      to detect recursion.
      
      One exception is when the tcp_congestion's '.init' ops is doing
      bpf_setsockopt(TCP_CONGESTION) and then recurs to the same
      '.init' ops.  This will be addressed in the following patches.
      
      Fixes: ca06f55b ("bpf: Add per-program recursion prevention mechanism")
      Signed-off-by: default avatarMartin KaFai Lau <martin.lau@kernel.org>
      Link: https://lore.kernel.org/r/20220929070407.965581-2-martin.lau@linux.dev
      
      
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      64696c40
  2. Sep 29, 2022
  3. Sep 28, 2022
  4. Sep 27, 2022
  5. Sep 26, 2022
  6. Sep 24, 2022