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]
Message-ID: <alpine.DEB.2.00.0907221119260.1059@gandalf.stny.rr.com>
Date:	Wed, 22 Jul 2009 11:19:49 -0400 (EDT)
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Jiri Olsa <jolsa@...hat.com>
cc:	Ingo Molnar <mingo@...e.hu>, lkml <linux-kernel@...r.kernel.org>,
	Li Zefan <lizf@...fujitsu.com>,
	Frederic Weisbecker <fweisbec@...il.com>
Subject: Re: [PATCH] tracing: dont reset set_ftrace_filter/notrace when opened
 with r/w perm


On Wed, 22 Jul 2009, Jiri Olsa wrote:

> On Mon, Jul 20, 2009 at 09:11:34PM -0400, Steven Rostedt wrote:
> > 
> > On Thu, 16 Jul 2009, 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.
> > 
> > This is exactly what it was suppose to do.
> > 
> > man fopen:
> > 
> >        w+     Open for reading and writing.  The file is created  if  it  does
> >               not  exist, otherwise it is truncated.  The stream is positioned
> >               at the beginning of the file.
> > 
> > Which means that if you open a file for "w+" it will truncate it. Hence, 
> > you will remove all previous settings.
> > 
> > What you want is:
> > 
> >        a+     Open for reading and appending (writing at end  of  file).   The
> >               file is created if it does not exist.  The initial file position
> >               for reading is at the beginning  of  the  file,  but  output  is
> >               always appended to the end of the file.
> > 
> > Change the belowe code from "w+" to "a+" and you get your expected result.
> 
> My point was that if you open set_ftrace_filter/set_ftrace_notrace with just O_RDWR
> perm. and will use the file just for reading, the filter will reset.
> 
> You're right about the "w+", there's the O_CREAT|O_TRUNC, sry I missed that.. ;)
> Anyway with "r+" you'll get O_RDWR perm. only, showing the issue:

Ah, then the fix would be to check against O_TRUNC.

-- Steve
--
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