lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzbyqNAPrOR7cR+2PKCy+cXoEftWufFbhMv73QPFZM+ysw@mail.gmail.com>
Date: Tue, 15 Apr 2025 16:14:01 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Masami Hiramatsu <mhiramat@...nel.org>
Cc: Menglong Dong <menglong8.dong@...il.com>, rostedt@...dmis.org, mark.rutland@....com, 
	mathieu.desnoyers@...icios.com, linux-kernel@...r.kernel.org, 
	linux-trace-kernel@...r.kernel.org, bpf@...r.kernel.org, 
	Menglong Dong <dongml2@...natelecom.cn>
Subject: Re: [PATCH bpf v2] ftrace: fix incorrect hash size in register_ftrace_direct()

On Mon, Apr 14, 2025 at 12:05 AM Masami Hiramatsu <mhiramat@...nel.org> wrote:
>
> On Sun, 13 Apr 2025 09:44:44 +0800
> Menglong Dong <menglong8.dong@...il.com> wrote:
>
> > The maximum of the ftrace hash bits is made fls(32) in
> > register_ftrace_direct(), which seems illogical. So, we fix it by making
> > the max hash bits FTRACE_HASH_MAX_BITS instead.
> >
>
> Loogs good to me.
>
> Acked-by: Masami Hiramatsu (Google) <mhiramat@...nel.org>
>
> Thanks!
>

I'm a bit confused by the "[PATCH bpf]" prefix... This fix doesn't
seem to be BPF-related, so I'm not sure why it would go through the
bpf tree. I presume Masami or Steven will route it through their tree,
is that right?


> > Fixes: d05cb470663a ("ftrace: Fix modification of direct_function hash while in use")
> > Signed-off-by: Menglong Dong <dongml2@...natelecom.cn>
> > ---
> > v2:
> > - thanks for Steven's advice, we fix the problem by making the max hash
> >   bits FTRACE_HASH_MAX_BITS instead.
> > ---
> >  kernel/trace/ftrace.c | 7 ++++---
> >  1 file changed, 4 insertions(+), 3 deletions(-)
> >
> > diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> > index 1a48aedb5255..d153ad13e0e0 100644
> > --- a/kernel/trace/ftrace.c
> > +++ b/kernel/trace/ftrace.c
> > @@ -5914,9 +5914,10 @@ int register_ftrace_direct(struct ftrace_ops *ops, unsigned long addr)
> >
> >       /* Make a copy hash to place the new and the old entries in */
> >       size = hash->count + direct_functions->count;
> > -     if (size > 32)
> > -             size = 32;
> > -     new_hash = alloc_ftrace_hash(fls(size));
> > +     size = fls(size);
> > +     if (size > FTRACE_HASH_MAX_BITS)
> > +             size = FTRACE_HASH_MAX_BITS;
> > +     new_hash = alloc_ftrace_hash(size);
> >       if (!new_hash)
> >               goto out_unlock;
> >
> > --
> > 2.39.5
> >
> >
>
>
> --
> Masami Hiramatsu (Google) <mhiramat@...nel.org>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ