[Bug dynamic-link/22641] New: Merge error in x86 XSAVE dynamic linker trampoline commit in 2.23

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug dynamic-link/22641] New: Merge error in x86 XSAVE dynamic linker trampoline commit in 2.23

maiku.fabian at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22641

            Bug ID: 22641
           Summary: Merge error in x86 XSAVE dynamic linker trampoline
                    commit in 2.23
           Product: glibc
           Version: 2.23
            Status: NEW
          Severity: normal
          Priority: P2
         Component: dynamic-link
          Assignee: unassigned at sourceware dot org
          Reporter: fweimer at redhat dot com
  Target Milestone: ---
            Target: x86

The check for the availability of XSAVE is incorrectly nested under that for
AVX YMM registers:

    185   /* Can we call xgetbv?  */
    186   if (HAS_CPU_FEATURE (OSXSAVE))
    187     {
    188       unsigned int xcrlow;
    189       unsigned int xcrhigh;
    190       asm ("xgetbv" : "=a" (xcrlow), "=d" (xcrhigh) : "c" (0));
    191       /* Is YMM and XMM state usable?  */
    192       if ((xcrlow & (bit_YMM_state | bit_XMM_state)) ==
    193           (bit_YMM_state | bit_XMM_state))
    194         {
    195           /* Determine if AVX is usable.  */
    196           if (HAS_CPU_FEATURE (AVX))

    230           /* For _dl_runtime_resolve, set xsave_state_size to xsave
area
    231              size + integer register save size and align it to 64
bytes.  */
    232           if (cpu_features->max_cpuid >= 0xd)
    233             {
    234               unsigned int eax, ebx, ecx, edx;
    235
    236               __cpuid_count (0xd, 0, eax, ebx, ecx, edx);
    237               if (ebx != 0)
    238                 {
    239                   cpu_features->xsave_state_size
    240                 = ALIGN_UP (ebx + STATE_SAVE_OFFSET, 64);

As far as I can see, this only affects the 2.23 release branch.

We are still investigating the practical impact of this change (without AVX,
FXSAVE should be good enough, unless the configuration is very special and MPX
or pkeys support is present).

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug dynamic-link/22641] Merge error in x86 XSAVE dynamic linker trampoline commit in 2.23

maiku.fabian at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22641

--- Comment #1 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, release/2.23/master has been updated
       via  fbd72f14904b8a81816528e0cc5bb3315fc70a47 (commit)
      from  26d289bb92b6d1125536644f607c73617463477d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=fbd72f14904b8a81816528e0cc5bb3315fc70a47

commit fbd72f14904b8a81816528e0cc5bb3315fc70a47
Author: Florian Weimer <[hidden email]>
Date:   Thu Jan 11 16:54:40 2018 +0100

    x86: Fix mis-merge of XSAVE ld.so trampoline selection [BZ #22641]

    The change is best viewed with “diff -w”:

    @@ -226,6 +226,7 @@ init_cpu_features (struct cpu_features *cpu_features)
          /* Determine if FMA4 is usable.  */
          if (HAS_CPU_FEATURE (FMA4))
            cpu_features->feature[index_FMA4_Usable] |= bit_FMA4_Usable;
    +   }

           /* For _dl_runtime_resolve, set xsave_state_size to xsave area
         size + integer register save size and align it to 64 bytes.  */
    @@ -292,7 +293,6 @@ init_cpu_features (struct cpu_features *cpu_features)
            }
        }
         }
    -    }

     #if !HAS_CPUID
     no_cpuid:

    Without this change, XSAVE support will never be selected unless the CPU
    also supports AVX, which is not what we want.  For example, if AVX is
    disabled, but MPX is supported, the BND registers are not preserved if
    we use FXSAVE instead of XSAVE.

    This fixes commit 26d289bb92b6d1125536644f607c73617463477d (x86-64:
    Use fxsave/xsave/xsavec in _dl_runtime_resolve).

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                  |    5 ++
 NEWS                       |    1 +
 sysdeps/x86/cpu-features.c |  100 ++++++++++++++++++++++----------------------
 3 files changed, 56 insertions(+), 50 deletions(-)

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug dynamic-link/22641] Merge error in x86 XSAVE dynamic linker trampoline commit in 2.23

maiku.fabian at gmail dot com
In reply to this post by maiku.fabian at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22641

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
           Assignee|unassigned at sourceware dot org   |fweimer at redhat dot com
   Target Milestone|---                         |2.23

--- Comment #2 from Florian Weimer <fweimer at redhat dot com> ---
Fixed on the 2.23 release branch, which is the only one affected by this issue.

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