1. 25 Nov, 2022 7 commits
  2. 23 Nov, 2022 7 commits
  3. 22 Nov, 2022 4 commits
    • Jens Axboe's avatar
      io_uring: kill io_cqring_ev_posted() and __io_cq_unlock_post() · 6c16fe3c
      Jens Axboe authored
      __io_cq_unlock_post() is identical to io_cq_unlock_post(), and
      io_cqring_ev_posted() has a single caller so migth as well just inline
      it there.
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      6c16fe3c
    • Jens Axboe's avatar
      Revert "io_uring: disallow self-propelled ring polling" · 4061f0ef
      Jens Axboe authored
      This reverts commit 7fdbc5f0.
      
      This patch dealt with a subset of the real problem, which is a potential
      circular dependency on the wakup path for io_uring itself. Outside of
      io_uring, eventfd can also trigger this (see details in 03e02acd)
      and so can epoll (see details in caf1aeaf). Now that we have a
      generic solution to this problem, get rid of the io_uring specific
      work-around.
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      4061f0ef
    • Jens Axboe's avatar
      io_uring: pass in EPOLL_URING_WAKE for eventfd signaling and wakeups · 44648532
      Jens Axboe authored
      Pass in EPOLL_URING_WAKE when signaling eventfd or doing poll related
      wakups, so that we can check for a circular event dependency between
      eventfd and epoll. If this flag is set when our wakeup handlers are
      called, then we know we have a dependency that needs to terminate
      multishot requests.
      
      eventfd and epoll are the only such possible dependencies.
      
      Cc: stable@vger.kernel.org # 6.0
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      44648532
    • Jens Axboe's avatar
      eventfd: provide a eventfd_signal_mask() helper · 03e02acd
      Jens Axboe authored
      This is identical to eventfd_signal(), but it allows the caller to pass
      in a mask to be used for the poll wakeup key. The use case is avoiding
      repeated multishot triggers if we have a dependency between eventfd and
      io_uring.
      
      If we setup an eventfd context and register that as the io_uring eventfd,
      and at the same time queue a multishot poll request for the eventfd
      context, then any CQE posted will repeatedly trigger the multishot request
      until it terminates when the CQ ring overflows.
      
      In preparation for io_uring detecting this circular dependency, add the
      mentioned helper so that io_uring can pass in EPOLL_URING as part of the
      poll wakeup key.
      
      Cc: stable@vger.kernel.org # 6.0
      [axboe: fold in !CONFIG_EVENTFD fix from Zhang Qilong]
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      03e02acd
  4. 21 Nov, 2022 19 commits
  5. 20 Nov, 2022 3 commits
    • Linus Torvalds's avatar
      Merge tag 'trace-probes-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace · c6c67bf9
      Linus Torvalds authored
      Pull tracing/probes fixes from Steven Rostedt:
      
       - Fix possible NULL pointer dereference on trace_event_file in
         kprobe_event_gen_test_exit()
      
       - Fix NULL pointer dereference for trace_array in
         kprobe_event_gen_test_exit()
      
       - Fix memory leak of filter string for eprobes
      
       - Fix a possible memory leak in rethook_alloc()
      
       - Skip clearing aggrprobe's post_handler in kprobe-on-ftrace case which
         can cause a possible use-after-free
      
       - Fix warning in eprobe filter creation
      
       - Fix eprobe filter creation as it picked the wrong event for the
         fields
      
      * tag 'trace-probes-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
        tracing/eprobe: Fix eprobe filter to make a filter correctly
        tracing/eprobe: Fix warning in filter creation
        kprobes: Skip clearing aggrprobe's post_handler in kprobe-on-ftrace case
        rethook: fix a potential memleak in rethook_alloc()
        tracing/eprobe: Fix memory leak of filter string
        tracing: kprobe: Fix potential null-ptr-deref on trace_array in kprobe_event_gen_test_exit()
        tracing: kprobe: Fix potential null-ptr-deref on trace_event_file in kprobe_event_gen_test_exit()
      c6c67bf9
    • Linus Torvalds's avatar
      Merge tag 'trace-v6.1-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace · 5239ddeb
      Linus Torvalds authored
      Pull tracing fixes from Steven Rostedt:
      
       - Fix polling to block on watermark like the reads do, as user space
         applications get confused when the select says read is available, and
         then the read blocks
      
       - Fix accounting of ring buffer dropped pages as it is what is used to
         determine if the buffer is empty or not
      
       - Fix memory leak in tracing_read_pipe()
      
       - Fix struct trace_array warning about being declared in parameters
      
       - Fix accounting of ftrace pages used in output at start up.
      
       - Fix allocation of dyn_ftrace pages by subtracting one from order
         instead of diving it by 2
      
       - Static analyzer found a case were a pointer being used outside of a
         NULL check (rb_head_page_deactivate())
      
       - Fix possible NULL pointer dereference if kstrdup() fails in
         ftrace_add_mod()
      
       - Fix memory leak in test_gen_synth_cmd() and test_empty_synth_event()
      
       - Fix bad pointer dereference in register_synth_event() on error path
      
       - Remove unused __bad_type_size() method
      
       - Fix possible NULL pointer dereference of entry in list 'tr->err_log'
      
       - Fix NULL pointer deference race if eprobe is called before the event
         setup
      
      * tag 'trace-v6.1-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
        tracing: Fix race where eprobes can be called before the event
        tracing: Fix potential null-pointer-access of entry in list 'tr->err_log'
        tracing: Remove unused __bad_type_size() method
        tracing: Fix wild-memory-access in register_synth_event()
        tracing: Fix memory leak in test_gen_synth_cmd() and test_empty_synth_event()
        ftrace: Fix null pointer dereference in ftrace_add_mod()
        ring_buffer: Do not deactivate non-existant pages
        ftrace: Optimize the allocation for mcount entries
        ftrace: Fix the possible incorrect kernel message
        tracing: Fix warning on variable 'struct trace_array'
        tracing: Fix memory leak in tracing_read_pipe()
        ring-buffer: Include dropped pages in counting dirty patches
        tracing/ring-buffer: Have polling block on watermark
      5239ddeb
    • Steven Rostedt (Google)'s avatar
      tracing: Fix race where eprobes can be called before the event · 94eedf3d
      Steven Rostedt (Google) authored
      The flag that tells the event to call its triggers after reading the event
      is set for eprobes after the eprobe is enabled. This leads to a race where
      the eprobe may be triggered at the beginning of the event where the record
      information is NULL. The eprobe then dereferences the NULL record causing
      a NULL kernel pointer bug.
      
      Test for a NULL record to keep this from happening.
      
      Link: https://lore.kernel.org/linux-trace-kernel/20221116192552.1066630-1-rafaelmendsr@gmail.com/
      Link: https://lore.kernel.org/linux-trace-kernel/20221117214249.2addbe10@gandalf.local.home
      
      Cc: Linux Trace Kernel <linux-trace-kernel@vger.kernel.org>
      Cc: Tzvetomir Stoyanov <tz.stoyanov@gmail.com>
      Cc: Tom Zanussi <zanussi@kernel.org>
      Cc: stable@vger.kernel.org
      Fixes: 7491e2c4 ("tracing: Add a probe that attaches to trace events")
      Acked-by: default avatarMasami Hiramatsu (Google) <mhiramat@kernel.org>
      Reported-by: default avatarRafael Mendonca <rafaelmendsr@gmail.com>
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      94eedf3d