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: <20140611100524.295efcce@gandalf.local.home>
Date:	Wed, 11 Jun 2014 10:05:24 -0400
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Namhyung Kim <namhyung@...nel.org>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	Namhyung Kim <namhyung.kim@....com>,
	Ingo Molnar <mingo@...nel.org>
Subject: Re: [PATCH 2/2] tracing: Do not copy hash if O_TRUNC is set

On Wed, 11 Jun 2014 17:06:54 +0900
Namhyung Kim <namhyung@...nel.org> wrote:

> When a filter file is open for writing and O_TRUNC is set, there's no
> need to copy and free the filter entries.
> 

Nice cleanup. I'll add it for 3.17.

Thanks,

-- Steve

> Signed-off-by: Namhyung Kim <namhyung@...nel.org>
> ---
>  kernel/trace/ftrace.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index ddfda763ded7..13885590a184 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -2759,7 +2759,13 @@ ftrace_regex_open(struct ftrace_ops *ops, int flag,
>  		hash = ops->filter_hash;
>  
>  	if (file->f_mode & FMODE_WRITE) {
> -		iter->hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS, hash);
> +		const int size_bits = FTRACE_HASH_DEFAULT_BITS;
> +
> +		if (file->f_flags & O_TRUNC)
> +			iter->hash = alloc_ftrace_hash(size_bits);
> +		else
> +			iter->hash = alloc_and_copy_ftrace_hash(size_bits, hash);
> +
>  		if (!iter->hash) {
>  			trace_parser_put(&iter->parser);
>  			kfree(iter);
> @@ -2768,10 +2774,6 @@ ftrace_regex_open(struct ftrace_ops *ops, int flag,
>  		}
>  	}
>  
> -	if ((file->f_mode & FMODE_WRITE) &&
> -	    (file->f_flags & O_TRUNC))
> -		ftrace_filter_reset(iter->hash);
> -
>  	if (file->f_mode & FMODE_READ) {
>  		iter->pg = ftrace_pages_start;
>  

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ