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] [day] [month] [year] [list]
Date:   Tue, 10 Sep 2019 22:29:38 +0800
From:   Changbin Du <changbin.du@...il.com>
To:     Steven Rostedt <rostedt@...dmis.org>
Cc:     Changbin Du <changbin.du@...il.com>,
        Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] ftrace: simplify ftrace hash lookup code

On Tue, Sep 10, 2019 at 05:28:04AM -0400, Steven Rostedt wrote:
> On Tue, 10 Sep 2019 08:33:23 +0800
> Changbin Du <changbin.du@...il.com> wrote:
> 
> > > 
> > > bool ftrace_lookup_ip(struct ftrace_hash *hash, unsigned long ip, bool empty_result)
> > > {
> > > 	if (ftrace_hash_empty(hash))
> > > 		return empty_result;
> > > 
> > > 	return __ftrace_lookup_ip(hash, ip);
> > > }
> > >  
> > We must add another similar function since ftrace_lookup_ip() returns a pointer.
> > 
> > bool ftrace_contains_ip(struct ftrace_hash *hash, unsigned long ip,
> > 			bool empty_result)
> > {
> > 	if (ftrace_hash_empty(hash))
> > 		return empty_result;
> > 
> > 	return !!__ftrace_lookup_ip(hash, ip);
> > }
> > 
> > But after this, it's a little overkill I think. It is not much simpler than before.
> > Do you still want this then?
> > 
> >
> 
> Or...
> 
> static struct ftrace_func_entry empty_func_entry;
> #define EMPTY_FUNC_ENTRY = &empty_func_entry;
> 
> [..]
>  * @empty_result: return NULL if false or EMPTY_FUNC_ENTRY on true
> [..]
>  * @empty_result should be false, unless this is used for testing if the ip
>  * exists in the hash, and an empty hash should be considered true.
>  * This is useful when the empty hash is considered to contain all addresses.
> [..]
> struct ftrace_func_entry *
> ftrace_lookup_ip(struct ftrace_hash *hash, unsigned long ip, bool empty_result)
> {
> 	if (ftrace_hash_empty(hash))
> 		return empty_result ? EMPTY_FUNC_ENTRY : NULL;
> 
> 	return __ftrace_lookup_ip(hash, ip);
> }
> 
> But looking at this more, I'm going back to not touching the code in
> this location, because __ftrace_lookup_ip() is static, where as
> ftrace_lookup_ip() is not, and this is in a very fast path, and I
> rather keep it open coded.
> 
> Lets just drop the first hunk of your patch. The second hunk is fine.
>
Sure, I will send a update short later. Thanks for your suggestions.

> 
> -- Steve

-- 
Cheers,
Changbin Du

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ