From patchwork Thu Dec 1 16:25:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Liebler X-Patchwork-Id: 86098 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp771760qgi; Thu, 1 Dec 2016 08:25:39 -0800 (PST) X-Received: by 10.84.197.165 with SMTP id n34mr87471005pld.34.1480609539623; Thu, 01 Dec 2016 08:25:39 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id e70si709994pfj.217.2016.12.01.08.25.39 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Dec 2016 08:25:39 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-75392-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org; spf=pass (google.com: domain of libc-alpha-return-75392-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-75392-patch=linaro.org@sourceware.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:from:cc:date :mime-version:in-reply-to:content-type:message-id; q=dns; s= default; b=vLX8k8bhCRDTJppOl5L0gPU8+HuraVVztZXdROglLrhD3bbVciCS1 1iHndGRmVFANpvFibsrb6AAOS3lFw0R/CtemfiD8QFG3W2+uZ3KnbeYhaYAkXAOI U0672I8SZouEb6lB9EMCivRTYjgQX7RCbahhKeQatTiQGZLwl30JEU= 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:subject:to:references:from:cc:date :mime-version:in-reply-to:content-type:message-id; s=default; bh=zYqkaMIWBl0sLbobfxJFiIqQdSA=; b=iVvugvZI6vcryBQkT217oKSFPT04 0bLwTnwWODuoDwdm220QM5LqAItex2R4tVZq60qnVJffnBQ4R9uMUcmOc25F7wWX uSFhRU1uz4mAl8dxZhiqKcNt+NFRMAvJrTNuMSxoIBg1E1hkKHU5Z2n566J+MMgw DVMnsjRZ8U8QbYo= Received: (qmail 84416 invoked by alias); 1 Dec 2016 16:25:30 -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 84403 invoked by uid 89); 1 Dec 2016 16:25:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW, RCVD_IN_SEMBACKSCATTER autolearn=no version=3.3.2 spammy=H*MI:vnet, skips, stefan, Stefan X-HELO: mx0a-001b2d01.pphosted.com Subject: Re: [PATCH] Implement _dl_catch_error, _dl_signal_error in libc.so [BZ #16628] To: libc-alpha@sourceware.org References: <7650651f-f268-6405-c04c-61aa18d166f9@redhat.com> <78fc80c3-d047-2b41-b600-8003f5937ac3@redhat.com> From: Stefan Liebler Cc: Florian Weimer Date: Thu, 1 Dec 2016 17:25:19 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <78fc80c3-d047-2b41-b600-8003f5937ac3@redhat.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16120116-0040-0000-0000-0000026D948C X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16120116-0041-0000-0000-000022C9794E Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-12-01_13:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1612010281 On 11/29/2016 06:31 PM, Florian Weimer wrote: > On 11/14/2016 04:07 PM, Florian Weimer wrote: >> The attached patch depends on the elf/dl-load.c clean I posted today, >> and the addition of the __sigsetjmp hidden definitions on architectures >> which lack them. >> >> The removal of the two function pointers from libc.so (the one in >> rtld_global, and the receiver pointer internal to elf/dl-error.c) is >> desirable from a security perspective, too. > > I added a test. This is what I want to commit soon unless some objects. > > Thanks, > Florian > Hi Florian, The first dlopen ("tst-latepthreadmod.so", RTLD_LOCAL | RTLD_LAZY) call in elf/tst-latepthread.c fails on s390x with "error: dlopen failed: .../build-s390x/elf/tst-latepthreadmod.so: undefined symbol: this_function_is_not_defined". In elf/tst-latepthreadmod.c, this_function_is_not_defined is a sibling call which leads to a R_390_GLOB_DAT relocation in .rela.dyn instead of a R_390_JMP_SLOT in .rela.plt. As RTLD_LAZY skips the JMP_SLOT relocations, but not GLOB_DAT ones, the dlopen call fails. If elf/tst-latepthreadmod.c is build with -fno-optimize-sibling-calls, a JMP_SLOT relocation is generated for this_function_is_not_defined and the test passes. Okay to commit? Bye. Stefan --- ChangeLog: * elf/Makefile (CFLAGS-tst-latepthreadmod.c): Add -fno-optimize-sibling-calls. diff --git a/elf/Makefile b/elf/Makefile index 33b003b..18b3e2a 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -1271,6 +1271,9 @@ LDFLAGS-tst-audit12mod2.so = -Wl,--version-script=tst-audit12mod2.map # Force lazy binding for the same reason. LDFLAGS-tst-latepthreadmod.so = \ -Wl,-z,lazy -Wl,--unresolved-symbols=ignore-all +# Do not optimize sibling calls as the test relies on a JMP_SLOT relocation for +# function this_function_is_not_defined. +CFLAGS-tst-latepthreadmod.c = -fno-optimize-sibling-calls $(objpfx)tst-latepthreadmod.so: $(shared-thread-library) $(objpfx)tst-latepthread: $(libdl) $(objpfx)tst-latepthread.out: $(objpfx)tst-latepthreadmod.so