From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by sourceware.org (Postfix) with ESMTPS id D68173858D35; Fri, 10 Dec 2021 13:16:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D68173858D35 Received: by mail-pj1-x102f.google.com with SMTP id np6-20020a17090b4c4600b001a90b011e06so7472369pjb.5; Fri, 10 Dec 2021 05:16:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=f9xbvgG3nTLKmRvQSGzWQe9zB/GHFNjypmf8BkxsrAo=; b=KE6BiadsEzLCrWSoTXuxicSYne7EcM7rmwerXaz2puMxCqs+9DbjVlthw9GTG7LSPd Yfd5lwoaQcyv9a7H8SThTvydNq+YsQJjHNoUjUAuCkktbFiMUgC+2uUAgpWKYggfkcLx cFGWNjpRdgU5ok3E2vtM1nUujSN77lrxeRA98qdc3r/T9C6gcj//vT0h/uDiBbnx3o9D l5Ddb5rI3JsDwDw3WqAhtiVusweRLuAu20+tcwWyVcX+KFopk69L+U4tZDvahbRp28Qy ltNmCenWzRWo1/xCztgfco6DNt2/A/ZMpHegh/h8WIwfumyVkxVtycl3Q7ytpmxTUlpW Xamg== X-Gm-Message-State: AOAM531LOPZFcEu5bFoBr7IdtcL5evjgu689AR80kKpe9+7iCrPH4rrD 4MIw0e9XOYsm/cYc/gWghuzaJjMcT6rcR4VhD1A= X-Google-Smtp-Source: ABdhPJw3Nx4HNy11icHyT4+zREwQyqpkdEUYxoBSfYqHrKIPIp+cYdL8g0rhrW2OChkyklnGfP9Y5kELJUpd3RcKSNA= X-Received: by 2002:a17:902:cecf:b0:141:e15d:4a2a with SMTP id d15-20020a170902cecf00b00141e15d4a2amr74941362plg.66.1639142193876; Fri, 10 Dec 2021 05:16:33 -0800 (PST) MIME-Version: 1.0 References: <20211210023106.3564447-1-hjl.tools@gmail.com> <877dcddr60.fsf@oldenburg.str.redhat.com> <87ilvxc7sg.fsf@oldenburg.str.redhat.com> In-Reply-To: <87ilvxc7sg.fsf@oldenburg.str.redhat.com> From: "H.J. Lu" Date: Fri, 10 Dec 2021 05:15:58 -0800 Message-ID: Subject: Re: [PATCH v3] elf: Stop with zero entry point value [BZ #28453] To: Florian Weimer Cc: Siddhesh Poyarekar , "H.J. Lu via Libc-alpha" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3028.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Dec 2021 13:16:36 -0000 On Thu, Dec 9, 2021 at 10:07 PM Florian Weimer wrote: > > * H. J. Lu: > > > diff --git a/elf/rtld.c b/elf/rtld.c > > index 6ce1e07dc0..7d1801c51c 100644 > > --- a/elf/rtld.c > > +++ b/elf/rtld.c > > @@ -2491,6 +2491,12 @@ dl_main (const ElfW(Phdr) *phdr, > > rtld_timer_accum (&relocate_time, start); > > } > > > > + /* Stop if there is no associated entry point. */ > > + if (rtld_is_main && main_map->l_entry == main_map->l_addr) > > + _dl_fatal_printf("%s: cannot execute shared object '%s' directly " > > + "without entry point\n", > > + ld_so_name, rtld_progname); > > + > > /* Relocation is complete. Perform early libc initialization. This > > is the initial libc, even if audit modules have been loaded with > > other libcs. */ > > I think this is still too early for full backwards compatibility. > > However, the bug you are actually trying to fix occurs during > relocation, so it looks to me as if using entry point addresses as an > indicator will not actually work. And entry point zero is generated by > recent binutils only anyway. True. There is no easy way to identify a wrong entry point generated by the old linkers. > Thanks, > Florian > -- H.J.