[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Libunwind-devel] Re: [patch] Eliminate some unnecessary msync() ca
Re: [Libunwind-devel] Re: [patch] Eliminate some unnecessary msync() calls.
Wed, 2 Dec 2009 09:21:32 -0800
On Wed, Dec 2, 2009 at 1:35 AM, Mattias Engdegård <address@hidden> wrote:
Speaking of which, I don't believe msync() fails on non-readable
memory (PROT_NONE), so it isn't a perfectly reliable way of verifying
whether an address can be read from without segfaulting. In another
stack trace application, we had to abandon msync() for this purpose
and use pread() from /proc/self/mem instead - more expensive, but safer.
I think of msync as a filter for bogus addresses, not a reliable guarantee. The way libunwind is being used now (always on heap profiling), any slowdown would cause people to compile code with frame pointers and use a simpler unwinder.
If there is a way to check if a given virtual address is a known good stack address, we could use that. But unfortunately there is no portable way of doing that.