Bug 13583 - AVX check not done correctly for strcasecmp
Summary: AVX check not done correctly for strcasecmp
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: 2.15
: P2 normal
Target Milestone: ---
Assignee: Ulrich Drepper
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-11 14:13 UTC by Pierre Bourdon
Modified: 2014-06-27 11:13 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pierre Bourdon 2012-01-11 14:13:04 UTC
According to Intel manuals, checking for AVX has to be done by checking AVX and OS XSAVE support in CPUID + XFEATURE_ENABLED_MASK via xgetbv. However, for strcasecmp, AVX is checked by testing the AVX bit in the cpuid.

This makes systems using glibc-2.15 unbootable under current versions of Xen when the CPU supports AVX because Xen does not have XSAVE support. On these systems, strcasecmp fails with a SIGILL when executing vmovdqa.

Bad check is here:
http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/x86_64/multiarch/strcmp.S;h=f93c83d7d469085029018dcf0d7f2eaadb05a44f;hb=HEAD#l108

Example of a good check:
http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/x86_64/dl-trampoline.S;h=6523c92945a59e6a5eefa3cfb2e0c58dfa99fd44;hb=HEAD#l137
Comment 1 Ulrich Drepper 2012-01-26 12:46:20 UTC
I checked in a patch.
Comment 2 Ulrich Drepper 2012-01-26 14:48:35 UTC
Actually, strcmp cannot have problems since the code only uses the AVX instruction encoding, not the YMM registers.  Therefore any problem in that area must have a completely different reason.  There is code which potentially uses the YMM registers and I added protection there.
Comment 3 Jackie Rosen 2014-02-16 17:51:09 UTC Comment hidden (spam)