News for hackers. Stuff that matters.
Re:Raw Linux Threads via System Calls by 0x0 on Sunday June 07, 2015 @01:50PM (#9675622)
How can the thread free its own stack before calling exit? Doesn't it need a stack to call exit safely?
Re:Raw Linux Threads via System Calls by to3m on Sunday June 07, 2015 @02:02PM (#9675679)
In general yes, but the code in this case appears to be supplying its own version of exit, that just does a SYSCALL instruction. The SYSCALL instruction doesn't need a stack.
Re:Raw Linux Threads via System Calls by 0x0 on Sunday June 07, 2015 @03:03PM (#9675942)
Is there no risk of an interrupt or a signal happening in between un-mmap'ing and calling exit, that would cause stack pushes?
Re:Raw Linux Threads via System Calls by Amanieu on Sunday June 07, 2015 @03:17PM (#9675984)
That is a risk, which is why you need to block all signals using the sigprocmask syscall before unmapping your stack.
Re:Raw Linux Threads via System Calls by geofft on Sunday June 07, 2015 @05:38PM (#9676427)
Or you just don't have signal-handling functions. Signals only touch the stack if you handle them via functions. The default signal dispositions all either kill the process or do nothing, so they don't touch the stack.
Re:Raw Linux Threads via System Calls by MarkSweep on Sunday June 07, 2015 @02:07PM (#9675699)
It is calling the exit syscall directly using the syscall instruction, which does not push anything onto the stack.