Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 70342 - (toolchain) emerging net-misc/adjtimex-1.16-r1 fails
Summary: (toolchain) emerging net-misc/adjtimex-1.16-r1 fails
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High blocker (vote)
Assignee: The Gentoo Linux Hardened Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-07 04:40 UTC by Markku Kolkka
Modified: 2005-01-07 04:03 UTC (History)
1 user (show)

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


Attachments
adjtimex-1.16-pic.patch (adjtimex-1.16-pic.patch,315 bytes, patch)
2004-11-16 06:10 UTC, solar (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markku Kolkka 2004-11-07 04:40:57 UTC
I'm trying to emerge the adjtimex package, but the compilation fails at the line with the "_syscall1(int, adjtimex, struct timex *, txcp)" macro. 

Reproducible: Always
Steps to Reproduce:
1.ACCEPT_KEYWORDS='~x86' emerge adjtimex  
2.
3.

Actual Results:  
gcc -Os -march=athlon-xp -fomit-frame-pointer -pipe -I. -DVERSION=\"1.16\" -o
adjtimex adjtimex.c  \
        mat.o -lm
adjtimex.c: In function `adjtimex':
adjtimex.c:43: error: can't find a register in class `BREG' while reloading `asm'
make: *** [adjtimex] Error 1



Performing Global Updates: /usr/portage/profiles/updates/4Q-2004
(Could take a couple of minutes if you have a lot of binary packages.)
  .='update pass'  *='binary update'  @='/var/db move'
  s='/var/db SLOT move' S='binary SLOT move' p='update /etc/portage/package.*'
............................
Portage 2.0.51-r2 (default-x86-2004.2, gcc-3.3.4, glibc-2.3.4.20040808-r1,
2.6.9-gentoo-r1 i686)
=================================================================
System uname: 2.6.9-gentoo-r1 i686 AMD Duron(tm)
Gentoo Base System version 1.4.16
Autoconf: sys-devel/autoconf-2.59-r5
Automake: sys-devel/automake-1.8.5-r1
Binutils: sys-devel/binutils-2.14.90.0.8-r1
Headers:  sys-kernel/linux26-headers-2.6.8.1
Libtools: sys-devel/libtool-1.5.2-r5
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-Os -march=athlon-xp -fomit-frame-pointer -pipe"
CHOST="i686-pc-linux-gnu"
COMPILER=""
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config
/usr/kde/3/share/config /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-Os -march=athlon-xp -fomit-frame-pointer -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs ccache distlocks sandbox"
GENTOO_MIRRORS="http://trumpetti.atm.tut.fi/gentoo/
http://ftp.linux.ee/pub/gentoo/distfiles/ http://ftp.du.se/pub/os/gentoo
ftp://ibiblio.org/pub/Linux/distributions/gentoo/ ftp://gentoo.mirrors.pair.com/"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="acpi berkdb bitmap-fonts crypt cups emacs encode f77 foomaticdb gdbm gif
gpm hardened imlib jpeg libg++ libwww mad mikmod mmx mpeg ncurses nls nptl
oggvorbis oss pam pdflib perl png python readline slang spell sse ssl svga tcpd
truetype x86 xml2 xmms zlib"
Comment 1 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2004-11-07 17:06:48 UTC
could you please go into the adjtimex work directory, and run:
cpp -E -I. adjtimex.c -o adjtimex.c.out

then go and look for 'int F_print = 0;' and please tell me the contents of the source line above it (post the line here).

I get:
int adjtimex(struct timex * txcp) { long __res; __asm__ volatile ("int $0x80" : "=a" (__res) : "0" (124),"b" ((long)(txcp))); do { if ((unsigned long)(__res) >= (unsigned long)(-125)) { (*__errno_location ()) = -(__res); __res = -1; } return (int) (__res); } while (0); }

Then put this line in 'foo.c':
"extern int *__errno_location (void);"
and put in the line you got above as well.

run:
"gcc -c foo.c -o tmp -save-temps"
and post up any output that is generated, and the 'foo.c.s' file.
Comment 2 Markku Kolkka 2004-11-08 04:25:34 UTC
int adjtimex(struct timex * txcp) { long __res; __asm__ volatile ("int $0x80" : "=a"
 (__res) : "0" (124),"b" ((long)(txcp))); do { if ((unsigned long)(__res) >= (unsign
ed long)(-125)) { (*__errno_location ()) = -(__res); __res = -1; } return (int) (__r
es); } while (0); }


# gcc -c foo.c -o tmp -save-temps
foo.c:3: warning: `struct timex' declared inside parameter list
foo.c:3: warning: its scope is only this definition or declaration, which is probably not what you want
foo.c: In function `adjtimex':
foo.c:3: error: can't find a register in class `BREG' while reloading `asm'

# cat foo.s
        .file   "foo.c"
.globl __stack_smash_handler
        .section        .note.GNU-stack,"",@progbits
        .ident  "GCC: (GNU) 3.3.4 20040623 (Gentoo Hardened Linux 3.3.4-r1, ssp-3.3.2-2, pie-8.7.6)"
Comment 3 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2004-11-15 23:24:04 UTC
I've narrowed this down to only happening when hardened GCC is being used.
I'm passing the bug on to the hardened folk to deal with.
Comment 4 solar (RETIRED) gentoo-dev 2004-11-16 06:10:42 UTC
Created attachment 44057 [details, diff]
adjtimex-1.16-pic.patch

initial patch for hardened toolchain users that allows adjtimex-1.16 to
compile.
Comment 5 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2005-01-04 20:23:41 UTC
markku: does solar's patch work for you?
Comment 6 Markku Kolkka 2005-01-05 06:58:18 UTC
Yes, adjtimex compiles and works after applying the patch.
Comment 7 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2005-01-07 04:03:55 UTC
fixed in cvs.
solar: thanks for the patch.