Conversation

Couldn't read past the first blatantly incorrect statement. "_chkstk" doesn't catch shit, all it does is touching all the pages so that you don't subtract more than a page in one go without touching the page guard. It throws, not catches.
1
5
Furthermore, your shellcode won't crash if you don't link against _chkstk, provided that you use the compiler flag for inlining it on gcc, one of the compilers you mention explicitly by name.
2
1
Of course you can simply just copy one after the shellcode too on any other compiler
1
Actually this still seems to call chkstk for whatever reason (despite it being clearly unnecessary after the generic part), but there's some magic combination of flags that omits that too.
1
Or maybe mingw-specific issue, because it seems to work on regular gcc. You can use it for shellcode just as well (or even better with ld scripts), just change default abi to ms
Image
Yep. It might be specific to mingw as I havent explicitly tested it with clang. Things work a lot differently with clang. And the clang libraries use _chkstk, __chkstk,___chkstk and a few more weird routines for this which are more confusing.
1