Received: from mx1.tetrasec.net (mx1.tetrasec.net [66.245.176.36]) by nld3-dev1.alpinelinux.org (Postfix) with ESMTPS id CED2D7818B9 for <~alpine/users@lists.alpinelinux.org>; Fri, 27 Mar 2020 15:19:29 +0000 (UTC) Received: from mx1.tetrasec.net (mail.local [127.0.0.1]) by mx1.tetrasec.net (Postfix) with ESMTP id 3454661D53; Fri, 27 Mar 2020 15:19:29 +0000 (UTC) Received: from ncopa-desktop.copa.dup.pw (67.63.200.37.customer.cdi.no [37.200.63.67]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: alpine@tanael.org) by mx1.tetrasec.net (Postfix) with ESMTPSA id EF27C61D50; Fri, 27 Mar 2020 15:19:27 +0000 (UTC) Date: Fri, 27 Mar 2020 16:19:18 +0100 From: Natanael Copa To: Henrik Holst Cc: ~alpine/users@lists.alpinelinux.org Subject: Re: tini-static dynamically linked Message-ID: <20200327161918.4aedc0ca@ncopa-desktop.copa.dup.pw> In-Reply-To: References: X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-alpine-linux-musl) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Fri, 27 Mar 2020 14:48:44 +0100 Henrik Holst wrote: > Hi, > > I installed the tini-static package and I was surprised that file > report it as a dynamically linked binary? > > /opt/certbot # file /sbin/tini-static > /sbin/tini-static: ELF 64-bit LSB pie executable, x86-64, version 1 > (SYSV), dynamically linked, stripped > > Is this a bug? Seems to me it would be a bug that a static package is > dynamically linked even if just formally. > > Thanks > Henrik Holst It is really statically linked, but it is linked as PIE: $ readelf -d /sbin/tini-static Dynamic section at offset 0xae70 contains 16 entries: Tag Type Name/Value 0x000000000000000c (INIT) 0x1000 0x000000000000000d (FINI) 0x7a2e 0x000000006ffffef5 (GNU_HASH) 0x200 0x0000000000000005 (STRTAB) 0x4b0 0x0000000000000006 (SYMTAB) 0x2b8 0x000000000000000a (STRSZ) 193 (bytes) 0x000000000000000b (SYMENT) 24 (bytes) 0x0000000000000015 (DEBUG) 0x0 0x0000000000000003 (PLTGOT) 0xbfb0 0x0000000000000007 (RELA) 0x578 0x0000000000000008 (RELASZ) 1056 (bytes) 0x0000000000000009 (RELAENT) 24 (bytes) 0x0000000000000018 (BIND_NOW) 0x000000006ffffffb (FLAGS_1) Flags: NOW PIE 0x000000006ffffff9 (RELACOUNT) 44 0x0000000000000000 (NULL) 0x0 As you see, it is not linked to anything (no (NEEDED)). The benefit with linking it as PIE (position independent executable) is that it give full address space layout randomization (ASLR), even if it is linked statically. Side effect is that is marked as ET_DYN in the elf header and looks like a dynamically linked executable. -nc