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.129.124]) by sourceware.org (Postfix) with ESMTPS id D5D523856DC3 for ; Wed, 24 Aug 2022 07:51:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D5D523856DC3 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661327503; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=7MeThh0ogILmu5cJoLI6L7F91+4WRtkGo7FW2NEOyYc=; b=eKgc+4Fr5cbDqHz/DzYcMSnTnn/W7XC3m4EW/WVjzhtkb7GgDt9ZzRyo26XkKTEcrDkShi gwLllbFh5YETvUvjZNxZ4hkhbya6MK4CFJQPHBIbdBwDuGhtCKPuyOUkMIdq32YG5yKwFA 1Nf2eXhRVB4Iqv10Q/7iMmpOdOV7J8I= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-477-m7vOcqv8M3qPAGeKGDJahQ-1; Wed, 24 Aug 2022 03:51:42 -0400 X-MC-Unique: m7vOcqv8M3qPAGeKGDJahQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B7DA7823F01 for ; Wed, 24 Aug 2022 07:51:41 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.78]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 35C9140D2831; Wed, 24 Aug 2022 07:51:41 +0000 (UTC) From: Florian Weimer To: Carlos O'Donell Cc: libc-alpha@sourceware.org Subject: Re: [PATCH v3] Detect ld.so and libc.so version inconsistency during startup References: <874jy21wbq.fsf@oldenburg.str.redhat.com> Date: Wed, 24 Aug 2022 09:51:39 +0200 In-Reply-To: (Carlos O'Donell's message of "Tue, 23 Aug 2022 22:59:04 -0400") Message-ID: <87zgfu84fo.fsf@oldenburg.str.redhat.com> 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.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE,URIBL_BLACK autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: * Carlos O'Donell: > On 8/23/22 17:31, Florian Weimer wrote: >> The files NEWS, include/link.h, and sysdeps/generic/ldsodefs.h >> contribute to the version fingerprint used for detection. The >> fingerprint can be further refined using the --with-extra-version-id >> configure argument. >> >> _dl_call_libc_early_init is replaced with _dl_lookup_libc_early_init. >> The new function is used store a pointer to libc.so's >> __libc_early_init function in the libc_map_early_init member of the >> ld.so namespace structure. This function pointer can then be called >> directly, so the separate invocation function is no longer needed. >> >> The versioned symbol lookup needs the symbol versioning data >> structures, so the initialization of libc_map and libc_map_early_init >> is now done from _dl_check_map_versions, after this information >> becomes available. (_dl_map_object_from_fd does not set this up >> in time, so the initialization code had to be moved from there.) >> This means that the separate initialization code can be removed from >> dl_main because _dl_check_map_versions covers all maps, including >> the initial executable loaded by the kernel. The lookup still happens >> before relocation and the invocation of IFUNC resolvers, so IFUNC >> resolvers are protected from ABI mismatch. >> >> The __libc_early_init function pointer is not protected because >> so little code runs between the pointer write and the invocation >> (only dynamic linker code and IFUNC resolvers). > > This is really an exciting change since it adds a diagnostic and clean exit > for a case that was previously a mysterious crash. Thanks for working through > this change. > > v3 LGTM. > > Tested-by: Carlos O'Donell > Reviewed-by: Carlos O'Donell Thanks. I can't merge this as-is because we have | if not hasattr(enum, 'IntFlag'): | import sys | sys.stdout.write( | 'warning: glibcelf.py needs Python 3.6 for enum support\n') | sys.exit(77) in scripts/glibcelf.py. We use glibcelf.py at build time with this patch, so this will move the minumum Python requirement to 3.6. I guess I should have added the hash function directly to the new script. I'll see if I can clean up scripts/glibcelf.py today and make it compatible with earlier Python versions. Thanks, Florian