From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by sourceware.org (Postfix) with ESMTPS id AE56D3858031 for ; Fri, 10 Dec 2021 13:14:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AE56D3858031 Received: by mail-pl1-x631.google.com with SMTP id u11so6264165plf.3 for ; Fri, 10 Dec 2021 05:14:15 -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=MeWfDxkNOjS4xr/u7jznPtZXyEU0xxoKWKbL0A1KeJc=; b=DaoZ1G4Lmzq4ipUPUi3W8h48Lfp28hAgrocH6B9ix1Bn/Bb7BTepx54gcGbkhkulyH yD/Crs+A3o/7LVKOnJYpITXGTILGWz8DxT/Gcyx2PDWDLBNe4YBl5O9QEhlZBVjXHuv4 m2HS/BL9BfAP0tolkmhgF93n1MWgRadyQ6XXnV2ljb00iYQXXddFluinM2qzsi8YWDNT KKZjG7E7o7Zj8QYVmWpJf+yIIvCw4yVp0l53X9uEcWy5W7lhDmwJE2qttYMAGrSdnsjd Zn0HpUs2l2U1s6jUIevjMqFQt6+6oDZIum5ocdgzf939vNFbDprkmZ4/1saq0epZOPYz +utA== X-Gm-Message-State: AOAM5325N/+kJsni6IC8438xTt7rmXk4F6V/lMCCLvdhtarNp36bgxaF HF0iYY5vVLFveeR8kX5EVI0MkT/WaqevYwN2qxY= X-Google-Smtp-Source: ABdhPJyR6zIIJ+U6PcuGWJ7O7NjykiHHuHgYSTUwPyY8pfNHI7J2WVDOQeSSXx5Uw/QZQJdFWmcMGjM6S3qnAMsphwo= X-Received: by 2002:a17:902:cecf:b0:141:e15d:4a2a with SMTP id d15-20020a170902cecf00b00141e15d4a2amr74926948plg.66.1639142054668; Fri, 10 Dec 2021 05:14:14 -0800 (PST) MIME-Version: 1.0 References: <20211204045848.71105-1-rongwei.wang@linux.alibaba.com> <20211210123911.86568-1-rongwei.wang@linux.alibaba.com> In-Reply-To: <20211210123911.86568-1-rongwei.wang@linux.alibaba.com> From: "H.J. Lu" Date: Fri, 10 Dec 2021 05:13:38 -0800 Message-ID: Subject: Re: [PATCH v5 0/2] fix p_align on PT_LOAD segment in DSO isn't honored To: Rongwei Wang Cc: GNU C Library , Florian Weimer , xuyu@linux.alibaba.com, gavin.dg@linux.alibaba.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3022.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, 10 Dec 2021 13:14:17 -0000 On Fri, Dec 10, 2021 at 4:39 AM Rongwei Wang wrote: > > Hi > > This patch mainly to fix a reported bug: > > "p_align on PT_LOAD segment in DSO isn't honored" > https://sourceware.org/bugzilla/show_bug.cgi?id=28676 > > A testcase had been builded by H.J.Lu: > https://sourceware.org/bugzilla/attachment.cgi?id=13838 > > And in Patch 1/1, I also show a simple testcase which > modified from H.J.Lu. > > And a similar bug in ELF binary was also reported: > https://bugzilla.kernel.org/show_bug.cgi?id=215275 I submitted a kernel patch: https://lore.kernel.org/lkml/20211209174052.370537-1-hjl.tools@gmail.com/T/ Hopefully, it will be landed soon. > A related fix patch could been found: > https://lore.kernel.org/linux-mm/20211009092658.59665-4-rongwei.wang@linux.alibaba.com/ > Originally, we send this patch for introducing .text > hugepages, was not aware of it's bug. And now, I am > not sure whether kernel maintainer will regards it as > a bug. But it deserved try again. > > Thanks. > > Changelog: > > v4 -> v5 > - Patch "Add a testcase to check alignment of PT_LOAD segment" > add new testcase for PT_LOAD segment > - Patch "elf: Properly align PT_LOAD segments" > fix map_start to use map_start_aligned when second mmap failed > > v3 -> v4 > - Patch "elf: Properly align PT_LOAD segments" > Call unmap when the second mmap fails. > > v2 -> v3 > - Patch "elf: Properly align PT_LOAD segments" > move mapalign into 'struct loadcmd' > fix some coding style > > RFC/v1 -> v2 > > - Patch "elf: align the mapping address of LOAD segments with p_align" > fix coding format and add testcase in commit. > > RFC link: > https://patchwork.sourceware.org/project/glibc/patch/20211204045848.71105-2-rongwei.wang@linux.alibaba.com/ > > H.J. Lu (1): > Add a testcase to check alignment of PT_LOAD segment > > Rongwei Wang (1): > elf: Properly align PT_LOAD segments > > elf/Makefile | 14 +++++++++++-- > elf/dl-load.c | 1 + > elf/dl-load.h | 2 +- > elf/dl-map-segments.h | 49 +++++++++++++++++++++++++++++++++++++++---- > elf/tst-align3.c | 37 ++++++++++++++++++++++++++++++++ > elf/tst-alignmod3.c | 31 +++++++++++++++++++++++++++ > 6 files changed, 127 insertions(+), 7 deletions(-) > create mode 100644 elf/tst-align3.c > create mode 100644 elf/tst-alignmod3.c > > -- > 2.27.0 > LGTM. Reviewed-by: H.J. Lu Can you check it in? Thanks. -- H.J.