News for hackers. Stuff that matters.
Re:Undefined behavior in C is a reading error by vyodaiken on Friday May 21, 2021 @06:35AM (#27232364)
Linux clone, pthreads, and os code commonly look at stack boundaries
Re:Undefined behavior in C is a reading error by gpderetta on Friday May 21, 2021 @08:53AM (#27233390)
Not sure what you are referring to with stack boundaries. Of course the ABI imposes some minimal requirements at ABI visible points, but these days you can't even rely on the existence of frame pointers to traverse the stack and you have to use the DWARF unwind machinery. And the content of the stack frame itself is completely unspecified of course.
Re:Undefined behavior in C is a reading error by vyodaiken on Friday May 21, 2021 @02:54PM (#27238325)
So I create a thread with a custom stack which is an allocated buffer. At the top, I write a sequence of bytes in some order. Then I periodically read the top of the stack to see if the stack is getting close to overflow. Meanwhile, the thread code is also addressing the same store.