Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 546670 - app-admin/sudo-1.8.12: getdate.c:(.text+0x8): undefined reference to `__stack_chk_guard'
Summary: app-admin/sudo-1.8.12: getdate.c:(.text+0x8): undefined reference to `__stack...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-15 12:32 UTC by Alessandro Surace
Modified: 2022-06-07 02:07 UTC (History)
1 user (show)

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


Attachments
build.log (build.log,104.63 KB, text/plain)
2015-04-15 12:32 UTC, Alessandro Surace
Details
USE="-* pam" emerge sudo (build.log,102.01 KB, text/x-log)
2015-04-21 12:33 UTC, Alessandro Surace
Details
glibc build.log (build.log.gz,245.92 KB, application/gzip)
2015-04-21 12:48 UTC, Alessandro Surace
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alessandro Surace 2015-04-15 12:32:15 UTC
Created attachment 401278 [details]
build.log

I got an error while building the latest stable sudo.

getdate.o: In function `DSTcorrect':
getdate.c:(.text+0x8): undefined reference to `__stack_chk_guard'
getdate.c:(.text+0xa6): undefined reference to `__stack_chk_guard'

I configured portage to use the no-stack-protector flag ( CFLAGS="-fno-stack-protector -O2" ) but however the build fails.

In attach the build log.

Here my info:
Portage 2.2.14 (python 2.7.9-final-0, default/linux/amd64/13.0/desktop/gnome/systemd, gcc-4.8.4, glibc-2.20-r2, 3.17.7-gentoo x86_64)
=================================================================
System uname: Linux-3.17.7-gentoo-x86_64-Intel-R-_Core-TM-_i5-3437U_CPU_@_1.90GHz-with-gentoo-2.2
KiB Mem:     8046820 total,   3577004 free
KiB Swap:    8783188 total,   7898204 free
Timestamp of tree: Tue, 14 Apr 2015 07:00:01 +0000
ld GNU ld (Gentoo 2.24 p1.4) 2.24
distcc 3.1 x86_64-pc-linux-gnu [enabled]
ccache version 3.1.9 [enabled]
app-shells/bash:          4.2_p53
dev-java/java-config:     2.2.0
dev-lang/perl:            5.20.2
dev-lang/python:          2.7.9-r1, 3.3.5-r1, 3.4.1
dev-util/ccache:          3.1.9-r4
dev-util/cmake:           2.8.12.2-r1
dev-util/pkgconfig:       0.28-r2
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.13.11
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.10.3-r1, 1.11.6-r1, 1.13.4, 1.14.1
sys-devel/binutils:       2.24-r3
sys-devel/gcc:            4.8.4
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4.6
sys-devel/make:           4.1-r1
sys-kernel/linux-headers: 3.18 (virtual/os-headers)
sys-libs/glibc:           2.20-r2
Repositories: gentoo betagarden vaca Local-Repo
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=core2 -mtune=generic -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/gnupg/qualified.txt /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=core2 -mtune=generic -O2 -pipe"
DISTDIR="/usr/portage/distfiles/"
EMERGE_DEFAULT_OPTS="--alphabetical  --with-bdeps=y --autounmask-write --autounmask=y --keep-going y"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs ccache config-protect-if-modified distcc distlocks ebuild-locks fixlafiles merge-sync metadata-transfer news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="rsync://trumpetti.atm.tut.fi/gentoo/ http://trumpetti.atm.tut.fi/gentoo/ ftp://de-mirror.org/gentoo/ rsync://de-mirror.org/gentoo/ rsync://mirror.netcologne.de/gentoo/ http://mirror.opteamax.de/gentoo/ rsync://ftp.df.lth.se/pub/gentoo/ ftp://ftp.df.lth.se/pub/gentoo/"
LANG="en_US.UTF-8"
LC_ALL="en_US"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j4"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/var/lib/layman/betagarden /var/lib/layman/vaca /usr/portage/local"
USE="X a52 aac acl acpi alsa amd64 avahi berkdb bindist bluetooth branding bzip2 cairo cdda cdr cli colord cracklib crypt cups curl cxx dbus dhcp dri dts dvd dvdr eap-tls eds emboss encode evo exif fam firefox flac fortran gconf gdbm geoip gif git glamor gnome gnome-keyring gnome-online-accounts gnutls gpm gstreamer gtk iconv introspection jpeg lcms ldap libav libnotify libsecret lzo mad mime mmx mmxext mng modules mp3 mp4 mpeg mplayer multilib nautilus ncurses networkmanager nls nptl ogg opengl openmp pam pango pcre pdf png policykit ppds pulseaudio python qt3support readline samba sdl session socialweb spell sse sse2 ssl startup-notification svg systemd tcpd tiff transcode truetype udev udisks unicode upower usb v4l vim-syntax vorbis wifi wxwidgets x264 xcb xinerama xml xv xvid zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner aut hz_user autoindex cache dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache m ime mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="canon ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" DRACUT_MODULES="lvm syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="coreboot efi-64 emu multiboot pc qemu" INPUT_DEVICES="keyboard mouse evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en_US en it de" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_3" QEMU_SOFTMMU_TARGETS="i386 x86_64 arm" QEMU_USER_TARGETS="i386 x86_64 arm" RUBY_TARGETS="ruby19 ruby20" USERLAND="GNU" VIDEO_CARDS="intel i915 i965" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, INSTALL_MASK, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, SYNC, USE_PYTHON
Comment 1 Tomáš Mózes 2015-04-16 04:38:48 UTC
Do you have problems emerging other programs (C/C++)? I would try re-emerging gcc/libtool/binutils and then trying sudo again.
Comment 2 Alessandro Surace 2015-04-17 07:18:43 UTC
No problem emerging other stuff. However I give a try rebuild gcc/binutils/libtools .
Comment 3 Alessandro Surace 2015-04-17 08:19:34 UTC
I confirm the same problem also after rebuild gcc/binutils/libtool
Comment 4 Tomáš Mózes 2015-04-17 18:12:11 UTC
Have you modified the stack protector settings except when compiling sudo?

Please post the output of:
emerge -pvq sudo
emerge -pvq gcc

Try emerging sudo with just pam USE:
USE="-* pam" emerge sudo

And try to re-emerge glibc.
Comment 5 SpanKY gentoo-dev 2015-04-20 20:42:32 UTC
__stack_chk_guard isn't a real symbol normally.  are you forcing USE=libssp on gcc or something ?  attach the full build log of your current gcc.
Comment 6 Alessandro Surace 2015-04-21 12:33:17 UTC
Follow the info requested:
[ebuild     U ] app-admin/sudo-1.8.12 [1.8.11_p1] USE="ldap nls -offensive pam (-selinux) sendmail -skey" 

[ebuild   R   ] sys-devel/gcc-4.8.4  USE="(-altivec) (-awt) cxx -doc (-fixed-point) fortran gcj -go -graphite (-hardened) (-libssp) -mudflap (multilib) (-multislot) nls -nopie -nossp nptl -objc -objc++ -objc-gc openmp -regression-test sanitize -vanilla" 

I also retried to emerge with "USE="-* pam" emerge sudo" but I hit the same problem. Attached the build log
Comment 7 Alessandro Surace 2015-04-21 12:33:48 UTC
Created attachment 401730 [details]
USE="-* pam" emerge sudo
Comment 8 Alessandro Surace 2015-04-21 12:36:37 UTC
No USE=libssp set on gcc. I don't have the full gcc build.log available.
Comment 9 Alessandro Surace 2015-04-21 12:47:15 UTC
I tried to rebuild glibc and I have the same problem also with it!
See the build log.
Comment 10 Alessandro Surace 2015-04-21 12:48:40 UTC
Created attachment 401738 [details]
glibc build.log
Comment 11 Alessandro Surace 2015-04-28 08:15:16 UTC
I found something.
It seems that the option configure in /etc/portage/package.env /etc/portage/env are not properly managed in the build phase.

I have these files configured:
::::::::::::::
package.env/nostackprotector
::::::::::::::
# http://stackoverflow.com/questions/4492799/undefined-reference-to-stack-chk-fail
x11-libs/vte nostackprotector.conf
sys-libs/glibc nostackprotector.conf
www-client/chromium nostackprotector.conf
#app-admin/sudo nostackprotector.conf
=sys-apps/systemd-218-r3 nostackprotector.conf
=dev-lang/ruby-2.0.0_p645 nostackprotector.conf
=app-admin/sudo-1.8.12 nostackprotector.conf
::::::::::::::
env/nostackprotector.conf
::::::::::::::
CFLAGS="-fno-stack-protector -O2"

When I go to build sudo I can see that although the "-fno-stack-feature" is configured there is also the "-fstack-protector-all" configured. Possibly this is the default by gcc .

So trying to id manually I get:

sudoers # x86_64-pc-linux-gnu-gcc -std=gnu99 -o .libs/sudoreplay getdate.o locale.o sudoreplay.o -Wl,-O1 -Wl,--as-needed -Wl,-z -Wl,relro -fPIE -pie -fstack-protector-all .libs/timestr.o  ../../lib/util/.libs/libsudo_util.so -ldl -lz  -Wl,-rpath -Wl,/usr/libexec/sudo
sudoreplay.o: In function `session_compare':
sudoreplay.c:(.text+0x7): undefined reference to `__stack_chk_guard'
sudoreplay.o: In function `sudoreplay_cleanup':
sudoreplay.c:(.text+0x47): undefined reference to `__stack_chk_guard'
sudoreplay.o: In function `parse_expr':
sudoreplay.c:(.text+0xa3): undefined reference to `__stack_chk_guard'
sudoreplay.c:(.text+0x4bd): undefined reference to `__stack_chk_guard'
sudoreplay.o: In function `free_log_info':
sudoreplay.c:(.text+0x80c): undefined reference to `__stack_chk_guard'
sudoreplay.o:sudoreplay.c:(.text+0x8be): more undefined references to `__stack_chk_guard' follow
collect2: error: ld returned 1 exit status

sudoers # x86_64-pc-linux-gnu-gcc -std=gnu99 -c -I../../include -I../.. -I. -I. -I../.. -DLIBDIR=\"/usr/lib64\" -D__STDC_WANT_LIB_EXT1__=1 -fno-stack-protector -O2 -fvisibility=hidden -fPIE -fstack-protector-all -D_GNU_SOURCE -D_FORTIFY_SOURCE=2 -D_PATH_SUDOERS=\"/etc/sudoers\" -DSUDOERS_UID=0 -DSUDOERS_GID=0 -DSUDOERS_MODE=0440 -DLOCALEDIR=\"/usr/share/locale\" ./sudoreplay.c
<command-line>:0:0: warning: "_FORTIFY_SOURCE" redefined [enabled by default]
<built-in>:0:0: note: this is the location of the previous definition

sudoers # x86_64-pc-linux-gnu-gcc -std=gnu99 -o .libs/sudoreplay getdate.o locale.o sudoreplay.o -Wl,-O1 -Wl,--as-needed -Wl,-z -Wl,relro -fPIE -pie -fstack-protector-all .libs/timestr.o  ../../lib/util/.libs/libsudo_util.so -ldl -lz  -Wl,-rpath -Wl,/usr/libexec/sudo
.libs/timestr.o: In function `get_timestr':
timestr.c:(.text+0xb): undefined reference to `__stack_chk_guard'
timestr.c:(.text+0x83): undefined reference to `__stack_chk_guard'
collect2: error: ld returned 1 exit status

It seems that compiling it manually something change.

Going on I arrive here:
sudoers # /bin/sh ../../libtool --mode=compile x86_64-pc-linux-gnu-gcc -std=gnu99 -c -I../../include -I../.. -I. -I. -I../.. -DLIBDIR=\"/usr/lib64\" -D__STDC_WANT_LIB_EXT1__=1 -fno-stack-protector -O2 -fvisibility=hidden -fPIE -fstack-protector-all -D_GNU_SOURCE -D_FORTIFY_SOURCE=2 -D_PATH_SUDOERS=\"/etc/sudoers\" -DSUDOERS_UID=0 -DSUDOERS_GID=0 -DSUDOERS_MODE=0440 -DLOCALEDIR=\"/usr/share/locale\" ./timestr.c
libtool: compile:  x86_64-pc-linux-gnu-gcc -std=gnu99 -c -I../../include -I../.. -I. -I. -I../.. -DLIBDIR=\"/usr/lib64\" -D__STDC_WANT_LIB_EXT1__=1 -fno-stack-protector -O2 -fvisibility=hidden -fstack-protector-all -D_GNU_SOURCE -D_FORTIFY_SOURCE=2 -D_PATH_SUDOERS=\"/etc/sudoers\" -DSUDOERS_UID=0 -DSUDOERS_GID=0 -DSUDOERS_MODE=0440 -DLOCALEDIR=\"/usr/share/locale\" ./timestr.c  -fPIC -DPIC -o .libs/timestr.o
<command-line>:0:0: warning: "_FORTIFY_SOURCE" redefined [enabled by default]
<built-in>:0:0: note: this is the location of the previous definition
libtool: compile:  x86_64-pc-linux-gnu-gcc -std=gnu99 -c -I../../include -I../.. -I. -I. -I../.. -DLIBDIR=\"/usr/lib64\" -D__STDC_WANT_LIB_EXT1__=1 -fno-stack-protector -O2 -fvisibility=hidden -fstack-protector-all -D_GNU_SOURCE -D_FORTIFY_SOURCE=2 -D_PATH_SUDOERS=\"/etc/sudoers\" -DSUDOERS_UID=0 -DSUDOERS_GID=0 -DSUDOERS_MODE=0440 -DLOCALEDIR=\"/usr/share/locale\" ./timestr.c -fPIE -o timestr.o >/dev/null 2>&1

sudoers # x86_64-pc-linux-gnu-gcc -std=gnu99 -o .libs/sudoreplay getdate.o locale.o sudoreplay.o -Wl,-O1 -Wl,--as-needed -Wl,-z -Wl,relro -fPIE -pie -fstack-protector-all .libs/timestr.o  ../../lib/util/.libs/libsudo_util.so -ldl -lz  -Wl,-rpath -Wl,/usr/libexec/sudo
../../lib/util/.libs/libsudo_util.so: undefined reference to `__stack_chk_guard'
collect2: error: ld returned 1 exit status
Comment 12 Alessandro Surace 2015-04-28 09:15:28 UTC
I had the same problem with net-print/cups. But in this case adding the no-stack-protector feature solved the problem.
Comment 13 Larry the Git Cow gentoo-dev 2022-06-07 02:02:22 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=221eb139027c9465d2162572dfb99534cd3e46f5

commit 221eb139027c9465d2162572dfb99534cd3e46f5
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-06-07 01:48:13 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-06-07 01:59:08 +0000

    app-admin/sudo: add 1.9.11
    
    Closes: https://bugs.gentoo.org/604240
    Closes: https://bugs.gentoo.org/546670
    Signed-off-by: Sam James <sam@gentoo.org>

 app-admin/sudo/Manifest           |   2 +
 app-admin/sudo/sudo-1.9.11.ebuild | 270 ++++++++++++++++++++++++++++++++++++++
 app-admin/sudo/sudo-9999.ebuild   |   7 +
 3 files changed, 279 insertions(+)