LKML Archive on
 help / color / Atom feed
From: Florian Weimer <>
To: Mathieu Desnoyers <>
Cc: carlos <>,
	Joseph Myers <>,
	Szabolcs Nagy <>,
	libc-alpha <>,
	Thomas Gleixner <>, Ben Maurer <>,
	Peter Zijlstra <>,
	"Paul E. McKenney" <>,
	Boqun Feng <>,
	Will Deacon <>,
	Dave Watson <>, Paul Turner <>,
	Rich Felker <>,
	linux-kernel <>,
	linux-api <>
Subject: Re: [PATCH glibc 2.31 1/5] glibc: Perform rseq(2) registration at C startup and thread creation (v12)
Date: Fri, 13 Sep 2019 21:36:51 -0400
Message-ID: <> (raw)
In-Reply-To: <> (Mathieu Desnoyers's message of "Fri, 13 Sep 2019 11:58:08 -0400 (EDT)")

* Mathieu Desnoyers:

> I'm unsure whether there are changes I need to do in my rseq patchset, or
> if this is a separate issue that will be fixed separately before glibc 2.31
> is out, which would then update the rseq bits accordingly ?

Someone else (perhaps me) has to fix __libc_multiple_libcs.  Then you
can use it instead/in addition to the rtld_active check (depending on
the semantics we agree upon for __libc_multiple_libcs).

Fixing __libc_multiple_libcs may also address the early initialization
issue because for that to be always correct, we need to run the
initialization code before ELF constructors.

>>> I'm less convinced that we actually need this.  I don't think we have
>>> ever done anything like that before, and I don't think it's necessary.
>>> Any secondary rseq library just needs to note if it could perform
>>> registration, and if it failed to do so, do not perform unregistration
>>> in a pthread destructor callback.
> If that secondary rseq library happens to try to perform registration within
> its library constructor (before glibc has performed the __rseq_abi TLS
> registration), we end up in a situation where the secondary library takes
> ownership of rseq, even though libc would require ownership. This is a
> scenario we want to avoid.

We can avoid that if we run the glibc initialization before user code
(except IFUNC resolvers).  glibc itself doesn't have to do the
initialization from an ELF constructor.

> Making sure libc reserves ownership through __rseq_handled (which is
> a non-TLS variable that can be accessed early in the program lifetime)
> protects against this.

If that's it's only purpose, I don't think it's necessary.  If the
kernel can fail the second registration attempt, that would be all the
information the alternative rseq implementation needs (plus the matter
of destruction).


  reply index

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <>
2019-08-07 14:27 ` Mathieu Desnoyers
2019-09-11 18:26   ` Florian Weimer
2019-09-11 19:00     ` Carlos O'Donell
2019-09-11 19:08       ` Florian Weimer
2019-09-11 19:45         ` Carlos O'Donell
2019-09-11 19:54           ` Florian Weimer
2019-09-11 19:58             ` Florian Weimer
2019-09-11 20:08             ` Rich Felker
2019-09-13 15:58       ` Mathieu Desnoyers
2019-09-14  1:36         ` Florian Weimer [this message]
2019-08-07 14:27 ` [PATCH glibc 2.31 2/5] glibc: sched_getcpu(): use rseq cpu_id TLS on Linux (v5) Mathieu Desnoyers

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

LKML Archive on

Archives are clonable:
	git clone --mirror lkml/git/0.git
	git clone --mirror lkml/git/1.git
	git clone --mirror lkml/git/2.git
	git clone --mirror lkml/git/3.git
	git clone --mirror lkml/git/4.git
	git clone --mirror lkml/git/5.git
	git clone --mirror lkml/git/6.git
	git clone --mirror lkml/git/7.git
	git clone --mirror lkml/git/8.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ \
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone