From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id C6263385E019 for ; Wed, 9 Jun 2021 11:15:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C6263385E019 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-170-XbD7-uyEMwetIW2i69ZXmg-1; Wed, 09 Jun 2021 07:15:18 -0400 X-MC-Unique: XbD7-uyEMwetIW2i69ZXmg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7BB42802B4F for ; Wed, 9 Jun 2021 11:15:17 +0000 (UTC) Received: from oldenburg.str.redhat.com (ovpn-115-60.ams2.redhat.com [10.36.115.60]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BDD9A19C45 for ; Wed, 9 Jun 2021 11:15:16 +0000 (UTC) From: Florian Weimer To: libc-alpha@sourceware.org Subject: [PATCH 0/4] Add --disable-major-minor-libraries configure option X-From-Line: 476bfc2e0c41a91a37d945ae2af29e931801b0f7 Mon Sep 17 00:00:00 2001 Message-Id: Date: Wed, 09 Jun 2021 13:15:14 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Wed, 09 Jun 2021 11:15:40 -0000 --=-=-= Content-Type: text/plain This is a repost of an older patch series. RPM-based distributions tend to have issues around glibc downgrades across major glibc versions because RPM deletes removed files very later, after the transaction is complete. This can result in a broken system because if ldconfig runs after the downgraded glibc has been unpacked, it will put the newer glibc's DSOs in to the ld.so cache, which are generally incompatible with the downgraded dynamic loader. The name-based DSO recognition patch is new. Originally, I went with a fancy Python script to gather ld.so names, but then I saw that only two new patterns are required for generic detection. The patterns are quite specific, so I wrote a _dl_is_dso function instead of a table. I'm attaching the Python script for posterity in case it is useful for something else. I fixed a cut-and-past error in elf/Makefile which broke targets like aarch64-linux-gnu and s390x-gnu-linux, where $(inst_slibdir) and $(inst_rtlddir) are distinct. My preference would be to avoid the new configure option and just drop the versions unconditionally, but I'm worried that it's difficult to obtain consensus around that. My patch rebased cleanly over 18 months of development, so there seems to be little varience in these Makefile parts, so I don't think we need new build-many-glibcs.py targets for this configuration. I'm going to switch Fedora rawhide to it, so we get some regular testing of these configurations anyway. Tested on i686-linux-gnu, x86_64-linux-gnu; built with build-many-glibcs.py. Both with and without --disable-major-minor-libraries. Thanks, Florian Florian Weimer (4): nptl_db: Install libthread_db under a regular implementation name Makerules: Remove lib-version, $(subdir-version) elf: Generalize name-based DSO recognition in ldconfig Add --disable-major-minor-libraries configure option INSTALL | 10 ++++++++++ Makefile | 4 +++- Makerules | 38 ++++++++++++++++++++++---------------- config.make.in | 1 + configure | 15 +++++++++++++++ configure.ac | 7 +++++++ elf/Makefile | 10 ++++++++-- elf/dl-is_dso.h | 33 +++++++++++++++++++++++++++++++++ elf/ldconfig.c | 5 ++--- elf/tst-dl-is_dso.c | 35 +++++++++++++++++++++++++++++++++++ manual/install.texi | 9 +++++++++ nptl_db/Makefile | 2 -- 12 files changed, 145 insertions(+), 24 deletions(-) create mode 100644 elf/dl-is_dso.h create mode 100644 elf/tst-dl-is_dso.c -- 2.31.1 --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=gather-rtld-names.py #!/usr/bin/python3 # Gather the names of all dynamic linkers in the glibc source tree. # Copyright (C) 2021 Free Software Foundation, Inc. # This file is part of the GNU C Library. # # The GNU C Library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # The GNU C Library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with the GNU C Library; if not, see # . """Gather dynamic linker names. This script scans the glibc source tree for shlib-versions files and extracts the dynamic linker name from them. I writes a header file which defines an RTLD_ALL_NAMES macro. """ import argparse import os import re import sys # The dynamic linker name is optionally followed by a symbol version # baseline. RE_LD = re.compile(r'^ld=(\S+)(?:$|\s)') def get_rtld_name(path): """Extract the ld= line from the file at PATH and return the ld.so name.""" with open(path) as inp: for line in inp: match = RE_LD.match(line) if match is not None: rtld_name, = match.groups() if not rtld_name: sys.stderr.write('{}: error: invalid rtld name: {!r}\n' .format(path, line)) sys.exit(1) return rtld_name # Nothing found. Use the default. return None def write_deps(directories, files, deps, output): """Write makefile dependency information for the file OUTPUT to DEPS.""" with open(deps, 'w') as outp: outp.write(output) outp.write(': \\\n') for entry in directories + files: outp.write(' ') outp.write(entry) outp.write(' \\\n') outp.write('\n') def write_output(rtld_names, path): """Writes a header file with the names list to PATH.""" with open(path, 'w') as outp: outp.write('/* This file is automatically generated by ') our_name = os.path.basename(__file__) outp.write(our_name) outp.write('.\n Do not edit. */\n\n') outp.write('#define RTLD_ALL_NAMES \\\n') for name in rtld_names: outp.write(' "') outp.write(name) outp.write('\\0" \\\n') # An empty string terminates the list. outp.write(' ""\n') def main(): """The main entry point.""" parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('--deps', help='Dependency information for make', type=str, required=True) parser.add_argument('--root', help='Root directory of the source tree', type=str, required=True) parser.add_argument('--output', help='Generated source file with the ', type=str, required=True) opts = parser.parse_args(sys.argv[1:]) # The name of the file we are looking for. shlib_versions = 'shlib-versions' # This is used to generate directory dependencies, so that newly # added shlib-versions files will be found. directories = [] # The default file does not live in a sysdeps subdirectory. files = [os.path.join(opts.root, shlib_versions)] # More files come from the sysdeps subdirectory. for dirpath, dirnames, filenames in os.walk( os.path.join(opts.root, 'sysdeps')): if shlib_versions in filenames: files.append(os.path.join(dirpath, shlib_versions)) else: directories.append(dirpath) # Normalize the generated output. directories.sort() files.sort() write_deps(directories, files, opts.deps, opts.output) rtld_names = set() for path in files: name = get_rtld_name(path) if name is not None: rtld_names.add(name) write_output(sorted(rtld_names), opts.output) if __name__ == "__main__": main() --=-=-=--