This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Possible bug in sysdeps/x86_64/cacheinfo.c


Greetings,

In sysdeps/x86_64/cacheinfo.c intel_check_word(), we have this code:

commit 2a1156010784332cbe4bf033ccedb19f52e56a75
Author: Ulrich Drepper <drepper@gmail.com>
Date:   Sun Mar 20 08:14:30 2011 -0400

    Implement x86 cpuid handling of leaf4 for cache information.

...

  asm volatile ("xchgl %%ebx, %1; cpuid; xchgl %%ebx, %1"
		: "=a" (eax), "=r" (ebx), "=c" (ecx), "=d" (edx)
		: "0" (4), "2" (round));

AFAICT, this clobbers the high 32 bits of %rbx, which causes a crash
if the caller had a live %rbx and non-0 high bits in it.

(I am not sure why this isn't causing a problem with current glibc
builds; possibly %rbx is not live?)

-- 
Paul Pluzhnikov


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]