From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by sourceware.org (Postfix) with ESMTPS id 40D5F3858409 for ; Tue, 18 Jan 2022 21:57:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 40D5F3858409 Received: by mail-pj1-x1036.google.com with SMTP id a1-20020a17090a688100b001b3fd52338eso633905pjd.1 for ; Tue, 18 Jan 2022 13:57:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=tHWv/DLtoUMdhUnlsRZWK2vc3KH/OBrq4J9QpavulYs=; b=2jZVQB3Ugm6YG8urxMjEbYfTw8TEysJZiMlbD+evB8QL4La7NQxZfdKlUiSgWgeaz6 YOp7c7FPKluNO+C8zy8bBGU3wx7LBEC9ScPJJndihuG2QNDGyr6i4+/VzdtoTggJYdZc mFxhzSndWfViPj6b4+aKsAwUTqpP+ROCvf2nKZ0p9+xc+jmPdItQaadttlkGdF2hX8Rx EyNnsrK5Fepug8D8Y6Coh1ZjpMJ8ECTzdHAFGaGYJsv9tqiXe5QLE/8QKxYFGkF0ZGJC B8eLvzRJxelb8bZ4EFrscmt6DSz/PamgsTTbjcYnoqRLBggy8thQeyMYAM41MZL3paAd OFuA== X-Gm-Message-State: AOAM5315Qke7WKtBh+k1Qp6Hf/9Dz7FNUC0JUtq5kf4ghFAKPpjNQSLJ KZCMr9kk1Loa0vnx4VxfhojqyCshWOM= X-Google-Smtp-Source: ABdhPJxxpY4kKl3/R1BX8jnLsrqYzK5PU8vMO8SStEDsaXDUpJVcCAD90ywLJurKqxB9oIiqU1mljw== X-Received: by 2002:a17:902:9046:b0:149:6fd4:4928 with SMTP id w6-20020a170902904600b001496fd44928mr30065675plz.135.1642543054171; Tue, 18 Jan 2022 13:57:34 -0800 (PST) Received: from gnu-tgl-3.localdomain ([172.58.35.133]) by smtp.gmail.com with ESMTPSA id z18sm14772714pfg.31.2022.01.18.13.57.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jan 2022 13:57:33 -0800 (PST) Received: from gnu-tgl-3.. (localhost [IPv6:::1]) by gnu-tgl-3.localdomain (Postfix) with ESMTP id EFB74C01EC; Tue, 18 Jan 2022 13:57:31 -0800 (PST) From: "H.J. Lu" To: libc-alpha@sourceware.org Cc: Florian Weimer , Adhemerval Zanella Subject: [PATCH v8 0/4] Properly align all PT_LOAD segments with tests Date: Tue, 18 Jan 2022 13:57:27 -0800 Message-Id: <20220118215731.1320930-1-hjl.tools@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3020.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no 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: Tue, 18 Jan 2022 21:57:38 -0000 Changes from v7: 1. Skip non-power of two alignment when considering the maximum p_align. 2. Add tst-p_alignmod-base.c to build tst-p_alignmod-base.so with bool __attribute__ ((weak, noclone, noinline)) is_aligned_p (void *p, int align) { return (((uintptr_t) p) & (align - 1)) == 0; } 3. Update the Copyright year. Changes from v6: 1. Rebase. 2. Add tests for other p_align cases. Linker may set p_align of a PT_LOAD segment larger than p_align of the first PT_LOAD segment to satisfy a section alignment. We should align the first PT_LOAD segment to the maximum p_align of all PT_LOAD segments. H.J. Lu (4): elf: Properly align all PT_LOAD segments [BZ #28676] elf: Add a test for PT_LOAD segments with mixed p_align [BZ #28676] elf: Add a test for PT_LOAD segments with p_align == 1 [BZ #28688] elf: Add a test for PT_LOAD segments with invalid p_align [BZ #28688] elf/Makefile | 38 +++++++++++ elf/dl-load.c | 9 ++- elf/tst-elf-edit.h | 126 +++++++++++++++++++++++++++++++++++++ elf/tst-p_align.h | 20 ++++++ elf/tst-p_align1.c | 27 ++++++++ elf/tst-p_align2.c | 27 ++++++++ elf/tst-p_align3.c | 27 ++++++++ elf/tst-p_align3.sh | 27 ++++++++ elf/tst-p_alignmod-base.c | 41 ++++++++++++ elf/tst-p_alignmod1-edit.c | 34 ++++++++++ elf/tst-p_alignmod2-edit.c | 27 ++++++++ elf/tst-p_alignmod3.c | 25 ++++++++ 12 files changed, 427 insertions(+), 1 deletion(-) create mode 100644 elf/tst-elf-edit.h create mode 100644 elf/tst-p_align.h create mode 100644 elf/tst-p_align1.c create mode 100644 elf/tst-p_align2.c create mode 100644 elf/tst-p_align3.c create mode 100755 elf/tst-p_align3.sh create mode 100644 elf/tst-p_alignmod-base.c create mode 100644 elf/tst-p_alignmod1-edit.c create mode 100644 elf/tst-p_alignmod2-edit.c create mode 100644 elf/tst-p_alignmod3.c -- 2.34.1