X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=GSOz197bgkvUoOcI agC4oYPNlDRXSLfmSJwedBHtF5S8PySjf5LkwPPpNIoCbn2AqRxgvyze6h9Cz0V2 Udgfp4bc9sOVsBsRGolCDsjkMupq9GKv+N4YHDlv12GfTPPbAQ5Fx3UYzw4gJ5zO 6v96Ka/4du+Da6ipFfYedfyf56w= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=zEYGzeYa+T69tMRZvbeBmI 6CdFU=; b=xYWAtK9Tobw3ZEo5N9RxKTqT+6gXVrUSSGxdAxLj+2F93IyqmtZTzx CDiVFB9YZv5/9+Ic8QMxA4+Cqr8J5wnSUcsY8MI3xADzkMrS1e6qbWgT8bljvM9M 6QWZVltrxgveFJsHqfA2R2G83+YzMWHtFqPpWfdILzoAVGETUsIuo= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.6 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=German, Tips, driving, H*UA:Firefox X-HELO: mailout03.t-online.de Subject: Re: problem with i686-w64-mingw32-gcc -fstack-protector-all To: cygwin AT cygwin DOT com References: <1d6ce5fb-ea05-b830-8096-98d839cc6e02 AT t-online DOT de> From: Christian Franke Message-ID: <7a27bdaa-b3ad-1d33-5206-f32fabeb10c1@t-online.de> Date: Sun, 8 Oct 2017 14:58:52 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0 SeaMonkey/2.50 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Lee wrote: > >>> + ./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. > Yes! > 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: >> >> Cygwin mintty: >> >> $ ./ssp testtestx >> main: argv[1]=testtestx >> doit: s="testtestx" buf="12345678" i=1 >> doit: s="testtestx" buf="testtestx" i=1 >> main: exit > 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[1] 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 syslog()). Christian [1] https://gcc.gnu.org/viewcvs/gcc/trunk/libssp/ssp.c?revision=233253&view=markup -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple