This is the mail archive of the
mailing list for the Cygwin project.
Re: problem with i686-w64-mingw32-gcc -fstack-protector-all
- From: Christian Franke <Christian dot Franke at t-online dot de>
- To: cygwin at cygwin dot com
- Date: Sun, 8 Oct 2017 14:58:52 +0200
- Subject: Re: problem with i686-w64-mingw32-gcc -fstack-protector-all
- Authentication-results: sourceware.org; auth=none
- References: <CAD8GWsuRTR2asWX2zNnYJWj2EwbTVjqb=kx4kh2XxnO4OmW4jg@mail.gmail.com> <email@example.com> <CAD8GWsu1CetVFeJPz4zxhZfDShQBQrHanzuyfuFu16VV=XxgDQ@mail.gmail.com>
+ ./ssp.exe testtestx
./doit: line 11: 9128 Illegal instruction ./ssp.exe testtestx
+ echo -e '\n\n'
The *** stack smashing detected *** message from MinGW runtime is only
visible if stdio is attached to a Windows console.
But even after re-reading https://github.com/mintty/mintty/wiki/Tips &
https://github.com/mintty/mintty/issues/56 I'm still missing why _no_
output is displayed before the 'Illegal instruction' output line.
Stdio streams are usually full buffered if not attached to a
tty/console. Buffers are flushed on regular exit(), but not on abnormal
termination. Add fflush() calls to fix.
Works for me if one more overflow char is added:
$ ./ssp testtestx
doit: s="testtestx" buf="12345678" i=1
doit: s="testtestx" buf="testtestx" i=1
Interesting. I have Windows 10 & i686-w64-mingw32-gcc (GCC) 6.3.0 you?
Same (Win10.0.15063 x64 German).
Anyway.. Thank you!! It's been driving me nuts trying to figure out
why all I get is 'Illegal instruction'
The 'Illegal instruction' is printed by the Cygwin shell because the
program fails with STATUS_ILLEGAL_INSTRUCTION which is mapped to SIGILL.
The libspp code shows that the program is terminated with
__builtin_trap(). GCC then generates the x86 instruction UD2 ("defined"
as "undefined instruction" :-)
In the MinGW case, stack error messages are written to CONOUT$ or are
not written if no console is attached (Cygwin and others: /dev/tty or
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple