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.1.10.0811231446520.13888@gandalf.stny.rr.com>
Date:	Sun, 23 Nov 2008 14:48:59 -0500 (EST)
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Ingo Molnar <mingo@...e.hu>
cc:	Frederic Weisbecker <fweisbec@...il.com>,
	Linux Kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] tracing/function-return-tracer: don't trace kfree while
 it frees the return stack


On Sun, 23 Nov 2008, Ingo Molnar wrote:
> > > 
> > > note that we also need to keep gcc from reordering things here (no 
> > > matter how unlikely in this particular case).
> > 
> > I first thought that too, but thinking about it, if gcc does do that, then
> > it will break the logic for a correct C program.
> > 
> > t is passed in as a pointer, then it modifies the contents of t 
> > (which could be a global pointer), then it calls a external 
> > function, that might also reference the global pointer.
> > 
> > This means that if it were to reorder the two, it would break C, 
> > because the compiler can not assume that the called function will 
> > read the global pointer either.
> > 
> > In other words, the compiler should not need to worry about SMP or 
> > modifications done by interrupts or other threads. But the compiler 
> > should always preserve the order that is assumed by a single 
> > context.
> 
> Correct, but this assumes that kfree is a C function. Which it might 
> not necessarily be: it could be optimized via an inline in certain 
> cases, etc. It's best to document such cases explicitly.

Yeah, I thought about kfree being optimized out somehow, but thinking 
about what kfree does, it seems difficult to imagine how that could 
happen.

> 
> In any case, the real solution is what i suggested in the previous 
> mail, to do the freeing from the task-struct freeing path in 
> kernel/fork.c:free_task() - that has other advantages as well.

Yeah, but sometimes it's good to talk about quirks of a compiler, even on 
obsoleted situations ;-)

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