read /proc/$pid/segment

--
cinap
--- Begin Message ---
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

--- End Message ---

Reply via email to