X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: RayeR Newsgroups: comp.os.msdos.djgpp Subject: Re: Does DJGPP GCC support SSP stack protection? Date: Fri, 4 Dec 2009 04:03:30 -0800 (PST) Organization: http://groups.google.com Lines: 48 Message-ID: References: <8a4f755b-e150-4b60-99a5-71151b54ff9b AT m38g2000yqd DOT googlegroups DOT com> <83bpkoq38g DOT fsf AT gnu DOT org> <42f2c9ab-efdf-407f-86ba-63bb28692fea AT e34g2000vbc DOT googlegroups DOT com> <4ADE1631 DOT 9020003 AT iki DOT fi> NNTP-Posting-Host: 90.181.199.10 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1259928210 29810 127.0.0.1 (4 Dec 2009 12:03:30 GMT) X-Complaints-To: groups-abuse AT google DOT com NNTP-Posting-Date: Fri, 4 Dec 2009 12:03:30 +0000 (UTC) Complaints-To: groups-abuse AT google DOT com Injection-Info: k4g2000yqb.googlegroups.com; posting-host=90.181.199.10; posting-account=Q0wMHAoAAADjYrghh94FTf6YnbpTqZgp User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20090403 SeaMonkey/1.1.16,gzip(gfe),gzip(gfe) Bytes: 2877 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Yeah, I just need "-lssp" arg to gcc to link libssp.a so now compiled with gcc -Wall -fstack-protector -o head.exe head.c -lssp is OK. I tried to jamm the stack little bit. Here's result with standard compiling: Exiting due to signal SIGSEGV Stack Fault at eip=000016d9 eax=00000000 ebx=0000029e ecx=30580000 edx=00000035 esi=00000054 edi=0001266c ebp=266c0009 esp=3057fffc program=C:\DJGPP\C\HEAD.EXE cs: sel=01a7 base=029e0000 limit=0009ffff ds: sel=01af base=029e0000 limit=0009ffff es: sel=01af base=029e0000 limit=0009ffff fs: sel=017f base=00005c20 limit=0000ffff gs: sel=01bf base=00000000 limit=0010ffff ss: sel=01af base=029e0000 limit=0009ffff App stack: [00092668..0001266c] Exceptn stack: [000125ac..0001066c] Call frame traceback EIPs: 0x000016d9 and here with SSP enabled: *** stack smashing detected ***: terminated Exiting due to signal SIGILL Invalid Opcode at eip=000017a4 eax=00000000 ebx=00000000 ecx=0001505c edx=0009a8a8 esi=00099970 edi=00000005 ebp=000999e8 esp=00099970 program=C:\DJGPP\C\HEAD.EXE cs: sel=01a7 base=029e0000 limit=0009ffff ds: sel=01af base=029e0000 limit=0009ffff es: sel=01af base=029e0000 limit=0009ffff fs: sel=017f base=00005c20 limit=0000ffff gs: sel=01bf base=00000000 limit=0010ffff ss: sel=01af base=029e0000 limit=0009ffff App stack: [00099a68..00019a68] Exceptn stack: [00019978..00017a38] Call frame traceback EIPs: 0x000017a4 0x00001617 0x000016e9 0x0000332f Now in this simple case it seems that standard memory protection is enough to detect a problem..