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]
Date:	Fri, 17 Jul 2009 13:10:25 +0200
From:	Jiri Olsa <jolsa@...hat.com>
To:	Li Zefan <lizf@...fujitsu.com>
Cc:	Ingo Molnar <mingo@...e.hu>, Steven Rostedt <rostedt@...dmis.org>,
	lkml <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] tracing: dont reset set_ftrace_filter/notrace when
	opened with r/w perm

On Fri, Jul 17, 2009 at 05:37:24PM +0800, Li Zefan wrote:
> Jiri Olsa wrote:
> > If user setup set_ftrace_filter/set_ftrace_notrace files and then opens them
> > with read&write permissions, the previous setup will be removed.
> > 
> 
> Currently:
> 
>  # echo 'sys_open sys_close' > set_ftrace_filter
>  # cat set_ftrace_filter
>  sys_open
>  sys_close
> 
> After your patch:
> 
>  # echo 'sys_open sys_close' > set_ftrace_filter
>  # cat set_ftrace_filter
>  sys_close
> 

oops, sry I missed this..

Following patch adds new FTRACE_ITER_RESET flag, as the decision needs
to be taken in "open" and applied in "write".  I'm not sure whats the
policy for adding new flags, but it looks ok to me.

wbr,
jirka


Signed-off-by: Jiri Olsa <jolsa@...hat.com>

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 4521c77..29c4b67 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -1364,6 +1364,7 @@ enum {
 	FTRACE_ITER_FAILURES	= (1 << 3),
 	FTRACE_ITER_PRINTALL	= (1 << 4),
 	FTRACE_ITER_HASH	= (1 << 5),
+	FTRACE_ITER_RESET	= (1 << 6),
 };
 
 #define FTRACE_BUFF_MAX (KSYM_SYMBOL_LEN+4) /* room for wildcards */
@@ -1663,11 +1664,11 @@ ftrace_regex_open(struct inode *inode, struct file *file, int enable)
 	mutex_lock(&ftrace_regex_lock);
 	if ((file->f_mode & FMODE_WRITE) &&
 	    !(file->f_flags & O_APPEND))
-		ftrace_filter_reset(enable);
+		iter->flags |= FTRACE_ITER_RESET;
 
 	if (file->f_mode & FMODE_READ) {
 		iter->pg = ftrace_pages_start;
-		iter->flags = enable ? FTRACE_ITER_FILTER :
+		iter->flags |= enable ? FTRACE_ITER_FILTER :
 			FTRACE_ITER_NOTRACE;
 
 		ret = seq_open(file, &show_ftrace_seq_ops);
@@ -2267,6 +2268,11 @@ ftrace_regex_write(struct file *file, const char __user *ubuf,
 	} else
 		iter = file->private_data;
 
+	if (iter->flags & FTRACE_ITER_RESET) {
+		ftrace_filter_reset(enable);
+		iter->flags &= ~FTRACE_ITER_RESET;
+	}
+
 	if (!*ppos) {
 		iter->flags &= ~FTRACE_ITER_CONT;
 		iter->buffer_idx = 0;
--
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