Earlier quoted context omitted.
It actually probably won't work. Because DEP aka W^X will mark the section of memory containing the string as non-executable, so it will segfault when the instruction pointer hits that address. You can disable that security feature though with a compiler option.
> Because DEP aka W^X will mark the section of memory containing the string as non-executable, so it will segfault when the instruction pointer hits that address. You can disable that security feature though with a compiler option. DEP is a kernel-level security feature no? Since the kernel is what sets up the .text and .data sections.
I think so. But it's enabled by default in Linux and gcc. That was my point, that by default the code won't work.