Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 123680 - nginx 0.3.29 doesn't compile with hardened toolchain
Summary: nginx 0.3.29 doesn't compile with hardened toolchain
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: The Gentoo Linux Hardened Team
URL: http://sysoev.ru/nginx
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-22 00:16 UTC by Mike Baikov
Modified: 2006-02-22 04:01 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch for compiling w/ hardened toolchain (patch-0.3.29.3.txt,1.28 KB, patch)
2006-02-22 02:29 UTC, Mike Baikov
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Baikov 2006-02-22 00:16:33 UTC
gcc -c -march=i686 -O2 -fomit-frame-pointer -pipe  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \
        -o objs/src/core/ngx_spinlock.o \
        src/core/ngx_spinlock.c
gcc -c -march=i686 -O2 -fomit-frame-pointer -pipe  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \
        -o objs/src/core/ngx_cpuinfo.o \
        src/core/ngx_cpuinfo.c
src/core/ngx_cpuinfo.c: In function `ngx_cpuinfo':
src/core/ngx_cpuinfo.c:22: error: can't find a register in class `BREG' while reloading `asm'
src/core/ngx_cpuinfo.c:22: error: can't find a register in class `BREG' while reloading `asm'
make[1]: *** [objs/src/core/ngx_cpuinfo.o] Error 1
make[1]: Leaving directory `/var/tmp/portage/nginx-0.3.29/work/nginx-0.3.29'
make: *** [build] Error 2

!!! ERROR: www-servers/nginx-0.3.29 failed.
!!! Function src_compile, Line 55, Exitcode 2
!!! failed to compile
!!! If you need support, post the topmost build error, NOT this status message.








www ~ # emerge info;emerge -v nginx
Portage 2.0.54 (hardened/x86/2.6, gcc-3.4.4, glibc-2.3.5-r2, 2.6.14-hardened-r3 i686)
=================================================================
System uname: 2.6.14-hardened-r3 i686 Intel(R) Xeon(TM) CPU 3.00GHz
Gentoo Base System version 1.6.14
dev-lang/python:     2.3.5-r2, 2.4.2
sys-apps/sandbox:    1.2.12
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.16.1
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=i686 -O2 -fomit-frame-pointer -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/share/config /var/qmail/alias /var/qmail/control /var/vpopmail/domains /var/vpopmail/etc"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-march=i686 -O2 -fomit-frame-pointer -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distlocks sandbox sfperms strict"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
LANG="en_US.UTF-8"
LC_ALL=""
PKGDIR="/usr/portage//packages/x86/"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage/"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="bcmath bzip2 bzlib cnamefix crypt curl dlloader expat gd gmp hardened iconv idn innodb java jpeg junit libwww memlimit mhash mysql ncurses nls nptl nptlonly pam pcre perl php pic png python qmail readline roundrobin semanticfix session slang sockets spamassassin ssl symlink tcpd tiff truetype ucs2 udev unicode usb userlocales utf8 x86 xml2 zlib userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, LDFLAGS, LINGUAS, MAKEOPTS
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2006-02-22 00:52:56 UTC
Compiles fine w/ non-hardened, hardened toolchain breaks this...
Comment 2 Mike Baikov 2006-02-22 01:07:58 UTC
.26 version compiling fine. 29 no.
Comment 3 Mike Baikov 2006-02-22 02:29:01 UTC
Created attachment 80412 [details, diff]
Patch for compiling w/ hardened toolchain

Please commit to portage
Comment 4 Mike Baikov 2006-02-22 02:29:49 UTC
Comment on attachment 80412 [details, diff]
Patch for compiling w/ hardened toolchain

>diff -ur ./nginx-0.3.29/src/core/ngx_cpuinfo.c ./nginx-0.3.29.2/src/core/ngx_cpuinfo.c
>--- ./nginx-0.3.29/src/core/ngx_cpuinfo.c	2006-02-08 14:39:29.000000000 +0300
>+++ ./nginx-0.3.29.2/src/core/ngx_cpuinfo.c	2006-02-22 13:25:07.000000000 +0300
>@@ -13,6 +13,34 @@
> 
> static ngx_inline void ngx_cpuid(uint32_t i, uint32_t *buf);
> 
>+#if ( __i386__ )
>+
>+
>+static ngx_inline void ngx_cpuid(uint32_t i, uint32_t *buf)
>+{
>+
>+    /*
>+     * we could not use %ebx as parameter if gcc building with -fPIC
>+     * and we could not push %ebx on stack
>+     */
>+
>+    __asm__ (
>+
>+    "    mov    %%ebx, %%esi;  "
>+    "    cpuid;                "
>+    "    mov    %%eax, %0;     "
>+    "    mov    %%ebx, %1;     "
>+    "    mov    %%edx, %2;     "
>+    "    mov    %%ecx, %3;     "
>+    "    mov    %%esi, %%ebx;  "
>+    : "=m" (buf[0]), "=m" (buf[1]), "=m" (buf[2]), "=m" (buf[3])
>+    : "a" (i)
>+    : "ecx", "edx", "esi" );
>+}
>+
>+
>+#else /* __amd64__ */
>+
> 
> static ngx_inline void
> ngx_cpuid(uint32_t i, uint32_t *buf)
>@@ -32,6 +60,9 @@
> }
> 
> 
>+#endif
>+
>+
> /* auto detect the L2 cache line size of modern and widespread CPUs */
> 
> void
>@@ -53,6 +84,8 @@
>     if (vbuf[0] == 0) {
>         return;
>     }
>+    
>+    ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, 0, "CPU: \"%s\"", vendor);    
> 
>     ngx_cpuid(1, cpu);
>
Comment 5 Konstantin Arkhipov (RETIRED) gentoo-dev 2006-02-22 04:01:33 UTC
committed as 0.3.29-r1.
thanks for reporting.