From patchwork Tue Aug 4 20:52:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Maciej W. Rozycki" X-Patchwork-Id: 503800 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3A3A41402D0 for ; Wed, 5 Aug 2015 06:52:14 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=WiDewCK1; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:subject:in-reply-to:message-id :references:mime-version:content-type; q=dns; s=default; b=Q63pS wgCOWnKBaCGVzmZnbwBQLeoQk1WR/9/ZlfrtyRD0SFoOVvaIxYUM+WHd4DRppI16 TcoznQfuFz7VIANrT2XVepL2XaioraccytRT2XBfqUaUnwQzK4oB5KjjwULkzt9m znb2Uh0vnfVEDG66dhRKQcVsygtgTPSFkfMqYU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:subject:in-reply-to:message-id :references:mime-version:content-type; s=default; bh=1p1Z8ayl+EL tCIEKbwZiC9GpfSs=; b=WiDewCK1WElzvTHKALlKVZMXXGiyG3Bmihk+OQ/Riz4 di0Rtd3PnS488uAag3yPd9bG4Sc2Ybd4idDjdAbgngf/LQLDK8dtZY0AVTYku9nW W4gtS1XnZku38efXaLWdzS5NiNkk92oPxMLY9nOWcf0EbHW5g0I1q99TUbs0pd2s = Received: (qmail 66392 invoked by alias); 4 Aug 2015 20:52:08 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 66380 invoked by uid 89); 4 Aug 2015 20:52:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=no version=3.3.2 X-HELO: cvs.linux-mips.org Date: Tue, 4 Aug 2015 21:52:03 +0100 (BST) From: "Maciej W. Rozycki" To: Andreas Schwab cc: Roland McGrath , =?ISO-8859-2?Q?Ond=F8ej_B=EDlka?= , Allan McRae , libc-alpha@sourceware.org Subject: [PATCH][BZ #17250] Static dlopen default library search path fix In-Reply-To: Message-ID: References: <20131017174710.GA4993@domone.podge> <20131025210328.39E69746B6@topped-with-meat.com> <20140116203847.GB20838@domone.podge> <20140117233957.64E307441B@topped-with-meat.com> User-Agent: Alpine 2.20 (LFD 67 2015-01-07) MIME-Version: 1.0 On Tue, 4 Aug 2015, Andreas Schwab wrote: > > What problem are you seeing or trying to solve? > > https://sourceware.org/bugzilla/show_bug.cgi?id=17250 Umm, thanks. Having looked through the patch again it looks to me like I got confused with the negative `__builtin_expect' expression. My change was not neutral as intended as it's where DF_1_NODEFLIB is *set* that the conditional executes. So the solution is to leave `.l_flags_1' clear in the static link map, and I can see `__builtin_expect' has been since changed in elf/dl-load.c to `__glibc_unlikely' already so nothing to do here; obviously I must have not been the only one getting confused here. I'm not prepared to properly regression-test a change right away, but meanwhile can you try the below as a proposed fix? Also I'm not sure offhand how to make a test case that covers this issue, but I'll be happy to accept ideas and implement them. 2015-08-04 Maciej W. Rozycki [BZ #17250] * elf/dl-support.c (_dl_main_map): Don't initialize l_flags_1 member. Maciej glibc-static-dlopen-17250.diff Index: glibc/elf/dl-support.c =================================================================== --- glibc.orig/elf/dl-support.c 2015-08-04 20:10:10.297536823 +0100 +++ glibc/elf/dl-support.c 2015-08-04 20:10:33.180771532 +0100 @@ -91,7 +91,6 @@ static struct link_map _dl_main_map = .l_scope = _dl_main_map.l_scope_mem, .l_local_scope = { &_dl_main_map.l_searchlist }, .l_used = 1, - .l_flags_1 = DF_1_NODEFLIB, .l_tls_offset = NO_TLS_OFFSET, .l_serial = 1, };