public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/27605] New: tunables can't control xsave/xsavec selection in dl_runtime_resolve_*
@ 2021-03-18 17:45 dj at redhat dot com
  2021-03-18 17:54 ` [Bug libc/27605] " hjl.tools at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: dj at redhat dot com @ 2021-03-18 17:45 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=27605

            Bug ID: 27605
           Summary: tunables can't control xsave/xsavec selection in
                    dl_runtime_resolve_*
           Product: glibc
           Version: 2.34
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: dj at redhat dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

in sysdeps/x86/cpu-features.c, the decision to use xsave/xsavec is made -
indirectly, by computing the save set size - before the tunables have a chance
to affect it.  The logic in update_usable() should be deferred until after the
tunables check in init_cpu_features().  As it is, you can't control which
_dl_runtime_resolve_* ifunc is used, by disabling xsave/osxsave in tunables.

See: https://sourceware.org/pipermail/libc-alpha/2021-March/124133.html
See: https://bugzilla.redhat.com/show_bug.cgi?id=1937515

The desired result allows for a process to be migrated from a with-xsave
machine to a without-xsave machine, or across different with-xsavec machines,
by disabling all xsave/xsavec (with the usual caveats about not using extended
registers) completely.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug libc/27605] tunables can't control xsave/xsavec selection in dl_runtime_resolve_*
  2021-03-18 17:45 [Bug libc/27605] New: tunables can't control xsave/xsavec selection in dl_runtime_resolve_* dj at redhat dot com
@ 2021-03-18 17:54 ` hjl.tools at gmail dot com
  2021-03-18 18:10 ` dj at redhat dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: hjl.tools at gmail dot com @ 2021-03-18 17:54 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=27605

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING
                 CC|                            |hjl.tools at gmail dot com

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
You can use tunables to disable any CPU features, like

$ export GLIBC_TUNABLES=glibc.cpu.hwcaps=-XSAVEC

Have you tried it?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug libc/27605] tunables can't control xsave/xsavec selection in dl_runtime_resolve_*
  2021-03-18 17:45 [Bug libc/27605] New: tunables can't control xsave/xsavec selection in dl_runtime_resolve_* dj at redhat dot com
  2021-03-18 17:54 ` [Bug libc/27605] " hjl.tools at gmail dot com
@ 2021-03-18 18:10 ` dj at redhat dot com
  2021-03-18 20:25 ` hjl.tools at gmail dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: dj at redhat dot com @ 2021-03-18 18:10 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=27605

--- Comment #2 from dj at redhat dot com <dj at redhat dot com> ---
I tried it.  It has no effect on the _dl_runtime_resolve selection, which is
the call that segfaults on the wrong arch.  That's the bug - it *should* act
like you say, but doesn't.

In this case, the choice is effectively made *before* tunables are applied.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug libc/27605] tunables can't control xsave/xsavec selection in dl_runtime_resolve_*
  2021-03-18 17:45 [Bug libc/27605] New: tunables can't control xsave/xsavec selection in dl_runtime_resolve_* dj at redhat dot com
  2021-03-18 17:54 ` [Bug libc/27605] " hjl.tools at gmail dot com
  2021-03-18 18:10 ` dj at redhat dot com
@ 2021-03-18 20:25 ` hjl.tools at gmail dot com
  2021-03-19 13:30 ` hjl.tools at gmail dot com
  2021-03-29 13:07 ` hjl.tools at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: hjl.tools at gmail dot com @ 2021-03-18 20:25 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=27605

--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to dj@redhat.com from comment #2)
> I tried it.  It has no effect on the _dl_runtime_resolve selection, which is
> the call that segfaults on the wrong arch.  That's the bug - it *should* act
> like you say, but doesn't.
> 
> In this case, the choice is effectively made *before* tunables are applied.

Works for me:

(gdb) r --direct
Starting program:
/export/build/gnu/tools-build/glibc-cet-gitlab/build-x86_64-linux/elf/tst-x86_64-1
--direct
[Inferior 1 (process 1499934) exited normally]
(gdb) b _dl_runtime_resolve_xsave
Breakpoint 1 at 0x7ffff7fe19d0: file ../sysdeps/x86_64/dl-trampoline.h, line
67.
(gdb) b _dl_runtime_resolve_xsavec
Breakpoint 2 at 0x7ffff7fe1aa0: file ../sysdeps/x86_64/dl-trampoline.h, line
67.
(gdb) r
Starting program:
/export/build/gnu/tools-build/glibc-cet-gitlab/build-x86_64-linux/elf/tst-x86_64-1
--direct

Breakpoint 2, _dl_runtime_resolve_xsavec ()
    at ../sysdeps/x86_64/dl-trampoline.h:67
67              _CET_ENDBR
(gdb) set env GLIBC_TUNABLES=glibc.cpu.hwcaps=-XSAVEC
(gdb) r
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program:
/export/build/gnu/tools-build/glibc-cet-gitlab/build-x86_64-linux/elf/tst-x86_64-1
--direct

Breakpoint 1, _dl_runtime_resolve_xsave ()
    at ../sysdeps/x86_64/dl-trampoline.h:67
67              _CET_ENDBR
(gdb)

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug libc/27605] tunables can't control xsave/xsavec selection in dl_runtime_resolve_*
  2021-03-18 17:45 [Bug libc/27605] New: tunables can't control xsave/xsavec selection in dl_runtime_resolve_* dj at redhat dot com
                   ` (2 preceding siblings ...)
  2021-03-18 20:25 ` hjl.tools at gmail dot com
@ 2021-03-19 13:30 ` hjl.tools at gmail dot com
  2021-03-29 13:07 ` hjl.tools at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: hjl.tools at gmail dot com @ 2021-03-19 13:30 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=27605

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
   Target Milestone|---                         |2.34
           Assignee|unassigned at sourceware dot org   |hjl.tools at gmail dot com
                URL|                            |https://sourceware.org/pipe
                   |                            |rmail/libc-alpha/2021-March
                   |                            |/124170.html

--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> ---
A patch is posted at

https://sourceware.org/pipermail/libc-alpha/2021-March/124170.html

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug libc/27605] tunables can't control xsave/xsavec selection in dl_runtime_resolve_*
  2021-03-18 17:45 [Bug libc/27605] New: tunables can't control xsave/xsavec selection in dl_runtime_resolve_* dj at redhat dot com
                   ` (3 preceding siblings ...)
  2021-03-19 13:30 ` hjl.tools at gmail dot com
@ 2021-03-29 13:07 ` hjl.tools at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: hjl.tools at gmail dot com @ 2021-03-29 13:07 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=27605

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from H.J. Lu <hjl.tools at gmail dot com> ---
Fixed in 2.34 by

commit 27f74636752d0c4438cf8346cf2a76b6fcf3be16
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Mar 19 06:15:37 2021 -0700

    x86: Properly disable XSAVE related features [BZ #27605]

    1. Support GLIBC_TUNABLES=glibc.cpu.hwcaps=-XSAVE.
    2. Disable all features which depend on XSAVE:
       a. If OSXSAVE is disabled by glibc tunables.  Or
       b. If both XSAVE and XSAVEC aren't usable.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2021-03-29 13:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-18 17:45 [Bug libc/27605] New: tunables can't control xsave/xsavec selection in dl_runtime_resolve_* dj at redhat dot com
2021-03-18 17:54 ` [Bug libc/27605] " hjl.tools at gmail dot com
2021-03-18 18:10 ` dj at redhat dot com
2021-03-18 20:25 ` hjl.tools at gmail dot com
2021-03-19 13:30 ` hjl.tools at gmail dot com
2021-03-29 13:07 ` hjl.tools at gmail dot com

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).