From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-4.1 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 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 dcvr.yhbt.net (Postfix) with ESMTPS id E92B11F453 for ; Mon, 29 Apr 2019 21:35:27 +0000 (UTC) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version:content-type; q=dns; s=default; b=s2hzz ATSy5Jl+vPojswz2Rx89t1nNl9r4VpDpMByT7EcTovKVvblKl6P52qGhUkymxs7k mjMT7IOS8L8KdC3wPPZmnNeOyPLzK3mXbEgHuuTRZ+6D8wlGoi/JEP5P/UCJZvGA rmqYz4MAD4Wvtl+vhoYIuaEwpBgSelv/LvmLm8= 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:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version:content-type; s=default; bh=S4st1q9SOas tBMhVbkGjQC1vE/o=; b=IrtkwSu9BXp9xDWfs3JNSQd9AxVHF7nNDoKO6OVwDVc oLaA2ut/U4IoRtJrt1GNqkVIYUKF52mvVw6pCTFG2VtBy5IdYLgGuzDuyhlFHw6m cNlTKA+vsJO/Jmyollr0nbgMQ2P6Jz0zQVfpehE4bdG+yuq6/EXtf/mL6BNYdKHU = Received: (qmail 42817 invoked by alias); 29 Apr 2019 21:35:25 -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 Received: (qmail 42808 invoked by uid 89); 29 Apr 2019 21:35:25 -0000 Authentication-Results: sourceware.org; auth=none X-HELO: mx1.redhat.com From: Florian Weimer To: Carlos O'Donell Cc: libc-alpha@sourceware.org Subject: Re: [PATCH] elf: Refuse to dlopen PIE objects [BZ #24323] References: <20190312130235.8E82C89CE49C@oldenburg2.str.redhat.com> Date: Mon, 29 Apr 2019 23:35:20 +0200 In-Reply-To: (Carlos O'Donell's message of "Mon, 29 Apr 2019 17:18:53 -0400") Message-ID: <87r29kbilj.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain * Carlos O'Donell: >> ifeq (yes,$(build-shared)) >> # NB: Please keep cet-built-dso in sysdeps/x86/Makefile in sync with >> diff --git a/elf/dl-load.c b/elf/dl-load.c >> index 2bbef81b6e..9b0c1406c9 100644 >> --- a/elf/dl-load.c >> +++ b/elf/dl-load.c >> @@ -1158,6 +1158,10 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd, >> goto call_lose; >> } >> + /* dlopen of an executable is not valid because it is not >> possible >> + to perform proper relocations and run the ELF constructors. >> + For PIE, the check needs the dynamic section, so there is >> + another check below. */ > > Suggest you mention exactly which relocations are the problem. > I assume it's COPY relocs into the main executable which can't be > done twice, because both execs will want to reference their own > copy. Likewise the problem with ELF constructors should be expanded > with more details. I assume that static TLS is also negatively impacted. TLS variables from the dlopen'ed PIE binary and the real main program will probably overlap. Thanks, Florian