Bug #534
closedRegression from Issue #466: cpuid instruction clobbers ebx register on i386
Description
Issue: src/util-cpu.c::UtilCpuGetTicks() - On i386, the cpuid
asm instruction clobbers %ebx
, which is used as the PIC register. It looks like Issue #466 introduced this code.
Error:gcc -DHAVE_CONFIG_H -I. -I.. -I../libhtp -D_FORTIFY_SOURCE=2 -I/usr/include/nspr -I/usr/include/nss -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall -DRELEASE -Wextra -Wall -fno-strict-aliasing -fno-tree-pre -Wno-unused-parameter -std=gnu99 -fstack-protector -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -march=native -DNFQ -DPRELUDE -DHAVE_LIBNET11 -D_BSD_SOURCE -D__BSD_SOURCE -D__FAVOR_BSD -DHAVE_NET_ETHERNET_H -I/usr/include -DLIBPCAP_VERSION_MAJOR=1 -DHAVE_PCAP_SET_BUFF -DHAVE_LIBCAP_NG -c util-cpu.c
util-cpu.c: In function 'UtilCpuGetTicks':
util-cpu.c:193:5: error: PIC register clobbered by '%ebx' in 'asm'
util-cpu.c:207:5: error: PIC register clobbered by '%ebx' in 'asm'
make[4]: *** [util-cpu.o] Error 1
Proposed Fix: Since the output of the cpuid
instruction isn't really used, simply save %ebx
before cpuid
and restore it afterwards on the i386 arch.
Files
Updated by Anoop Saldanha about 12 years ago
Missed a run on an i(6/3)86. Thanks Simon.
Updated by Simon Moon about 12 years ago
submitted patch as a github pull request
Updated by Victor Julien about 12 years ago
- Status changed from New to Closed
- Assignee set to Simon Moon
- Target version set to 1.4beta1
- % Done changed from 0 to 100
Applied to both master and master-1.3.x branches. Thanks Simon!