On Thu, Apr 24, 2025 at 01:28:00PM -0400, Steven Rostedt wrote:
> On Thu, 24 Apr 2025 18:36:07 +0200
> Peter Zijlstra <pet...@infradead.org> wrote:
> 
> > > +++ b/kernel/events/callchain.c
> > > @@ -246,22 +246,20 @@ get_perf_callchain(struct pt_regs *regs, bool 
> > > kernel, bool user,
> > >  
> > >   if (user) {
> > >           if (!user_mode(regs)) {
> > > -                 if  (current->mm)
> > > -                         regs = task_pt_regs(current);
> > > -                 else
> > > -                         regs = NULL;
> > > +                 if (!current->mm)
> > > +                         goto exit_put;
> > > +                 regs = task_pt_regs(current);  
> > 
> > I'm thinking this might be one of those is-kthread test written as
> > has-mm, and they're broken.
> > 
> > Notably things like the io-uring kthreads do have mm.
> 
> Would there ever be a case where:
> 
>       current->mm == NULL && !(current->flags & PF_KTHREAD)
> 
> ?
> 
> That is, do we still need to check for current->mm if it's not a kernel
> thread, or can we assume it exists?

IIRC just checking PF_KTHREAD should be sufficient.

Reply via email to