Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 78531 - (toolchain) sash-3.7 emerge (using -fstack-protector) fails with errors like "multiple definition of `__guard'"
Summary: (toolchain) sash-3.7 emerge (using -fstack-protector) fails with errors like ...
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: The Gentoo Linux Hardened Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-18 09:37 UTC by Vladimir
Modified: 2005-01-19 16:10 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir 2005-01-18 09:37:11 UTC
i`m building a 'hardened' system and emerge sash fails.




Reproducible: Always
Steps to Reproduce:
1.emerge sash
2.
3.

Actual Results:  
[root@root]# emerge sash
Calculating dependencies ...done!
>>> emerge (1 of 1) app-shells/sash-3.7 to /
>>> md5 src_uri ;-) sash-3.7.tar.gz
>>> Unpacking source...
>>> Unpacking sash-3.7.tar.gz to /var/tmp/portage/sash-3.7/work
 * Applying sash-3.6-fix-includes.patch ...                               [ ok ]
 * Applying sash-3.7-builtin.patch ...                                    [ ok ]
readline
 * Applying sash-3.6-readline.patch ...                                   [ ok ]
>>> Source unpacked.
gcc -O2 -mcpu=i686 -funroll-loops -pipe -fstack-protector -Wall
-Wmissing-prototypes -DHAVE_GZIP=1 -DHAVE_LINUX_ATTR=1 -DHAVE_LINUX_MOUNT=1
-DHAVE_BSD_MOUNT=0 -DMOUNT_TYPE='"ext3"' -DHAVE_READLINE   -c -o sash.o sash.c
sash.c: In function `fileman_completion':
sash.c:536: warning: implicit declaration of function `completion_matches'
sash.c:536: warning: assignment makes pointer from integer without a cast
sash.c: In function `command_generator':
sash.c:561: warning: suggest parentheses around assignment used as truth value
/usr/include/ctype.h: At top level:
sash.c:1458: warning: `showPrompt' defined but not used
gcc -O2 -mcpu=i686 -funroll-loops -pipe -fstack-protector -Wall
-Wmissing-prototypes -DHAVE_GZIP=1 -DHAVE_LINUX_ATTR=1 -DHAVE_LINUX_MOUNT=1
-DHAVE_BSD_MOUNT=0 -DMOUNT_TYPE='"ext3"' -DHAVE_READLINE   -c -o cmds.o cmds.c
gcc -O2 -mcpu=i686 -funroll-loops -pipe -fstack-protector -Wall
-Wmissing-prototypes -DHAVE_GZIP=1 -DHAVE_LINUX_ATTR=1 -DHAVE_LINUX_MOUNT=1
-DHAVE_BSD_MOUNT=0 -DMOUNT_TYPE='"ext3"' -DHAVE_READLINE   -c -o cmd_dd.o cmd_dd.c
gcc -O2 -mcpu=i686 -funroll-loops -pipe -fstack-protector -Wall
-Wmissing-prototypes -DHAVE_GZIP=1 -DHAVE_LINUX_ATTR=1 -DHAVE_LINUX_MOUNT=1
-DHAVE_BSD_MOUNT=0 -DMOUNT_TYPE='"ext3"' -DHAVE_READLINE   -c -o cmd_ed.o cmd_ed.c
gcc -O2 -mcpu=i686 -funroll-loops -pipe -fstack-protector -Wall
-Wmissing-prototypes -DHAVE_GZIP=1 -DHAVE_LINUX_ATTR=1 -DHAVE_LINUX_MOUNT=1
-DHAVE_BSD_MOUNT=0 -DMOUNT_TYPE='"ext3"' -DHAVE_READLINE   -c -o cmd_grep.o
cmd_grep.c
gcc -O2 -mcpu=i686 -funroll-loops -pipe -fstack-protector -Wall
-Wmissing-prototypes -DHAVE_GZIP=1 -DHAVE_LINUX_ATTR=1 -DHAVE_LINUX_MOUNT=1
-DHAVE_BSD_MOUNT=0 -DMOUNT_TYPE='"ext3"' -DHAVE_READLINE   -c -o cmd_ls.o cmd_ls.c
gcc -O2 -mcpu=i686 -funroll-loops -pipe -fstack-protector -Wall
-Wmissing-prototypes -DHAVE_GZIP=1 -DHAVE_LINUX_ATTR=1 -DHAVE_LINUX_MOUNT=1
-DHAVE_BSD_MOUNT=0 -DMOUNT_TYPE='"ext3"' -DHAVE_READLINE   -c -o cmd_tar.o cmd_tar.c
gcc -O2 -mcpu=i686 -funroll-loops -pipe -fstack-protector -Wall
-Wmissing-prototypes -DHAVE_GZIP=1 -DHAVE_LINUX_ATTR=1 -DHAVE_LINUX_MOUNT=1
-DHAVE_BSD_MOUNT=0 -DMOUNT_TYPE='"ext3"' -DHAVE_READLINE   -c -o cmd_gzip.o
cmd_gzip.c
gcc -O2 -mcpu=i686 -funroll-loops -pipe -fstack-protector -Wall
-Wmissing-prototypes -DHAVE_GZIP=1 -DHAVE_LINUX_ATTR=1 -DHAVE_LINUX_MOUNT=1
-DHAVE_BSD_MOUNT=0 -DMOUNT_TYPE='"ext3"' -DHAVE_READLINE   -c -o cmd_find.o
cmd_find.c
gcc -O2 -mcpu=i686 -funroll-loops -pipe -fstack-protector -Wall
-Wmissing-prototypes -DHAVE_GZIP=1 -DHAVE_LINUX_ATTR=1 -DHAVE_LINUX_MOUNT=1
-DHAVE_BSD_MOUNT=0 -DMOUNT_TYPE='"ext3"' -DHAVE_READLINE   -c -o cmd_file.o
cmd_file.c
gcc -O2 -mcpu=i686 -funroll-loops -pipe -fstack-protector -Wall
-Wmissing-prototypes -DHAVE_GZIP=1 -DHAVE_LINUX_ATTR=1 -DHAVE_LINUX_MOUNT=1
-DHAVE_BSD_MOUNT=0 -DMOUNT_TYPE='"ext3"' -DHAVE_READLINE   -c -o cmd_chattr.o
cmd_chattr.c
gcc -O2 -mcpu=i686 -funroll-loops -pipe -fstack-protector -Wall
-Wmissing-prototypes -DHAVE_GZIP=1 -DHAVE_LINUX_ATTR=1 -DHAVE_LINUX_MOUNT=1
-DHAVE_BSD_MOUNT=0 -DMOUNT_TYPE='"ext3"' -DHAVE_READLINE   -c -o cmd_ar.o cmd_ar.c
gcc -O2 -mcpu=i686 -funroll-loops -pipe -fstack-protector -Wall
-Wmissing-prototypes -DHAVE_GZIP=1 -DHAVE_LINUX_ATTR=1 -DHAVE_LINUX_MOUNT=1
-DHAVE_BSD_MOUNT=0 -DMOUNT_TYPE='"ext3"' -DHAVE_READLINE   -c -o utils.o utils.c
gcc --disable-shared -static -s -o sash sash.o cmds.o cmd_dd.o cmd_ed.o
cmd_grep.o cmd_ls.o cmd_tar.o cmd_gzip.o cmd_find.o cmd_file.o cmd_chattr.o
cmd_ar.o utils.o -lz -lreadline -lncurses
/usr/lib/gcc-lib/i486-pc-linux-gnu/3.2.3/../../../libc.a(ssp.o)(.data+0x0):
multiple definition of `__guard'
/usr/lib/gcc-lib/i486-pc-linux-gnu/3.2.3/libgcc.a(_stack_smash_handler.oS)(.data+0x0):/var/tmp/portage/gcc-3.2.3-r1/work/gcc-3.2.3/gcc/libgcc2.c:2078:
first defined here
/usr/bin/ld: Warning: size of symbol `__guard' changed from 32 in
/usr/lib/gcc-lib/i486-pc-linux-gnu/3.2.3/libgcc.a(_stack_smash_handler.oS) to 4
in /usr/lib/gcc-lib/i486-pc-linux-gnu/3.2.3/../../../libc.a(ssp.o)
/usr/lib/gcc-lib/i486-pc-linux-gnu/3.2.3/../../../libc.a(ssp.o)(.text+0x90): In
function `__stack_smash_handler':
: multiple definition of `__stack_smash_handler'
/usr/lib/gcc-lib/i486-pc-linux-gnu/3.2.3/libgcc.a(_stack_smash_handler.oS)(.text+0x80):/var/tmp/portage/gcc-3.2.3-r1/work/gcc-3.2.3/gcc/libgcc2.c:2093:
first defined here
/usr/bin/ld: Warning: size of symbol `__stack_smash_handler' changed from 603 in
/usr/lib/gcc-lib/i486-pc-linux-gnu/3.2.3/libgcc.a(_stack_smash_handler.oS) to
716 in /usr/lib/gcc-lib/i486-pc-linux-gnu/3.2.3/../../../libc.a(ssp.o)
cmd_ls.o(.text+0xaac): In function `listFile':
: warning: Using 'getgrgid' in statically linked applications requires at
runtime the shared libraries from the glibc version used for linking
cmds.o(.text+0x6ce): In function `do_chgrp':
: warning: Using 'getgrnam' in statically linked applications requires at
runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc-lib/i486-pc-linux-gnu/3.2.3/../../../libreadline.a(complete.o)(.text+0xf41):
In function `rl_username_completion_function':
: warning: Using 'getpwent' in statically linked applications requires at
runtime the shared libraries from the glibc version used for linking
cmds.o(.text+0x5be): In function `do_chown':
: warning: Using 'getpwnam' in statically linked applications requires at
runtime the shared libraries from the glibc version used for linking
cmd_ls.o(.text+0xa3e): In function `listFile':
: warning: Using 'getpwuid' in statically linked applications requires at
runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc-lib/i486-pc-linux-gnu/3.2.3/../../../libreadline.a(complete.o)(.text+0xf34):
In function `rl_username_completion_function':
: warning: Using 'setpwent' in statically linked applications requires at
runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc-lib/i486-pc-linux-gnu/3.2.3/../../../libreadline.a(complete.o)(.text+0xf85):
In function `rl_username_completion_function':
: warning: Using 'endpwent' in statically linked applications requires at
runtime the shared libraries from the glibc version used for linking
collect2: ld returned 1 exit status
make: *** [sash] Error 1

!!! ERROR: app-shells/sash-3.7 failed.
!!! Function src_compile, Line 36, Exitcode 2
!!! (no error message)
!!! If you need support, post the topmost build error, NOT this status message. 


Expected Results:  
successfull emerge of sash-3.7

My computer configuration:

[root@root]# gcc --version
gcc (GCC) 3.2.3 20030422 (Gentoo Linux 1.4 3.2.3-r1, propolice)

[root@root]# emerge --version
Portage 2.0.51-r3 (hardened/x86, gcc-3.2.3, glibc-2.3.4.20040808-r1,
2.4.28-grsec-2.1.0 i686)

[root@root]# emerge --info
Portage 2.0.51-r3 (hardened/x86, gcc-3.2.3, glibc-2.3.4.20040808-r1,
2.4.28-grsec-2.1.0 i686)
=================================================================
System uname: 2.4.28-grsec-2.1.0 i686 Pentium III (Coppermine)
Gentoo Base System version 1.4.3.8p1
Autoconf: sys-devel/autoconf-2.59-r5
Automake: sys-devel/automake-1.8.5-r1
Binutils: sys-devel/binutils-2.15.92.0.2-r1
Headers:  sys-kernel/linux-headers-2.4.19-r1,sys-kernel/linux-headers-2.4.21-r1
Libtools: sys-devel/libtool-1.4.3-r1
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-O2 -mcpu=i686 -funroll-loops -pipe -fstack-protector"
CHOST="i686-pc-linux-gnu"
COMPILER=""
CONFIG_PROTECT="/etc /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="-O2 -mcpu=i686 -funroll-loops -pipe -fstack-protector"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig ccache distlocks sandbox"
GENTOO_MIRRORS="http://gentoo.osuosl.org
http://distro.ibiblio.org/pub/Linux/distributions/gentoo"
MAKEOPTS="-j2"
PKGDIR="/usr/portage//packages/x86/"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage/"
PORTDIR_OVERLAY=""
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="berkdb crypt dlloader gdbm hardened java ncurses nls pam perl pic pie
python readline ssl tcpd x86 zlib"
Comment 1 solar (RETIRED) gentoo-dev 2005-01-19 05:17:49 UTC
CFLAGS=-fstack-protector and USE=hardened do sorta the same thing.

Solution is to remove -fstack-protectror from your CFLAGS and let the toolchain handle emitting the fstack when/where ever it can be used.

Closing bug as invalid
Comment 2 Vladimir 2005-01-19 09:14:19 UTC
>>Solution is to remove -fstack-protectror from your CFLAGS and let the toolchain handle emitting the fstack when/where ever it can be used.

this doesn`t fix the problem. Here is log:
==========================================

[root@root]# emerge sash
Calculating dependencies ...done!
>>> emerge (1 of 1) app-shells/sash-3.7 to /
>>> md5 src_uri ;-) sash-3.7.tar.gz
>>> Unpacking source...
>>> Unpacking sash-3.7.tar.gz to /var/tmp/portage/sash-3.7/work
 * Applying sash-3.6-fix-includes.patch ...                               [ ok ]
 * Applying sash-3.7-builtin.patch ...                                    [ ok ]
readline
 * Applying sash-3.6-readline.patch ...                                   [ ok ]
>>> Source unpacked.
gcc -O2 -mcpu=i686 -pipe -Wall -Wmissing-prototypes -DHAVE_GZIP=1 -DHAVE_LINUX_ATTR=1 -DHAVE_LINUX_MOUNT=1 -DHAVE_BSD_MOUNT=0 -DMOUNT_TYPE='"ext3"' -DHAVE_READLINE   -c -o sash.o sash.c
sash.c: In function `fileman_completion':
sash.c:536: warning: implicit declaration of function `completion_matches'
sash.c:536: warning: assignment makes pointer from integer without a cast
sash.c: In function `command_generator':
sash.c:561: warning: suggest parentheses around assignment used as truth value
/usr/include/ctype.h: At top level:
sash.c:1458: warning: `showPrompt' defined but not used
gcc -O2 -mcpu=i686 -pipe -Wall -Wmissing-prototypes -DHAVE_GZIP=1 -DHAVE_LINUX_ATTR=1 -DHAVE_LINUX_MOUNT=1 -DHAVE_BSD_MOUNT=0 -DMOUNT_TYPE='"ext3"' -DHAVE_READLINE   -c -o cmds.o cmds.c
....
....
....
gcc -O2 -mcpu=i686 -pipe -Wall -Wmissing-prototypes -DHAVE_GZIP=1 -DHAVE_LINUX_ATTR=1 -DHAVE_LINUX_MOUNT=1 -DHAVE_BSD_MOUNT=0 -DMOUNT_TYPE='"ext3"' -DHAVE_READLINE   -c -o utils.o utils.c
gcc --disable-shared -static -s -o sash sash.o cmds.o cmd_dd.o cmd_ed.o cmd_grep.o cmd_ls.o cmd_tar.o cmd_gzip.o cmd_find.o cmd_file.o cmd_chattr.o cmd_ar.o utils.o -lz -lreadline -lncurses
/usr/lib/gcc-lib/i486-pc-linux-gnu/3.2.3/../../../libc.a(ssp.o)(.data+0x0): multiple definition of `__guard'
/usr/lib/gcc-lib/i486-pc-linux-gnu/3.2.3/libgcc.a(_stack_smash_handler.oS)(.data+0x0):/var/tmp/portage/gcc-3.2.3-r1/work/gcc-3.2.3/gcc/libgcc2.c:2078: first defined here
/usr/bin/ld: Warning: size of symbol `__guard' changed from 32 in /usr/lib/gcc-lib/i486-pc-linux-gnu/3.2.3/libgcc.a(_stack_smash_handler.oS) to 4 in /usr/lib/gcc-lib/i486-pc-linux-gnu/3.2.3/../../../libc.a(ssp.o)
/usr/lib/gcc-lib/i486-pc-linux-gnu/3.2.3/../../../libc.a(ssp.o)(.text+0x90): In function `__stack_smash_handler':
: multiple definition of `__stack_smash_handler'
/usr/lib/gcc-lib/i486-pc-linux-gnu/3.2.3/libgcc.a(_stack_smash_handler.oS)(.text+0x80):/var/tmp/portage/gcc-3.2.3-r1/work/gcc-3.2.3/gcc/libgcc2.c:2093: first defined here
/usr/bin/ld: Warning: size of symbol `__stack_smash_handler' changed from 603 in /usr/lib/gcc-lib/i486-pc-linux-gnu/3.2.3/libgcc.a(_stack_smash_handler.oS) to 716 in /usr/lib/gcc-lib/i486-pc-linux-gnu/3.2.3/../../../libc.a(ssp.o)
cmd_ls.o(.text+0x84d): In function `listFile':
: warning: Using 'getgrgid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
cmds.o(.text+0x69e): In function `do_chgrp':
: warning: Using 'getgrnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc-lib/i486-pc-linux-gnu/3.2.3/../../../libreadline.a(complete.o)(.text+0xf41): In function `rl_username_completion_function':
: warning: Using 'getpwent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
cmds.o(.text+0x58e): In function `do_chown':
: warning: Using 'getpwnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
cmd_ls.o(.text+0x7df): In function `listFile':
: warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc-lib/i486-pc-linux-gnu/3.2.3/../../../libreadline.a(complete.o)(.text+0xf34): In function `rl_username_completion_function':
: warning: Using 'setpwent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc-lib/i486-pc-linux-gnu/3.2.3/../../../libreadline.a(complete.o)(.text+0xf85): In function `rl_username_completion_function':
: warning: Using 'endpwent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
collect2: ld returned 1 exit status
make: *** [sash] Error 1
=====================================================

Here is USE and CFLAGS(from emerge --info):
==================
USE="berkdb crypt dlloader gdbm hardened java ncurses nls pam perl pic pie python readline ssl tcpd x86 zlib"
CFLAGS="-O2 -mcpu=i686 -pipe
Comment 3 solar (RETIRED) gentoo-dev 2005-01-19 16:10:23 UTC
/usr/lib/gcc-lib/i486-pc-linux-gnu/3.2.3/../../../libc.a (see this?) this means you miscompiled your userland. You got that symbol in your *.a due to you using -fstack-protector in your CFLAGS.

Solution for that is to recompile gcc.

And for kix to fix all the other things that will show up over time you should just do an emerge -e world

Closing bug as INVALID again.