From unknown Mon Jun 23 16:44:08 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#30176 <30176@debbugs.gnu.org> To: bug#30176 <30176@debbugs.gnu.org> Subject: Status: readlinkat and _FORTIFY_SOURCE on Cygwin Reply-To: bug#30176 <30176@debbugs.gnu.org> Date: Mon, 23 Jun 2025 23:44:08 +0000 retitle 30176 readlinkat and _FORTIFY_SOURCE on Cygwin reassign 30176 emacs submitter 30176 Ken Brown severity 30176 important thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 19 15:46:57 2018 Received: (at submit) by debbugs.gnu.org; 19 Jan 2018 20:46:57 +0000 Received: from localhost ([127.0.0.1]:35285 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ecdYu-0005kC-TH for submit@debbugs.gnu.org; Fri, 19 Jan 2018 15:46:57 -0500 Received: from eggs.gnu.org ([208.118.235.92]:52239) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ecdYu-0005jy-33 for submit@debbugs.gnu.org; Fri, 19 Jan 2018 15:46:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ecdYn-0000J2-OK for submit@debbugs.gnu.org; Fri, 19 Jan 2018 15:46:50 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:58295) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ecdYn-0000Ik-LD for submit@debbugs.gnu.org; Fri, 19 Jan 2018 15:46:49 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43203) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecdYm-0006Wi-0t for bug-gnu-emacs@gnu.org; Fri, 19 Jan 2018 15:46:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ecdYh-0000F6-31 for bug-gnu-emacs@gnu.org; Fri, 19 Jan 2018 15:46:48 -0500 Received: from limerock02.mail.cornell.edu ([128.84.13.242]:43156) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecdYg-0000Ep-U6 for bug-gnu-emacs@gnu.org; Fri, 19 Jan 2018 15:46:43 -0500 X-CornellRouted: This message has been Routed already. Received: from authusersmtp.mail.cornell.edu (granite3.serverfarm.cornell.edu [10.16.197.8]) by limerock02.mail.cornell.edu (8.14.4/8.14.4_cu) with ESMTP id w0JKkfRf003661 for ; Fri, 19 Jan 2018 15:46:41 -0500 Received: from [10.13.22.4] (50-192-26-108-static.hfc.comcastbusiness.net [50.192.26.108]) (authenticated bits=0) by authusersmtp.mail.cornell.edu (8.14.4/8.12.10) with ESMTP id w0JKkdnp022669 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT) for ; Fri, 19 Jan 2018 15:46:40 -0500 X-Debbugs-Cc: Paul Eggert To: bug-gnu-emacs@gnu.org From: Ken Brown Subject: readlinkat and _FORTIFY_SOURCE on Cygwin Message-ID: <27a80447-e39b-0099-6063-1ab3517f668c@cornell.edu> Date: Fri, 19 Jan 2018 15:46:39 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-PMX-Cornell-Gauge: Gauge=X X-PMX-CORNELL-AUTH-RESULTS: dkim-out=none; X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.4 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.4 (----) The next release of Cygwin (2.10.0), expected within the next few weeks, is going to have a new implementation of _FORTIFY_SOURCE guards for many functions, including readlinkat. The implementation is based on that of NetBSD and has the effect of adding code that looks essentially as follows after preprocessing: ssize_t __ssp_real_readlinkat (int __dirfd1, const char *__path, char *__buf, size_t __len) __asm__("readlinkat"); extern __inline__ __attribute__((__always_inline__, __gnu_inline__)) ssize_t readlinkat (int __dirfd1, const char *__path, char *__buf, size_t __len) __asm__("__ssp_protected_readlinkat"); extern __inline__ __attribute__((__always_inline__, __gnu_inline__)) ssize_t readlinkat (int __dirfd1, const char *__path, char *__buf, size_t __len) { if (__builtin_object_size(__buf, 2 > 1) != (size_t)-1 && __len > __builtin_object_size(__buf, 2 > 1)) __chk_fail(); return __ssp_real_readlinkat (__dirfd1, __path, __buf, __len); } The occurrence of this code in fileio.c, combined with the use of a pointer to readlinkat in the definition of emacs_readlinkat, leads to an "undefined reference to `__ssp_protected_readlinkat'" linking error. I'd appreciate some advice on how to fix this. I can think of three possibilities, but maybe there's something better: 1. Add "#define _FORTIFY_SOURCE 0' at the top of fileio.c (Cygwin only). 2. Pretend like Cygwin doesn't have readlinkat. Then gnulib will create its own definition, which will be found by the linker in libegnu.a. 3. Ask gnulib to come up with a fix. Thanks in advance for any advice. Ken From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 19 18:25:12 2018 Received: (at 30176) by debbugs.gnu.org; 19 Jan 2018 23:25:13 +0000 Received: from localhost ([127.0.0.1]:35347 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ecg24-0003Q4-G8 for submit@debbugs.gnu.org; Fri, 19 Jan 2018 18:25:12 -0500 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:43702) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ecg21-0003Pl-Vr for 30176@debbugs.gnu.org; Fri, 19 Jan 2018 18:25:10 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id D3E6E1615E2; Fri, 19 Jan 2018 15:25:03 -0800 (PST) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id DaRxJ3MB3y5V; Fri, 19 Jan 2018 15:25:03 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 29E6C1616A5; Fri, 19 Jan 2018 15:25:03 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id nl_7FkEUCmZ6; Fri, 19 Jan 2018 15:25:03 -0800 (PST) Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id F107A1615E2; Fri, 19 Jan 2018 15:25:02 -0800 (PST) Subject: Re: bug#30176: readlinkat and _FORTIFY_SOURCE on Cygwin To: Ken Brown , 30176@debbugs.gnu.org References: <27a80447-e39b-0099-6063-1ab3517f668c@cornell.edu> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: <884dbad2-610c-63c5-679d-4b1549afac32@cs.ucla.edu> Date: Fri, 19 Jan 2018 15:25:02 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <27a80447-e39b-0099-6063-1ab3517f668c@cornell.edu> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 30176 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) On 01/19/2018 12:46 PM, Ken Brown wrote: > I can think of three possibilities, but maybe there's something better: > > 1. Add "#define _FORTIFY_SOURCE 0' at the top of fileio.c (Cygwin only)= . > > 2. Pretend like Cygwin doesn't have readlinkat.=C2=A0 Then gnulib will=20 > create its own definition, which will be found by the linker in=20 > libegnu.a. > > 3. Ask gnulib to come up with a fix. (2) is presumably not good, since the substitute readlinkat will have to=20 execute several system calls and this will be problematic. (1) should work but kind of misses the point of fortification. I don't know what would be involved in (3). How about a better option, like this: 4. Fix Cygwin readlinkat so that it can be used as a function pointer=20 even when _FORTIFY_SOURCE is used. Why not do what glibc does with readlinkat? It fortifies readlinkat, and=20 doesn't run into this problem. From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 20 07:30:44 2018 Received: (at 30176-done) by debbugs.gnu.org; 20 Jan 2018 12:30:44 +0000 Received: from localhost ([127.0.0.1]:35652 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ecsIF-0002Ex-U8 for submit@debbugs.gnu.org; Sat, 20 Jan 2018 07:30:44 -0500 Received: from limerock01.mail.cornell.edu ([128.84.13.241]:33841) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ecsIE-000284-UK for 30176-done@debbugs.gnu.org; Sat, 20 Jan 2018 07:30:43 -0500 X-CornellRouted: This message has been Routed already. Received: from authusersmtp.mail.cornell.edu (granite4.serverfarm.cornell.edu [10.16.197.9]) by limerock01.mail.cornell.edu (8.14.4/8.14.4_cu) with ESMTP id w0KCUT1p028288; Sat, 20 Jan 2018 07:30:29 -0500 Received: from [10.13.22.4] (50-192-26-108-static.hfc.comcastbusiness.net [50.192.26.108]) (authenticated bits=0) by authusersmtp.mail.cornell.edu (8.14.4/8.12.10) with ESMTP id w0KCURmL005740 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Sat, 20 Jan 2018 07:30:28 -0500 Subject: Re: bug#30176: readlinkat and _FORTIFY_SOURCE on Cygwin To: Paul Eggert , 30176-done@debbugs.gnu.org References: <27a80447-e39b-0099-6063-1ab3517f668c@cornell.edu> <884dbad2-610c-63c5-679d-4b1549afac32@cs.ucla.edu> From: Ken Brown Message-ID: Date: Sat, 20 Jan 2018 07:30:26 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <884dbad2-610c-63c5-679d-4b1549afac32@cs.ucla.edu> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-PMX-Cornell-Gauge: Gauge=X X-PMX-CORNELL-AUTH-RESULTS: dkim-out=none; X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 30176-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) On 1/19/2018 6:25 PM, Paul Eggert wrote: > 4. Fix Cygwin readlinkat so that it can be used as a function pointer > even when _FORTIFY_SOURCE is used. > > Why not do what glibc does with readlinkat? It fortifies readlinkat, and > doesn't run into this problem. Sorry, that was stupid of me. I don't know why I was thinking that this was an Emacs issue. Ken From unknown Mon Jun 23 16:44:08 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 18 Feb 2018 12:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator