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: <20250412104518.2b4598d3@batman.local.home>
Date: Sat, 12 Apr 2025 10:45:18 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Menglong Dong <menglong8.dong@...il.com>
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, 12 Apr 2025 22:36:56 +0800
Menglong Dong <menglong8.dong@...il.com> wrote:

> > 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  
> 
> Oops, I mean "size =  max(size, 32); size = fls(size);" here :/
> 
> > to avoid the hash bits being too small, just like the origin
> > logic in "dup_hash"?
> >

If you have 5 functions, why do you need more that 5 buckets?

	size = 5;
	size = max(5, 32); // size = 32
	size = fls(size); // size = 5
	alloc_ftrace_hash(size);

		size = 1 << size; // size = 32
		hash->buckets = kcalloc(size, ...);

Now you have 32 buckets for 5 functions. Why waste the memory?

If you add more functions, the hash bucket size will get updated.

-- Steve

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ