From owner-freebsd-current@FreeBSD.ORG Wed Jul 31 06:36:25 2013 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 0F9A86B7; Wed, 31 Jul 2013 06:36:25 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id BA9522C66; Wed, 31 Jul 2013 06:36:24 +0000 (UTC) Received: from Julian-MBP3.local (etroy.elischer.org [121.45.226.51]) (authenticated bits=0) by vps1.elischer.org (8.14.7/8.14.6) with ESMTP id r6V6aJRl031890 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Tue, 30 Jul 2013 23:36:21 -0700 (PDT) (envelope-from julian@freebsd.org) Message-ID: <51F8B05E.5030003@freebsd.org> Date: Wed, 31 Jul 2013 14:36:14 +0800 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 MIME-Version: 1.0 To: Mateusz Guzik , Mark Johnston , Gennady Proskurin , freebsd-current@freebsd.org Subject: Re: ldd runs linux programs References: <20130728193110.GB17514@gpr.nnz-home.ru> <20130728204958.GA32322@dft-labs.eu> <51F5D491.1080803@freebsd.org> <20130729081254.GB32322@dft-labs.eu> <20130729155625.GA2544@charmander> <20130729205449.GA6007@dft-labs.eu> In-Reply-To: <20130729205449.GA6007@dft-labs.eu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jul 2013 06:36:25 -0000 On 7/30/13 4:54 AM, Mateusz Guzik wrote: > On Mon, Jul 29, 2013 at 11:56:25AM -0400, Mark Johnston wrote: >>> 127276 suggests running the binary as is (which I don't like) and >>> achieves this with a hacky way. So if we really want to do this, the >>> patch should be reworked to detect Linux binaries properly. >>> >>> In general we should gain linux_ldd (like linux_kdump) and our ldd >>> should work only on FreeBSD binaries. The last part is achieved with my >>> patch. >>> >>> markj, are you working on this? >> Not really; my original fix for this problem was essentially the same as >> yours. That is, just change ldd(1) to bail if the OS ABI byte isn't >> equal to ELFOSABI_FREEBSD. That's the change I have committed in my >> local tree right now. >> >> Then I thought I'd try to get ldd to work properly with Linux binaries >> as well, but wasn't sure what the right approach should be. As the above >> PR suggests, the easy thing to do is to just pass >> LD_TRACE_LOADED_OBJECTS and not LD_32_TRACE_LOADED_OBJECTS for 32-bit >> ELF objects if the OS isn't FreeBSD. This feels somewhat hacky to me, >> but I didn't really see another approach. >> >> That said, I think your patch should be committed since it's clearly an >> improvement over the current behaviour. I'm willing to test and commit >> it, and clean up the open PRs. If you could expand on the right way to >> handle Linux binaries, I'd be willing to implement and commit that too. >> I don't quite understand your reference to linux_kdump though - I have >> no such program on my laptop running CURRENT, and ktrace+kdump seem to >> work fine with the Linux binaries under /compat/linux. >> > Well, there was linux_kdump in ports but it apparently got obsolete as > necessary support for included in our regular kdump. > > So it may make sense to teach our ldd how to deal with Linux binaries > for consistency, but its unclear for me if this is better than providing > linux_ldd. Also there is the problem of (not) appending /compat/linux to > printed paths (for Linux binaries the kernel performs file lookups against > /compat/linux first). I'm not that interested in this problem though. :P > > That being said, if you want to do something with this, I suggest > cleaning up PRs and reviving discussion in > http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/127276 if linux binaries are installed then chain to libexec/linux-ldd just like fsck chains to various specific fsck binaries. If there is no such chain loadable ldd, then just refuse to do anything. >