From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@9fans.net
Subject: [9fans] lowest valid stack address
Date: Tue, 1 Sep 2009 11:08:06 -0400 [thread overview]
Message-ID: <0662c118779db0f0ac85f3ce711dcbb9@quanstro.net> (raw)
assuming no thread library, is there a way of
determining the lowest valid stack address
from userspace? the purpose is to create a
test onstack() so that it can be asserted that
a given pointer is !onstack. thread library
knows.
is it fair to assume that the stack can be up
to 256mb? how does this generalize to 64 bits?
how bogus is this code, and why?
void
initbos(int x)
{
uint m;
uintptr p;
p = (uintptr)&x;
m = 1 << sizeof p*8 - 4;
m -= 1;
p &= ~m;
print("%p\n", p);
}
uintptr bos;
#define onstack(x) ((uintptr)(x) >= bos)
#define threadonstack(x) /* thread library knows */
- erik
next reply other threads:[~2009-09-01 15:08 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-01 15:08 erik quanstrom [this message]
2009-09-01 16:52 ` cinap_lenrek
2009-09-01 16:55 ` erik quanstrom
2009-09-01 17:47 ` erik quanstrom
2009-09-01 23:22 ` Russ Cox
2009-09-01 23:49 ` erik quanstrom
2009-09-01 23:59 ` Russ Cox
2009-09-02 0:18 ` Devon H. O'Dell
2009-09-02 8:01 ` Andrés Domínguez
2009-09-02 8:58 ` Gorka Guardiola
2009-09-02 13:32 ` erik quanstrom
2009-09-02 13:28 ` Devon H. O'Dell
2009-09-02 13:35 ` erik quanstrom
2009-09-02 14:17 ` Devon H. O'Dell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0662c118779db0f0ac85f3ce711dcbb9@quanstro.net \
--to=quanstro@quanstro.net \
--cc=9fans@9fans.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).