X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FApplications%2Fbomb_src%2Fmain.c;h=944d6c3249fec52f4906304488d83f49f714cbf2;hb=270e5fe88b0666021a7a6393334db7feeb8245f8;hp=d7923224196d2843db64e48070218d43e31239d2;hpb=2a05bcd81312a2885f824dac79e82c01a6e60c6c;p=tpg%2Facess2.git diff --git a/Usermode/Applications/bomb_src/main.c b/Usermode/Applications/bomb_src/main.c index d7923224..944d6c32 100644 --- a/Usermode/Applications/bomb_src/main.c +++ b/Usermode/Applications/bomb_src/main.c @@ -46,8 +46,30 @@ int main(int argc, char *argv[]) for(;;) clone(CLONE_VM, 0); } else { - for(;;) clone(0, malloc(512-16)+512-16); + for(;;) + { + const int stackSize = 512-16; + const int stackOffset = 65; + char *stack = calloc(1, stackSize); + int tid; + if( !stack ) { + printf("Outta heap space!\n"); + return 0; + } + tid = clone(0, stack+stackSize-stackOffset); + if( tid == 0 ) + { + // Sleep forever (TODO: Fix up the stack so it can nuke) + for(;;) sleep(); + } + if( tid < 0 ) { + printf("Clone failed\n"); + return 0; + } + printf("stack = %p, tid = %i\n", stack, tid); + } } + printf("RETURN!?\n"); return 0; }