Project

General

Profile

Actions

Bug #534

closed

Regression from Issue #466: cpuid instruction clobbers ebx register on i386

Added by Simon Moon over 12 years ago. Updated about 12 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Affected Versions:
Effort:
Difficulty:
Label:

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.

References:

Files

03-util-cpu-fix-466.patch (914 Bytes) 03-util-cpu-fix-466.patch Simon Moon, 08/24/2012 09:39 PM
Actions #1

Updated by Anoop Saldanha over 12 years ago

Missed a run on an i(6/3)86. Thanks Simon.

Actions #2

Updated by Simon Moon about 12 years ago

submitted patch as a github pull request

Actions #3

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!

Actions

Also available in: Atom PDF