From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by sourceware.org (Postfix) with ESMTPS id 699B0385AC21 for ; Fri, 14 Jan 2022 13:04:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 699B0385AC21 Received: by mail-pl1-x634.google.com with SMTP id u15so13280886ple.2 for ; Fri, 14 Jan 2022 05:04:29 -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=NtDRouKd6OXeRXm55hwH5C8jG7RP8HHvNiXxEv9JQOk=; b=jpR6ROSFn/DN5jhZNegpBXlNKkTqCcdAZ2ltdpiILBuJhFp7vQxZ8o/5AgmmrRK43l qeVcHqvLEKnIjyYKjPUgB8P0IVQwQHpLHPKQmRCYv0+K1SFQFR+7poPbjb+I8oK7oT1f axH+2vJOuv+wvW/LwesTn3iNnPW70XuajzUXbIa2tjGE2v/L/KDrSI3wM6ChM+j6aIAO 5s04sxO2w7SVlwRD+sdIGSi6nMDNlir8GeXiHoBDMC3GvNEZE41FsXETvmhHDBtyN1N8 9y/icOAaa7u1wnPr2ZxLEtrMrshcioHi6wOjEqZrasWrMzXNK77pC+UHMqsR99Xlk9SQ 6ScA== X-Gm-Message-State: AOAM532F7aLq97F9lab9agxJLGrAeEGKtJZpyFG1dURck7WayY08A3i1 r57K3/5JQa64WuA50K3bSgIaukzayiUf3rSP1d9YxBY0mdc= X-Google-Smtp-Source: ABdhPJyCIYi/prYXUp2Xz7atADk9WntF3D9hZGdOt6LPaRWmzAhRrIOCzKHkE8hGhUYYvnsUU2Tk378X74G2m1VqPyU= X-Received: by 2002:a17:90b:4f86:: with SMTP id qe6mr19712698pjb.120.1642165468396; Fri, 14 Jan 2022 05:04:28 -0800 (PST) MIME-Version: 1.0 References: <20211229193949.146079-1-hjl.tools@gmail.com> <11e134a2-1ee7-bec4-fa03-1d76609923f7@suse.com> In-Reply-To: <11e134a2-1ee7-bec4-fa03-1d76609923f7@suse.com> From: "H.J. Lu" Date: Fri, 14 Jan 2022 05:03:52 -0800 Message-ID: Subject: Re: [PATCH v3] elf: Set p_align to the minimum page size if possible To: Jan Beulich Cc: Binutils Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3021.6 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: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jan 2022 13:04:30 -0000 On Fri, Jan 14, 2022 at 12:27 AM Jan Beulich wrote: > > On 29.12.2021 20:39, H.J. Lu via Binutils wrote: > > --- a/ld/testsuite/ld-elf/linux-x86.exp > > +++ b/ld/testsuite/ld-elf/linux-x86.exp > > @@ -185,6 +185,42 @@ run_ld_link_exec_tests [list \ > > "" \ > > "tmpdir/indirect-extern-access-2.so" \ > > ] \ > > + [list \ > > + "Run p_align-1a without PIE" \ > > + "$NOPIE_LDFLAGS" \ > > + "" \ > > + { p_align-1.c } \ > > + "p_align-1a" \ > > + "pass.out" \ > > + "$NOPIE_CFLAGS" \ > > + ] \ > > + [list \ > > + "Run p_align-1b with PIE" \ > > + "-pie" \ > > + "" \ > > + { p_align-1.c } \ > > + "p_align-1b" \ > > + "pass.out" \ > > + "-fpie" \ > > + ] \ > > + [list \ > > + "Run p_align-1c with -Wl,-z,max-page-size=0x1000 without PIE" \ > > + "$NOPIE_LDFLAGS -Wl,-z,max-page-size=0x1000" \ > > + "" \ > > + { p_align-1.c } \ > > + "p_align-1c" \ > > + "pass.out" \ > > + "$NOPIE_CFLAGS" \ > > + ] \ > > + [list \ > > + "Run p_align-1d with -Wl,-z,max-page-size=0x1000 with PIE" \ > > + "-pie -Wl,-z,max-page-size=0x1000" \ > > + "" \ > > + { p_align-1.c } \ > > + "p_align-1d" \ > > + "pass.out" \ > > + "-fpie" \ > > + ] \ > > ] > > The two PIE variants of this also fail for me on glibc 2.26. Looks > like LOAD segments' alignment isn't being honored there, at least > not if it's as big as it is here. > The PIE alignment needs the kernel fix: commit ce81bb256a224259ab686742a6284930cbe4f1fa Author: Chris Kennelly Date: Thu Oct 15 20:12:32 2020 -0700 fs/binfmt_elf: use PT_LOAD p_align values for suitable start address -- H.J.