From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id DD09D3858CDB for ; Sun, 2 Apr 2023 23:02:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DD09D3858CDB Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gnu.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gnu.org Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pj6io-0000ac-VS; Sun, 02 Apr 2023 19:02:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=In-Reply-To:MIME-Version:References:Subject:To:From: Date; bh=cIDoD5HStzly5BclvTRqmHfebV8E33Iw3J3tyf645UA=; b=PlDtV5/ygDATTUmoDvGj nyl4iwK5SnTIONrzKPMRqaTOd4MEMUP2gKHYl5Rl7d3+puML2toDUgpHxlkEb7b4RBenP/Zs54eag JCaXd3MhANWV9CMcOG07AaXABnDwDyLnNVAefAUj8ZVp6+FeQpaqrbEY0ijgSX4WXc13tYesAvhpT 7o4xn558mCVfW1wXXJu4pAaS/kT9eKlPjsBI7hKl5XeT9/22nmtS7GNTRlv5klY41GRmYdxVQ4n// Ukjnzk9faEWuaKalBaWU9XSjM0Ile/Y4qwAt055EG3NkWLDc06qqcqiI3tFpoweVh32z8go7qbYFL pu61zYkeloNQuQ==; Received: from [2a01:cb19:4a:a400:de41:a9ff:fe47:ec49] (helo=begin) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pj6io-00079W-PM; Sun, 02 Apr 2023 19:02:50 -0400 Received: from samy by begin with local (Exim 4.96) (envelope-from ) id 1pj6in-00AsPP-2D; Mon, 03 Apr 2023 01:02:49 +0200 Date: Mon, 3 Apr 2023 01:02:49 +0200 From: Samuel Thibault To: Sergey Bugaev Cc: libc-alpha@sourceware.org, bug-hurd@gnu.org Subject: Re: [RFC PATCH glibc 11/34] mach, hurd: Drop __libc_lock_self0 Message-ID: <20230402230249.3y2kildn33pczzvr@begin> Mail-Followup-To: Sergey Bugaev , libc-alpha@sourceware.org, bug-hurd@gnu.org References: <20230319151017.531737-1-bugaevc@gmail.com> <20230319151017.531737-12-bugaevc@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230319151017.531737-12-bugaevc@gmail.com> Organization: I am not organized User-Agent: NeoMutt/20170609 (1.8.3) X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_NUMSUBJECT,SPF_HELO_PASS,SPF_PASS,TXREP,URIBL_BLACK autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Applied, thanks! Sergey Bugaev, le dim. 19 mars 2023 18:09:54 +0300, a ecrit: > This was used for the value of libc-lock's owner when TLS is not yet set > up, so THREAD_SELF can not be used. Since the value need not be anything > specific -- it just has to be non-NULL -- we can just use a plain > constant, such as (void *) 1, for this. This avoids accessing the symbol > through GOT, and exporting it from libc.so in the first place. > > Signed-off-by: Sergey Bugaev > --- > sysdeps/mach/hurd/Versions | 4 ++-- > sysdeps/mach/hurd/cthreads.c | 4 ---- > sysdeps/mach/libc-lock.h | 3 +-- > 3 files changed, 3 insertions(+), 8 deletions(-) > > diff --git a/sysdeps/mach/hurd/Versions b/sysdeps/mach/hurd/Versions > index bf2e870a..20ac0067 100644 > --- a/sysdeps/mach/hurd/Versions > +++ b/sysdeps/mach/hurd/Versions > @@ -20,7 +20,7 @@ libc { > __open_nocancel; > __read_nocancel; __pread64_nocancel; > __write_nocancel; > - __libc_lock_self0; __getcwd; > + __getcwd; > __stat64; > > _dl_init_first; > @@ -61,7 +61,7 @@ ld { > __open_nocancel; > __read_nocancel; __pread64_nocancel; > __write_nocancel; > - __libc_lock_self0; __getcwd; > + __getcwd; > __stat64; __fstat64; > } > } > diff --git a/sysdeps/mach/hurd/cthreads.c b/sysdeps/mach/hurd/cthreads.c > index 9f17cfe4..87b6c06b 100644 > --- a/sysdeps/mach/hurd/cthreads.c > +++ b/sysdeps/mach/hurd/cthreads.c > @@ -20,10 +20,6 @@ > #include > #include > > -/* This serves as stub "self" pointer for libc locks when TLS is not initialized > - yet. */ > -char __libc_lock_self0[0]; > - > /* Placeholder for key creation routine from Hurd cthreads library. */ > int > weak_function > diff --git a/sysdeps/mach/libc-lock.h b/sysdeps/mach/libc-lock.h > index 14248a05..c5c2553c 100644 > --- a/sysdeps/mach/libc-lock.h > +++ b/sysdeps/mach/libc-lock.h > @@ -34,9 +34,8 @@ typedef struct > > typedef __libc_lock_recursive_t __rtld_lock_recursive_t; > > -extern char __libc_lock_self0[0]; > #define __libc_lock_owner_self() \ > - (__LIBC_NO_TLS () ? (void *)&__libc_lock_self0 : THREAD_SELF) > + (__LIBC_NO_TLS () ? (void *) 1 : THREAD_SELF) > > #else > typedef struct __libc_lock_opaque__ __libc_lock_t; > -- > 2.39.2 > -- Samuel --- Pour une évaluation indépendante, transparente et rigoureuse ! Je soutiens la Commission d'Évaluation de l'Inria.