[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Condor-users] 7.0.3 Debian 4 dynamic clipped?



Hi Richard,

> setarch doesn't seem to exist on Debian, what is it doing ?.

It basically calls "personality()" with flags based on the command
line arguments and then "execs" the program.

You can roll your own with something like this:

(Hard coded for "setarch x86_64 -L -R ...")

--> cut here <--
#include <sys/personality.h>
// These are in <linux/personality.h>, but we don't want to include that.
#define ADDR_NO_RANDOMIZE	0x0040000
#define ADDR_COMPAT_LAYOUT	0x0200000
#include <unistd.h>

int main(int argc, char *argv[])
{
// Use PER_LINUX for x86_64, PER_LINUX32 for i386.
// You may not need ADDR_COMPAT_LAYOUT for x86_64, but it doesn't hurt.
   personality(PER_LINUX | ADDR_NO_RANDOMIZE | ADDR_COMPAT_LAYOUT);
   execvp(argv[1], &argv[1]);
// Shouldn't get here.
   return (1);
}
--> cut here <--

$ gcc -Wall -o setarch setarch.c

$ ./setarch ./simple.std -_condor_D_ALL

$ ./setarch ./simple.std -_condor_D_ALL -_condor_restart simple.std.ckpt


An easy way to see what is going on is:

$ diff <(cat /proc/self/maps) <(cat /proc/self/maps)

And see how the heap and stack move around.


A similar test:

$ diff <(./setarch cat /proc/self/maps) <(./setarch cat /proc/self/maps)

Should show no differences (other than a sometimes different stack
size, but always with the same top stack address).

-- 
Daniel K. Forrest	Laboratory for Molecular and
forrest@xxxxxxxxxxxxx	Computational Genomics
(608) 262 - 9479	University of Wisconsin, Madison