Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 608788 - >=sys-libs/glibc-2.24: building w/-fstack-check: localedef segfaults when running locale-gen
Summary: >=sys-libs/glibc-2.24: building w/-fstack-check: localedef segfaults when run...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
: 604198 613848 (view as bug list)
Depends on:
Reported: 2017-02-09 20:03 UTC by Graham Murray
Modified: 2017-06-14 22:53 UTC (History)
6 users (show)

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


Note You need to log in before you can comment on or make changes to this bug.
Description Graham Murray 2017-02-09 20:03:19 UTC
At then of  the merge of glibc-24-1, locale-gen did not create any locales and the systemd journal shows that /usr/bin/localedef segfaulted. 

 $ locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory

emerge --info =sys-libs/glibc-2.24-r1                                                                                                                                                                                                                      
setlocale: unsupported locale setting                                                                                                                                                                                                                                          
!!! Repository 'x11' has sync-uri attribute, but is missing sync-type attribute                                                                                                                                                                                                
Unavailable repository 'calculate' referenced by masters entry in '/var/lib/layman/fidonet/metadata/layout.conf'                                                                                                                                                               
setlocale: unsupported locale setting                                                                                                                                                                                                                                          
Portage 2.3.3 (python 3.5.2-final-0, hardened/linux/amd64, gcc-5.4.0, glibc-2.24-r1, 4.9.8-hardened x86_64)                                                                                                                                                                    
                         System Settings                                                                                                                                                                                                                                       
System uname: Linux-4.9.8-hardened-x86_64-Intel-R-_Core-TM-_i5-2320_CPU_@_3.00GHz-with-gentoo-2.3                                                                                                                                                                              
KiB Mem:     8155760 total,   3897964 free                                                                                                                                                                                                                                     
KiB Swap:   16777212 total,  16777212 free                                                                                                                                                                                                                                     
Timestamp of repository gentoo: Thu, 09 Feb 2017 17:45:01 +0000                                                                                                                                                                                                                
Timestamp of repository fidonet: Tue, 31 Jan 2017 16:10:13 +0000                                                                                                                                                                                                               
sh bash 4.4_p11                                                                                                                                                                                                                                                                
ld GNU ld (Gentoo 2.27 p1.0) 2.27                                                                                                                                                                                                                                              
app-shells/bash:          4.4_p11::gentoo                                                                                                                                                                                                                                      
dev-java/java-config:     2.2.0-r3::gentoo                                                                                                                                                                                                                                     
dev-lang/perl:            5.24.1_rc4::gentoo                                                                                                                                                                                                                                   
dev-lang/python:          2.7.12::gentoo, 3.4.5::gentoo, 3.5.2::gentoo                                                                                                                                                                                                         
dev-util/cmake:           3.7.2::gentoo                                                                                                                                                                                                                                        
dev-util/pkgconfig:       0.29.1::gentoo                                                                                                                                                                                                                                       
sys-apps/baselayout:      2.3::gentoo                                                                                                                                                                                                                                          
sys-apps/openrc:          0.23.2::gentoo                                                                                                                                                                                                                                       
sys-apps/sandbox:         2.10-r3::gentoo                                                                                                                                                                                                                                      
sys-devel/autoconf:       2.13::gentoo, 2.69-r2::gentoo                                                                                                                                                                                                                        
sys-devel/automake:       1.11.6-r2::gentoo, 1.13.4-r1::gentoo, 1.14.1-r1::gentoo, 1.15-r2::gentoo                                                                                                                                                                             
sys-devel/binutils:       2.25.1-r1::gentoo, 2.26.1::gentoo, 2.27::gentoo
sys-devel/gcc:            4.9.3::gentoo, 5.4.0-r3::gentoo
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r2::gentoo
sys-devel/make:           4.2.1::gentoo
sys-kernel/linux-headers: 4.9::gentoo (virtual/os-headers)
sys-libs/glibc:           2.24-r1::gentoo

    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://
    priority: -1000

    location: /var/lib/layman/fidonet
    masters: gentoo
    priority: 50

    location: /var/lib/layman/x11
    masters: gentoo
    priority: 50

    location: /usr/local/portage
    masters: gentoo
    priority: 200

ACCEPT_KEYWORDS="amd64 ~amd64"
CFLAGS="-march=native -mtune=native -O2 -pipe"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt /var/bind /var/spool/munin-async/.ssh"
CONFIG_PROTECT_MASK="/etc/angband/gamedata/ /etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php7.0/ext-active/ /etc/php/apache2-php7.1/ext-active/ /etc/php/cgi-php7.0/ext-active/ /etc/php/cgi-php7.1/ext-active/ /etc/php/cli-php7.0/ext-active/ /etc/php/cli-php7.1/ext-active/ /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=native -mtune=native -O2 -pipe"
EMERGE_DEFAULT_OPTS="--with-bdeps y"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs buildpkg cgroup config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync network-sandbox news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-march=native -mtune=native -O2 -pipe"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
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 --exclude=/.git"
USE="X a52 aac acl alsa amd64 apache2 avx berkdb branding bzip2 cairo caps cdda cddb cli cracklib crypt cups cxx dbus directfb dri dts dvd eds emacs encode examples exif fam ffmpeg flac fontconfig fortran gd gdbm geoip gif gmp gnome gnome-keyring gnutls gpm gstreamer gtk hardened iconv icu imagemagick introspection ipv6 java jpeg jpeg2k justify kde lcms libnotify libsamplerate lm_sensors lua lzma mad matroska milter mmx mng modplug modules mp3 mp4 mpeg mtp multilib mysql ncurses nls nptl nsplugin offensive ogg opengl openmp pam pax_kernel pcre perl pfd pie png policykit postgres ppds pulseaudio python qt4 qt5 raw readline sdl seccomp semantic-desktop session sound speex spell sqlite sqlite3 sse sse2 sse3 sse4 sse4_1 sse4_2 ssl ssp ssse3 startup-notification svg systemd tcpd theora threads tiff tk truetype udev unicode urandom usb v4l vaapi vim-syntax vorbis wayland x264 xattr xcb xml xmp xtpax xv xvid zlib" ABI_X86="64 32" 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="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" APACHE2_MPMS="worker" CALLIGRA_FEATURES="braindump flow karbon kexi krita sheets words" 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" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput" KERNEL="linux" L10N="en-GB en fr" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en_GB en fr" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4 python3_5" RUBY_TARGETS="ruby21 ruby22 ruby23 ruby24" USERLAND="GNU" VIDEO_CARDS="nouveau" 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"
USE_PYTHON="2.7 3.3"

                        Package Settings

sys-libs/glibc-2.24-r1::gentoo was built with the following:
USE="caps gd hardened (multilib) rpc -audit -debug -nscd (-profile) (-selinux) -suid -systemtap -vanilla" ABI_X86="64"
CFLAGS="-march=native -mtune=native -pipe -O2 -fno-strict-aliasing -fno-stack-protector"
CXXFLAGS="-march=native -mtune=native -pipe -O2 -fno-strict-aliasing -fno-stack-protector"
Comment 1 Denis Descheneaux 2017-02-09 20:56:15 UTC
Confirm, same issue here as well
Comment 2 Toralf Förster gentoo-dev 2017-02-09 21:01:36 UTC
not only systemd related, happened here at the tinderbox too

it started here at a hardened image where 2.24-r1 was installed, non-hardened images with sys-libs/glibc-2.24 are fine till now
Comment 3 David Korth 2017-02-09 21:42:26 UTC
I'm hitting this with glibc-2.25 as well. Using hardened gcc-6.3.0, it doesn't seem to matter if glibc-2.25 has hardened enabled or not; locale-gen still crashes.

Running localedef in gdb results in a useless message:

(gdb) run -i en_US -f UTF-8 en_US.UTF8
Starting program: /usr/bin/localedef -i en_US -f UTF-8 en_US.UTF8

Program terminated with signal SIGSEGV, Segmentation fault.
The program no longer exists.

With a core dump, also seemingly useless:

Core was generated by `localedef -i en_US -f UTF-8 en_US.UTF8'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007fc1b3254204 in __spawni_child (arguments=0x7ffc03a7abe0) at ../sysdeps/unix/sysv/linux/spawni.c:122
122     ../sysdeps/unix/sysv/linux/spawni.c: No such file or directory.
[Current thread is 1 (LWP 9366)]
(gdb) bt
#0  0x00007fc1b3254204 in __spawni_child (arguments=0x7ffc03a7abe0) at ../sysdeps/unix/sysv/linux/spawni.c:122
#1  0x00007fc1b32636af in clone () from /lib64/
Comment 4 SpanKY gentoo-dev 2017-02-09 22:35:19 UTC
(In reply to Toralf Förster from comment #2)

which patchset was working ?  you can modify the 2.24 ebuild and change PATCH_VER to 1, 2, 3, 4, or 5.

we used to carry a localedef patch related to PaX, but we dropped it starting with 2.23.  so if 2.23 is working, i don't think that's related.
Comment 5 Magnus Granberg gentoo-dev 2017-02-09 23:34:23 UTC
if you put -fstack-check=no in CFLAGS and recompile glibc do it fix it?
Comment 6 David Korth 2017-02-09 23:36:46 UTC
-fstack-check=no fixed it for me. (glibc-2.25, gcc-6.3.0, +hardened)
Comment 7 Jory A. Pratt gentoo-dev 2017-02-10 01:00:48 UTC
(In reply to Magnus Granberg from comment #5)
> if you put -fstack-check=no in CFLAGS and recompile glibc do it fix it?

Comment 8 Tom Li 2017-02-13 09:44:07 UTC
Confirmed with Hardened, gcc 5.3.0
Comment 9 SpanKY gentoo-dev 2017-02-20 23:55:12 UTC
*** Bug 604198 has been marked as a duplicate of this bug. ***
Comment 10 SpanKY gentoo-dev 2017-03-16 06:21:36 UTC
this is due to a rewrite in upstream of the posix spawn API.;a=commit;h=9ff72da471a509a8c19791efe469f47fa6977410

when the child is created, a stack of just one page is allocated.  the stack checking blows that limit pretty easily and we segfault.

i'll discuss upstream the best route to take.
Comment 11 Toralf Förster gentoo-dev 2017-03-25 22:00:46 UTC
*** Bug 613848 has been marked as a duplicate of this bug. ***
Comment 12 Mike Gilbert gentoo-dev 2017-06-06 18:38:51 UTC
Looks like your patch landed upstream. Can we get that applied in Gentoo's ebuilds?
Comment 13 Matthias Maier gentoo-dev 2017-06-14 22:53:33 UTC
Applied to 2.24 and 2.25

commit dc2c28a7d39a02e89a438815b5fbad0261c6a901
Author: Matthias Maier <>
Date:   Wed Jun 14 17:35:21 2017 -0500

    sys-libs/glibc: version 2.25, update to patchset 4
    Package-Manager: Portage-2.3.6, Repoman-2.3.2

commit 2187adcceef17b0df8b35f31f1a9841ccf59de30
Author: Matthias Maier <>
Date:   Wed Jun 14 17:21:46 2017 -0500

    sys-libs/glibc: version 2.24, update to patchset 7
    Package-Manager: Portage-2.3.6, Repoman-2.3.2