public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* i386 backtrace() question
@ 2004-08-19 11:47 David Mosberger
  2004-08-19 20:56 ` Roland McGrath
  0 siblings, 1 reply; 2+ messages in thread
From: David Mosberger @ 2004-08-19 11:47 UTC (permalink / raw)
  To: libc-hacker

While tracking down an unrelated libunwind failure on x86, I came
across this curious test in sysdeps/i386/backtrace.c:

      if ((void *) current < esp || (void *) current > __libc_stack_end)

The test is obvous for non-threaded programs.  However, I'd like to
confirm that the test is OK for multi-threaded programs as well,
because all thread stacks will be allocated below __libc_stack_end.
I'm pretty sure that's true for Linux, though I'm uncertain about how
stack-randomization or other OSes would affect the validity of the
test.  Could somebody confirm?

Thanks,

	--david

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: i386 backtrace() question
  2004-08-19 11:47 i386 backtrace() question David Mosberger
@ 2004-08-19 20:56 ` Roland McGrath
  0 siblings, 0 replies; 2+ messages in thread
From: Roland McGrath @ 2004-08-19 20:56 UTC (permalink / raw)
  To: davidm; +Cc: libc-hacker

> While tracking down an unrelated libunwind failure on x86, I came
> across this curious test in sysdeps/i386/backtrace.c:
> 
>       if ((void *) current < esp || (void *) current > __libc_stack_end)
> 
> The test is obvous for non-threaded programs.  However, I'd like to
> confirm that the test is OK for multi-threaded programs as well,
> because all thread stacks will be allocated below __libc_stack_end.
> I'm pretty sure that's true for Linux, though I'm uncertain about how
> stack-randomization or other OSes would affect the validity of the
> test.  Could somebody confirm?

This is the case on Linux with all kernels I'm aware of.  It's not true on
GNU/Hurd, where the stack can be anywhere (it's just a vanilla allocation
like an mmap).


Thanks,
Roland
.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-08-19 20:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-19 11:47 i386 backtrace() question David Mosberger
2004-08-19 20:56 ` Roland McGrath

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).