i was experimenting with setuid programs tried out the following code on my linux machine..
suppose the filename is exploit.c

main(int argc,char **argv)
{
system("/bin/sh");
}

i compiled the program as root and made it setuid using
chmod u+s exploit and then put it in the bin section...
then i logged in as an ordinary user and ran exploit from my command
prompt..i got a shell however i did not get a root shell as i expected..what is it that went wrong???
further i would also like to know the way the stack works in Red Hat Linux 7.1..i have tried several tutorials that teach about stack overflow ..i followed the instructions to the point..however when i execute the program all that i get is a segmentation fault and not a root shell..