Hi,
On 14/9/2022 15:33, Martin Storsjö wrote:
> +void __cdecl __attribute__((__noreturn__)) __stack_chk_fail(void) {
> + char msg[] = "*** stack smashing detected ***: terminated\n";
> + write(STDERR_FILENO, msg, strlen(msg));
> + abort();
> +}
I have a feeling that calling `abort()` may not be the best thing to do here.
From what I recall, `abort` may call `_exit(3)` in some cases (or perhaps some
CRT combinations) and that causes DLLs to be unloaded and global destructors to
be run. In case of a stack smashing event, the process memory has been
corrupted so allowing arbitrary destructors to run could be a security risk.
I think MSVC raises fail fast exceptions for all kinds of security check
failures including /GS buffer security checks. Perhaps the same will be more
appropriate here?
Best Regards,
Alvin Wong
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public