From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 120096 invoked by alias); 8 Sep 2017 23:22:32 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 119591 invoked by uid 89); 8 Sep 2017 23:22:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-5.6 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,GIT_PATCH_2,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2353 X-HELO: mail-it0-f41.google.com Received: from mail-it0-f41.google.com (HELO mail-it0-f41.google.com) (209.85.214.41) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 08 Sep 2017 23:22:29 +0000 Received: by mail-it0-f41.google.com with SMTP id o200so6209968itg.0 for ; Fri, 08 Sep 2017 16:22:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=YXAMlreUBcfp4KEszlsW5lvTTS5uhrSdAQ61ee6Sp3o=; b=W0khILyrBJuNdD1e8THCTHri749MZYHsE6fGAO25tgzgvz88qX/nm8+xsmSqx+SXn4 EYpCHHCy7SGW/iLMvPUlbhUhhLhGVTB33cMCRHLxr4Rtf8ciBcZ+azuAUONBEpRGaIJv gRCLQje7Uy9KzPx0aoYbFWidDG19s3uVz2jO/u1qoxIqCFhvX+ld5DjcV7uiDHk0xmn6 E9nyC/HcvLdvoHziX9mJmC7Uz6b8+kZIkA843RfUnyik6jg4aNuiSXhKgXDU8lE4c1T9 5SzYayINHDaiXxGqZP2oo/sSQmrFThVfeAXzJOEGd8/8/r7d847Hb6nqdNqNTVkOEyG0 WV5w== X-Gm-Message-State: AHPjjUhYTLr3WASqwmiIfi4GRyHyjdWiP3KiUEeAIrCRy2nhp3UUvVvU oyCLdwCiyRbNRxe523cBw2pe71nKtKC19xHFypU= X-Google-Smtp-Source: AOwi7QBpf90MRahLuefZdR8VkBlncN0ssVb2dZ3laeQxeALPaiouZXW/awKdGPwOfpWtYOXaX/mn0TdeV4BV7TuAbNo= X-Received: by 10.36.121.85 with SMTP id z82mr3110722itc.87.1504912947912; Fri, 08 Sep 2017 16:22:27 -0700 (PDT) MIME-Version: 1.0 Received: by 10.79.184.1 with HTTP; Fri, 8 Sep 2017 16:22:27 -0700 (PDT) In-Reply-To: <59b3214a.d049ca0a.cd021.98bd@mx.google.com> References: <59b3214a.d049ca0a.cd021.98bd@mx.google.com> From: Lee Date: Fri, 08 Sep 2017 23:22:00 -0000 Message-ID: Subject: Re: i686-w64-mingw32-gcc -fstack-protector-strong To: cygwin@cygwin.com Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2017-09/txt/msg00106.txt.bz2 On 9/8/17, Steven Penny wrote: > On Fri, 8 Sep 2017 10:14:54, Lee wrote: >> $ i686-w64-mingw32-gcc -o div.exe div.c >> $ ./div >> works >> >> $ i686-w64-mingw32-gcc -fstack-protector-strong -o div.exe div.c >> $ ./div >> C:/cygwin/home/Lee/t/div.exe: error while loading shared libraries: ?: >> cannot open shared object file: No such file or directory >> >> $ ldd div.exe >> ntdll.dll => /cygdrive/c/WINDOWS/SYSTEM32/ntdll.dll >> (0x7ffef5c50000) >> ??? => ??? (0x778f0000) >> wow64.dll => /cygdrive/c/WINDOWS/System32/wow64.dll (0x50e50000) >> wow64win.dll => /cygdrive/c/WINDOWS/System32/wow64win.dll >> (0x50dd0000) >> >> $ i686-w64-mingw32-gcc --version >> i686-w64-mingw32-gcc (GCC) 5.4.0 > > You need to paste or link to div.c, otherwise this seems a pointless > exercise. > See, I cannot repro: > > $ cat div.c > #include > int main() { > puts("hello world"); > } man gcc -fstack-protector Emit extra code to check for buffer overflows, such as stack smashing attacks. This is done by adding a guard variable to functions with vulnerable objects. This includes functions that call "alloca", and functions with buffers larger than 8 bytes. The guards are initialized when a function is entered and then checked when the function exits. If a guard check fails, an error message is printed and the program exits. -fstack-protector-all Like -fstack-protector except that all functions are protected. -fstack-protector-strong Like -fstack-protector but includes additional functions to be protected --- those that have local array definitions, or have references to local frame addresses. I maybe should have used -fstack-protector-all, but I'm still learning :) > $ x86_64-w64-mingw32-gcc -o div div.c > $ ./div > hello world > > $ x86_64-w64-mingw32-gcc -fstack-protector-strong -o div div.c > $ ./div > hello world > > $ ldd div > ntdll.dll => /cygdrive/c/Windows/SYSTEM32/ntdll.dll (0x773a0000) > kernel32.dll => /cygdrive/c/Windows/system32/kernel32.dll (0x77180000) > KERNELBASE.dll => /cygdrive/c/Windows/system32/KERNELBASE.dll > (0x7fefd1a0000) > msvcrt.dll => /cygdrive/c/Windows/system32/msvcrt.dll (0x7fefde00000) note libssp-0 (or ???) isn't mentioned you don't have any user defined functions, so it got optimized out/never called?? Thanks Lee -- 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