Stack

Christos Ricudis (ricudis@paiko.the.forthnet.gr)
Wed, 31 Jul 1996 21:00:55 +0300


Hello,

I'm trying to port University of Wisconsin Condor to Linux-ELF. Condor
is a package that does job batching, process migration and process
checkpoint/restore in user level.

In order to checkpoint a running process, condor needs to save its stack
and data segments.

In an earlier port to a.out, there are two methods of finding the
address of the stack:

1) Stack end address : Always assumed to be 0xc0000000;

2) Stack start address :

a. Looking up proc/pid/stat, tsk->mm->start_stack, or
b. Using SETJMP :

jmp_buf env;

(void)SETJMP( env );
return JMP_BUF_SP(env) & ~1023;

The two methods give different results, that differ by around 2084 bytes.
(why should they?).

There is some test code that checks if a typical stack address (the address
of a local data object) is located inside the bounds of the addresses
previously found.

Using method a., I get a stack_start address that is higher than the typical
stack address (strange?). Which is the correct way of finding the stack
addresses?

Also. I need nlist() for ELF. nlist() in libc is commented out. Somebody
mentioned somewhat called elflib, however I couldn't find anything related.

Christos Ricudis
ricudis@paiko.the.forthnet.gr