From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/10779 Path: news.gmane.org!.POSTED!not-for-mail From: Laine Gholson Newsgroups: gmane.linux.lib.musl.general Subject: Re: ldd not working on ET_EXEC executables Date: Thu, 8 Dec 2016 16:30:42 -0600 Message-ID: References: <20161206023325.GH1555@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1481236260 21253 195.159.176.226 (8 Dec 2016 22:31:00 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 8 Dec 2016 22:31:00 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux armv7l; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 To: musl@lists.openwall.com Original-X-From: musl-return-10792-gllmg-musl=m.gmane.org@lists.openwall.com Thu Dec 08 23:30:56 2016 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1cF7DM-00050z-Af for gllmg-musl@m.gmane.org; Thu, 08 Dec 2016 23:30:56 +0100 Original-Received: (qmail 16179 invoked by uid 550); 8 Dec 2016 22:30:58 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 16161 invoked from network); 8 Dec 2016 22:30:58 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=/kVU6cquDQLJQMvInUoaBSbREweeU+B8uHgbrH6vQ4k=; b=Zg2eB+NE43ZJEq7ZKVUOmEVoaqQ0w+4mOgzO26o6N+4f/me63E1UPPRrD65HFD+C4X EAVh6kR+EYfVNtqZbB9KqdMaaSMXWgy6FU02S2kqB3ZfyVtxLEPiBZUZniTq3c7DXbNJ isKOfbVyw2UGdiYnVB/zlLn2VlPfhY8c8bhYcgluP/Dzfupdw4eTr+a6zUP+hXOKYqsL egFBLV5EDckh/NmHVVBmwEwZCisD/tzRjf0F4zBdiI/SW7XgAD1wQoRmiDciogBATuQ3 qBAtBhpXpdLD2W1wIFi2EOaGoVDB7+loUlbHmn0KXROJQ/yAmQjgSwOyRD1GnfjclqdV eUYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=/kVU6cquDQLJQMvInUoaBSbREweeU+B8uHgbrH6vQ4k=; b=LV93fi2qSEiF7N9mFQOVZJqsMjLSLcqCKVvP7ebZRHFtW4Fz+Ey9lzpQUIn3gHYshj 2SeN3DsPogDMC+X2jddTziogB1+de2dadz8I8WxfQSLO/gWX7f7+5iW/+oehggK7HLsC 1r89z6jXZedsAdhIciJLFUKQiKBamAaj2lrvSQPycyGRwue5oire7CRAmzqAnKbcx1RI B/Z3UAvY7SANafet3g+g8a4W0WfBmoklRb7nJlLNf0qtPrRTF1LqCeR+g1KrgsWYMoll /19DXUYK5I2hDcV+CvYQdiek3MKA9jJ2b6+MrC8u/+tha/GxPwF4S3sYoOAbOxfXKuKt 5mSQ== X-Gm-Message-State: AKaTC03twEg/Q5pomr1r5EywP2SMgQn8KkA2xVrL5BRrrWS7Eu/5bEgwZFJR9wEsaEiWeA== X-Received: by 10.107.156.67 with SMTP id f64mr33588081ioe.173.1481236246031; Thu, 08 Dec 2016 14:30:46 -0800 (PST) In-Reply-To: <20161206023325.GH1555@brightrain.aerifal.cx> Xref: news.gmane.org gmane.linux.lib.musl.general:10779 Archived-At: You mean RANDMMAP? PaX's RANDMMAP feature ignoring the address your requesting it (without MAP_FIXED) is perfectly valid, to quote POSIX: "When MAP_FIXED is not set, the implementation uses addr in an implementation-defined manner to arrive at pa." mmap2(0x10000, 73728, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x1234abcd You're not passing MAP_FIXED to mmap() but are expecting the kernel to still use the address you're giving it, which is wrong. (as a side note, glibc works and it uses MAP_FIXED) Thanks, Laine Gholson On 12/05/16 20:33, Rich Felker wrote: > On Mon, Dec 05, 2016 at 07:39:32PM -0600, Laine Gholson wrote: >> Hello, >> >> I am running musl on a ARM platform, and ldd won't work on a executable with the ET_EXEC type. >> >> running GNU ld 2.25.1, gcc 6.2.0, and musl 1.1.15-git-71-g54991729 >> >> $ gcc -fPIE -pie test.c -o test-pie >> $ ldd test-pie >> >> $ gcc -fno-PIE -no-pie test.c -o test-nopie >> $ ldd test-nopie >> ldd: test-nopie: Not a valid dynamic program >> $ elfedit --output-type DYN test-nopie >> $ ldd test-nopie >> >> >> Any idea why ldd says executables with the ET_EXEC type aren't valid? > > strace it; I suspect you'll find that mmap is not honoring the > requested address. This is a bug introduced intentionally by grsec/pax > and perhaps other hardened kernels. > > Rich >