From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 1736 invoked from network); 6 Jun 2023 06:43:05 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 6 Jun 2023 06:43:05 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1686033785; b=ktG44ZtrYIq3l5koTXhqXOvAQNGKNENzDx8Xp43GDmEY7K30FxOtYLIDs7oylGgaBKL/iNTRP2 +rE5J7ESKMsKpImKoORYtfyEtS4HNJJCbQLikzHx+gb0w8wZxLNxFJEERB2k3EK9t/5P3Cm6cc QgF4B2P6AmkFPvPM+legIh9eEGaGSilvNDk7Z5jkA68vrI9Bj/JYvC2O3Nu8aCef9mSf1iQerC VlEIXkzmg+Zu2CtUKl9yrNeY0UPnzFvXTkBmTzU/6sZpIXXKd7AYbJKTRYUCSpSXJNvmoZi/Yj NuXjZ40XaXkUHeTnuew2o0VMWksjB5zGEyqTX21rhtCnPA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (snd00002-bg.im.kddi.ne.jp) smtp.remote-ip=27.86.113.2; dmarc=none header.from=kba.biglobe.ne.jp; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1686033785; bh=1bqZPJfeWAKPdsfmp/j3cfOKXwNWfdIgy+9ZreMl0do=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Message-ID:In-Reply-To:To:References:Date:Subject: MIME-Version:Content-Transfer-Encoding:Content-Type:From:DKIM-Signature; b=U77Juw7dH1TydS7pq7JgEDWUgQXdHHWNh63K33iBWEv+QJaLZ9ov8tI+ro5mAScPcSGIoweRlv 2TvrNjasPcNb9ckMeOCe1iKgB6BhS7mJHQwGbCU+yIh+Z6mrOMJ5lqPy55R1QhYPOaAjKGr9gD Twg4nPi7nLd14EpX417cOkbxuFfFC+2oGVjNokNMGBf1AU+VJ6ZXZg4780Z2ZNUNhyZ0I1cBqa /ByHFsGpnwnA7VF2FN5C+4ojI/H5bWG5cbry/KyiaAkhKAJ5oB2dQ9ubSsRvqccRsCI8BXWBXI 0A3Sv47VKtXboE2qT9O+BSTalhO/VY0y3kVL0N/6mWe+zw==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Message-Id:In-Reply-To:To:References: Date:Subject:Mime-Version:Content-Transfer-Encoding:Content-Type:From: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=XWSgqiM+YICWdpENfD7O+cb5Sz8k0xYJOfJ65rnxRPY=; b=gzpwSDGel/nipIfpm2shJ9bY2Y x3Js5G+oSEu4/Lk+E1gw/WhAjV8u33rG3HJd6/1oM9ryPMcikgITUlpO5Gv6lznzYZnaiXsYPQLC2 4mWz2TJQ2tpxdjTSN6I19+7zPC3fGDRKPv2IszqLAEv1REYI1WOZkhng536y1Fl+8T4vdzkQjlFIs OpBB+nSZBwlQXjPPwrG+Fn7Kfb+IXNPgdep4YdNNHoFZyYUxpFWQ3Vxuy+g+k6ebmIJsJK0zqqfPW bOUb5eaWjvSPb2ThjnNRM4t41Ed9W1/PXTW3IsXcm666i2WkWjRUEh1PtyuHHy59PVimivhZql5DQ clEnmVmA==; Received: by zero.zsh.org with local id 1q6QPH-0002hT-Qu; Tue, 06 Jun 2023 06:43:03 +0000 Authentication-Results: zsh.org; iprev=pass (snd00002-bg.im.kddi.ne.jp) smtp.remote-ip=27.86.113.2; dmarc=none header.from=kba.biglobe.ne.jp; arc=none Received: from snd00002-bg.im.kddi.ne.jp ([27.86.113.2]:37027 helo=dfmta0022.biglobe.ne.jp) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1q6QOf-0002Mo-Q1; Tue, 06 Jun 2023 06:42:27 +0000 Received: from mail.biglobe.ne.jp by omta0022.biglobe.ne.jp with ESMTP id <20230606064218686.QPBH.105816.mail.biglobe.ne.jp@biglobe.ne.jp> for ; Tue, 6 Jun 2023 15:42:18 +0900 From: Jun T Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.21\)) Subject: Re: [Bug] modules zsh/tcp, zsh/zftp unloadable, probably affecting most modern Linuxes Date: Tue, 6 Jun 2023 15:42:17 +0900 References: <027f2a491b638e2ffaf7766fe4adf29537c11fdf.camel@fifi.org> <227fe72b-7441-935c-55a7-421945da54b3@hostalia.de> To: zsh-workers@zsh.org In-Reply-To: Message-Id: X-Mailer: Apple Mail (2.3445.104.21) X-Biglobe-Sender: takimoto-j@kba.biglobe.ne.jp X-Seq: 51834 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: > 2023/06/06 5:07, Bart Schaefer wrote: >=20 > As I understand it that symbol will only be defined by tcp.c if it's > not available from libc or other linked library, so it's not actually > overwriting an identically-named symbol. Yes, I agree, and I think the problem is not in 'freehostent'. I guess the error 'undefined symbol: freehostent' just indicates that 'freehostent' was the _first_ symbol the loader couldn't resolve (and the loader gave up, not trying to resolve other symbols such as zsh_getipnodebyname etc.). But, first of all, why these symbols need be resolved when loading zftp.so, because dlopen() is called as: dlopen("zftp.so", RTLD_LAZY | RTLD_GLOBAL) (module.c:1596) i.e., with the flag RTLD_LAZY? If I build zsh by myself on Debian/Ubuntu/Fedora/CentOS then 'zmodload zsh/zftp' works fine. I don't know how the packages (deb/rpm) are built, but I found a build log of zsh5.9 for Fedora38: = https://kojipkgs.fedoraproject.org//packages/zsh/5.9/5.fc38/data/logs/x86_= 64/build.log The part of the log for creating zftp.so is: gcc -Wl,-z,relro -Wl,--as-needed -Wl,-z,now \ (snip) -z lazy -shared -o zftp.so zftp..o \ -lpcre -ldl -lncursesw -lrt -lm -lc=20 I think the problem is '-Wl,-z,now'. man ld(1) says: now When generating an executable or shared library, mark it to tell the dynamic linker to resolve all symbols when the program is started, or when the shared library is loaded by dlopen, instead of deferring function call resolution to the point when the function is first called. It seems this option has the higher precedence than the option '-z lazy' in the same command line, or the RTLD_LAZY for dlopen(). On Fedora-38: % readelf --dynamic /usr/lib64/zsh/5.9/zsh/zftp.so | grep FLAG 0x000000000000001e (FLAGS) BIND_NOW 0x000000006ffffffb (FLAGS_1) Flags: NOW I think this flag in zftp.so is the result of '-z now' On Debian-11, /usr/lib/x86_64-linux-gnu/zsh/5.8/zsh/zftp.so has the same flag. I guess Debian binary package is also built with '-z now'. The zftp.so built by myself does not have this flag. Why '-z now' is used when building binary packages? For security?=