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: <CADxym3bAy4aV=UJU9ge0vw055C2DzC=zubjhOBSay_88CkW+hQ@mail.gmail.com>
Date: Sat, 12 Apr 2025 22:32:45 +0800
From: Menglong Dong <menglong8.dong@...il.com>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: mhiramat@...nel.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] ftrace: fix incorrect hash size in register_ftrace_direct()

On Sat, Apr 12, 2025 at 10:09 PM Steven Rostedt <rostedt@...dmis.org> wrote:
>
> On Sat, 12 Apr 2025 21:33:48 +0800
> Menglong Dong <menglong8.dong@...il.com> wrote:
>
> > The max ftrace hash bits is made fls(32) in register_ftrace_direct(),
> > which seems illogical, and it seems to be a spelling mistake.
> >
> > Just fix it.
> >
> > (Do I misunderstand something?)
>
> I think the logic is incorrect and this patch doesn't fix it.
>
> >
> > Fixes: d05cb470663a ("ftrace: Fix modification of direct_function hash while in use")
> > Signed-off-by: Menglong Dong <dongml2@...natelecom.cn>
> > ---
> >  kernel/trace/ftrace.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> > index 1a48aedb5255..7697605a41e6 100644
> > --- a/kernel/trace/ftrace.c
> > +++ b/kernel/trace/ftrace.c
> > @@ -5914,7 +5914,7 @@ 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)
> > +     if (size < 32)
> >               size = 32;
> >       new_hash = alloc_ftrace_hash(fls(size));
> >       if (!new_hash)
>
> The above probably should be:
>
>         size = hash->count + direct_functions->count
>         size = fls(size);
>         if (size > FTRACE_HASH_MAX_BITS)
>                 size = FTRACE_HASH_MAX_BITS;
>         new_hash = alloc_ftrace_hash(size);

Yeah, this seems to make more sense. And I'll send a V2
later.

BTW, Should we still keep the "size = min(size, 32)" logic
to avoid the hash bits being too small, just like the origin
logic in "dup_hash"?

Thanks!
Menglong Dong

>
> -- Steve
>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ