On 09/11/2013 12:31 AM, Dridi Boukelmoune wrote:
I have my first packaging issue on the numatop package[1].
During the review it appeared that I forgot the %{optflags}, and that
adding them breaks the i686 build. The upstream dev is very patient
and willing to help me, but I feel I have wasted enough of his time.
The guilty gcc flag seems to be:
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 [2]
It would be helpful to provide more context and pointers to the analysis
so far.
The failing build log is here:
http://kojipkgs.fedoraproject.org//work/tasks/1414/5911414/build.log
This is the offending function:
void
cpuid(unsigned int *eax, unsigned int *ebx, unsigned int *ecx,
unsigned int *edx)
{
__asm volatile
("cpuid\n\t"
: "=a" (*eax),
"=b" (*ebx),
"=c" (*ecx),
"=d" (*edx)
: "a" (*eax));
}
The cryptic GCC error message (inconsistent operand constraints in an
‘asm’) refers to the fact that in PIC mode (which is activated by the
hardening flags), %ebx is a reserved register.
This version should work in 32 bit mode, and only in 32 bit mode:
void
cpuid(unsigned int *eax, unsigned int *ebx, unsigned int *ecx,
unsigned int *edx)
{
__asm volatile
("push %%ebx\n\t"
"cpuid\n\t"
"mov %%ebx, (%1)\n\t"
"pop %%ebx"
: "=a" (*eax),
"=S" (ebx),
"=c" (*ecx),
"=d" (*edx)
: "0" (*eax));
}
I have not actually tested this. There are other solutions floating
around, but they are clearly incorrect and produce wrong code.
In 64 bit mode, you should use the original version.
--
Florian Weimer / Red Hat Product Security Team
--
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct