public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* tunables vs osxsave vs checkpointing vs _dl_runtime_resolve
@ 2021-03-18 17:18 DJ Delorie
  2021-03-18 17:29 ` H.J. Lu
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: DJ Delorie @ 2021-03-18 17:18 UTC (permalink / raw)
  To: libc-alpha


In response to this customer bug...

https://bugzilla.redhat.com/show_bug.cgi?id=1937515

I spent some time digging into this code, and was able to reproduce it
using criu (checkpoint/restore in userspace).  In a nutshell: if you
create a task on a machine WITH xsave (or xsavec), and migrate it
(somehow) to a machine WITHOUT xsave (or xsavec), any further DSO
calls will fail because we've already chosen an xsave/xsavec resolver.

This, of course, is guaranteed to fail, and cannot be fixed.  With
criu I had to override the checks with a command line option just to
prove my point.

However, if you *know* you might do this, there should be a way to use
tunables to avoid xsave/xsavec - with the usual caveats about "YMMV" -
so that a process could be migrated across such CPUs without fault.

Our tunables almost provide this.

IMHO the tunables logic should interact with cpu features like this:

1. Read the CPU features available
2. Apply tunables
3. Make secondary decisions based on the results

The code that handles xsave breaks these rules; the save size for
extended registers is computed before tunables are applied, so
disabling xsave, xsavec, or osxsave in tunables has no affect.
*After* tunables, we use the save size to determine if xsave/xsavec
are enabled!

It looks like just moving the save_size logic in update_usable()
(cpu_features.c) to after the tunables check in init_cpu_features()
should "solve" this problem, allowing tunables to determine if
xsave/xsavec are used in dl_runtime_resolve.  However, the code is
complex and hairy and there's a good chance for gotchas in there.

Comments?


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-03-19 21:12 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-18 17:18 tunables vs osxsave vs checkpointing vs _dl_runtime_resolve DJ Delorie
2021-03-18 17:29 ` H.J. Lu
2021-03-18 17:45   ` DJ Delorie
2021-03-18 20:39     ` H.J. Lu
2021-03-19  3:40       ` DJ Delorie
2021-03-19  4:16         ` H.J. Lu
2021-03-19  4:35           ` DJ Delorie
2021-03-18 17:32 ` Florian Weimer
2021-03-18 17:47   ` DJ Delorie
2021-03-18 17:57     ` Florian Weimer
2021-03-18 18:19       ` DJ Delorie
2021-03-19 16:43 ` Szabolcs Nagy
2021-03-19 21:12   ` DJ Delorie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).