From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) by sourceware.org (Postfix) with ESMTPS id 2EFCB3858D28 for ; Fri, 5 Nov 2021 15:03:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2EFCB3858D28 Received: by mail-pg1-x531.google.com with SMTP id s136so8606119pgs.4 for ; Fri, 05 Nov 2021 08:03:48 -0700 (PDT) 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=bVkWTG1Aw4Rqog1sD/TRmjU9YBYx1gg5xZ9CkxKwcdg=; b=K9uqhgGIssGLbkmwZGNFVALSP7XHTbMhjgHZDep9t95LAL9FxlaLf4JxPS0hixHih1 AROVW7Sui5X5a8vB3OLJhQpNPexafJ/bSbM/BJxaDQ59y8zLo1LM/Wq2Is6R9FsWge/M j2jSs/3qcaRdwvbR90NlGPBGybUms8doXwjFe6SkFFO0gP2x69IN6mlQ78/od1XO5AMT ZukkCynqpdVlYRy7RlbCvEXwQQs4+Ie4NhNEBwFk4bY8aixMKKDblVteP2r2dUMQf4oB L1hfVTMybVrWbkVwFXfgX/sXKA7c1s2Atgdua2/pyNQuU3JNvnUjVGyLmqdaEtziyyeL B6GA== X-Gm-Message-State: AOAM533BdzxMUQZvT09JLWPGKHeDz+GMaO63WN50e7Y9MNxsIwr4Tube /dYU1lR8zfq8SNK8t5qkaVJF95ma3+RE2fY5xFnASlNP8vI= X-Google-Smtp-Source: ABdhPJzoKrCUj1gen8/H1m+UH7czXy1vQqMb4betMRnHJG3GbIKcb1tZdO9ch+KetnwNVZbRRrX10DKGvlIsrM6iT8E= X-Received: by 2002:a63:87c1:: with SMTP id i184mr27662592pge.75.1636124627269; Fri, 05 Nov 2021 08:03:47 -0700 (PDT) MIME-Version: 1.0 References: <27f078539ae2a5b390705ac6fa1a7437ae8ce97c.1636120354.git.fweimer@redhat.com> <87r1buu10l.fsf@oldenburg.str.redhat.com> <87ilx6u0kj.fsf@oldenburg.str.redhat.com> In-Reply-To: <87ilx6u0kj.fsf@oldenburg.str.redhat.com> From: "H.J. Lu" Date: Fri, 5 Nov 2021 08:03:11 -0700 Message-ID: Subject: Re: [PATCH 2/2] elf: Detect PT_LOAD segments that extend beyond EOF and refuse loading To: Florian Weimer Cc: GNU C Library Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3023.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, 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, 05 Nov 2021 15:03:49 -0000 On Fri, Nov 5, 2021 at 7:41 AM Florian Weimer wrote: > > * H. J. Lu: > > > So dlopen should reject it. Can you identify the broken tools which > > generate such input files and black list them for this test? > > It's objcopy --only-keep-debug, and it behaves as expted Separated > debuginfo is broken by design. The program headers do not correspond to > the file contents, but match the original ELF file. So the current checks aren't sufficient and your patch also checks file size. On x86-64, where is the first failed check? Why doesn't it need to check file size? > > Of course, ld.so can improve sanity checks. But we need really broken > > inputs for such checks. > > elf/tst-debug1 deliberately uses a broken input file. > > Thanks, > Florian > -- H.J.