From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.130]) by sourceware.org (Postfix) with ESMTPS id 21A903858C1F for ; Sat, 12 Nov 2022 14:50:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 21A903858C1F Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=cygwin.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=cygwin.com Received: from calimero.vinschen.de ([24.134.7.25]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.167]) with ESMTPSA (Nemesis) id 1M597s-1osluL28Wq-001D6x; Sat, 12 Nov 2022 15:50:29 +0100 Received: by calimero.vinschen.de (Postfix, from userid 500) id D8AB6A80CCD; Sat, 12 Nov 2022 15:50:28 +0100 (CET) Date: Sat, 12 Nov 2022 15:50:28 +0100 From: Corinna Vinschen To: cygwin@cygwin.com Cc: Christian Jullien Subject: Re: Is there an API to remove ALSR in Cygwin 3.4.0? Message-ID: Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.com, Christian Jullien References: <000501d8f689$f359a300$da0ce900$@orange.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <000501d8f689$f359a300$da0ce900$@orange.fr> X-Provags-ID: V03:K1:dt7Fszq3o3CXpqitOTqP8Jko/pWqSA7HT5BL1c1GmUXqroyxGLO 6Z1b1pSMgInFqrngwcIuuwUZlvlUW8akjeWtXSu9Xs4LHeMxTHySqnAAECE8usYKMsCQ160 9cSjJPaBBbYv3Un/j0rdM9DSyFvVDiY7yRSSWUNJgXItB9e3k5MLG2WfUJQ7TEz4I1c+QX+ pi9p2j3Y/PMx/RKfhbb2Q== X-UI-Out-Filterresults: notjunk:1;V03:K0:5355+WrJSgY=:Y6V1kyW9Ytr/pz6WwvsMi2 ym2C3jdrOjOIkzVfBbY2YlpC7RpQWFRdTBVlqVrbsqMFeeJ06JER691SFZwX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QXE153bFsTtxkB+bmhWCc5oHx/uD9hlx8lt+aOjOAkT dmiro0vy+/hgtGtCOdLZWSlrrzqJt+5Xka8XkN89E2S9mqprF6fw3YQry0tEjJEGM5TdJvXNS YCZ+sIU03LWiI5lSe9Ng/TvGjri44p9Woc7AFpuuSh+hTMMjz0pXrC/GIvHYET9j6gu1B4JsD vVd8Id5RuS9huPoaiKfrhgAGSSIv0Q== X-Spam-Status: No, score=-95.9 required=5.0 tests=BAYES_00,GOOD_FROM_CORINNA_CYGWIN,KAM_DMARC_NONE,KAM_DMARC_STATUS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_FAIL,SPF_HELO_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Nov 12 12:28, Christian Jullien wrote: > Hello Cygwin team, > > > > First, I would like to thank you for your efforts on Cygwin all of these > years. > > > > I'm asking if there will be an API to remove ASLR with an API as on Linux: Please note that, for the time being, ASLR will only be enabled on the Cygwin DLL itself. All other DLLs as well as the Cygwin executables are still non-ASLRed. We're looking into introducing ASLR step by step. Right now the Cygwin toolchain creates non-ASLRed EXEs and DLLs by default. This is supposed to change in a while. Also, we might change the auto-rebase mechanism (basically the script running as post-install script when setup-x86_64 finishes up) to enable ASLR on DLLs. EXEs are not so important from my POV, but as soon as we tweaked the toolchain, more and more EXEs will be ASLRed automagically as well. One thing we can only use partially, because it's bound to break Cygwin's fork and exec, is High Entropy ASLR. Naturally, this would only work for executables which never fork or exec other processes. Having said that, there's no API for this yet in Cygwin. There is an API in Windows to control (among others) the ASLR setting of a process at creation time, see https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-updateprocthreadattribute settings called PROCESS_CREATION_MITIGATION_POLICY_BOTTOM_UP_ASLR_ALWAYS_ON PROCESS_CREATION_MITIGATION_POLICY_BOTTOM_UP_ASLR_ALWAYS_OFF and PROCESS_CREATION_MITIGATION_POLICY_HIGH_ENTROPY_ASLR_ALWAYS_ON PROCESS_CREATION_MITIGATION_POLICY_HIGH_ENTROPY_ASLR_ALWAYS_OFF However, we don't have an API for that, yet. We could add it to Cygwin at one point. I'd prefer the Linux-personality call, too, but funny enough, ADDR_NO_RANDOMIZE would be the only flag we could support. What we *do* have already is the peflags tool from the rebase package: $ peflags -d0 -e0 foo.exe This example would disable ASLR on the foo.exe executable. Maybe that's a workaround for the time being. Corinna