Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 318287 - sys-power/cpufreqd buffer overflow w/gcc-4.5 and CFLAGS -O1 or -O2
Summary: sys-power/cpufreqd buffer overflow w/gcc-4.5 and CFLAGS -O1 or -O2
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] GCC Porting (show other bugs)
Hardware: AMD64 Linux
: High major with 1 vote (vote)
Assignee: Mobile Herd (OBSOLETE)
URL:
Whiteboard:
Keywords:
: 362029 398387 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-05-03 14:39 UTC by fkhp
Modified: 2013-08-27 05:04 UTC (History)
10 users (show)

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


Attachments
Patch to increase path buffer size to PATH_MAX (cpufreqd-path-max.patch,472 bytes, patch)
2010-06-09 20:03 UTC, Perttu Luukko
Details | Diff
Updated ebuild utilizing the posted patch (cpufreqd-2.4.2-r1.ebuild,2.00 KB, text/plain)
2010-12-14 11:07 UTC, Sven Eden
Details
Attachment for commend #19 (emerge.info,10.71 KB, text/plain)
2011-01-28 06:57 UTC, rafnov
Details
fixed ebuild using the max-path.patch (cpufreqd-2.4.2-r1.ebuild,2.00 KB, application/octet-stream)
2011-05-23 11:57 UTC, ron widler
Details
emerge --info on x86 (emerge.info,11.48 KB, application/octet-stream)
2011-06-16 12:48 UTC, rafnov
Details
cpufreqd-2.4.2-PATH_MAX.patch (cpufreqd-2.4.2-PATH_MAX.patch,411 bytes, patch)
2011-10-30 04:16 UTC, Nathan Phillip Brink (binki) (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description fkhp 2010-05-03 14:39:41 UTC
boot message:

 * Starting CPU Frequency Daemon ...
*** buffer overflow detected ***: /usr/sbin/cpufreqd terminated
======= Backtrace: =========
/lib/libc.so.6(__fortify_fail+0x37)[0x7f7a4e524cc7]
/lib/libc.so.6(+0xf7b20)[0x7f7a4e522b20]
/lib/libc.so.6(+0xf819b)[0x7f7a4e52319b]
/usr/sbin/cpufreqd(main+0x7fe)[0x403d7e]
/lib/libc.so.6(__libc_start_main+0xfd)[0x7f7a4e449b6d]
/usr/sbin/cpufreqd[0x402ec9]
======= Memory map: ========
00400000-0040b000 r-xp 00000000 08:03 824988                             /usr/sbin/cpufreqd
0060b000-0060c000 r--p 0000b000 08:03 824988                             /usr/sbin/cpufreqd
0060c000-0060d000 rw-p 0000c000 08:03 824988                             /usr/sbin/cpufreqd
0060d000-0062e000 rw-p 00000000 00:00 0                                  [heap]
7f7a4e215000-7f7a4e22a000 r-xp 00000000 08:03 681474                     /lib64/libgcc_s.so.1
7f7a4e22a000-7f7a4e429000 ---p 00015000 08:03 681474                     /lib64/libgcc_s.so.1
7f7a4e429000-7f7a4e42a000 r--p 00014000 08:03 681474                     /lib64/libgcc_s.so.1
7f7a4e42a000-7f7a4e42b000 rw-p 00015000 08:03 681474                     /lib64/libgcc_s.so.1
7f7a4e42b000-7f7a4e597000 r-xp 00000000 08:03 904813                     /lib64/libc-2.11.1.so
7f7a4e597000-7f7a4e796000 ---p 0016c000 08:03 904813                     /lib64/libc-2.11.1.so
7f7a4e796000-7f7a4e79a000 r--p 0016b000 08:03 904813                     /lib64/libc-2.11.1.so
7f7a4e79a000-7f7a4e79b000 rw-p 0016f000 08:03 904813                     /lib64/libc-2.11.1.so
7f7a4e79b000-7f7a4e7a1000 rw-p 00000000 00:00 0 
7f7a4e7a1000-7f7a4e7a6000 r-xp 00000000 08:03 673524                     /usr/lib64/libcpufreq.so.0.0.0
7f7a4e7a6000-7f7a4e9a5000 ---p 00005000 08:03 673524                     /usr/lib64/libcpufreq.so.0.0.0
7f7a4e9a5000-7f7a4e9a6000 r--p 00004000 08:03 673524                     /usr/lib64/libcpufreq.so.0.0.0
7f7a4e9a6000-7f7a4e9a7000 rw-p 00005000 08:03 673524                     /usr/lib64/libcpufreq.so.0.0.0
7f7a4e9a7000-7f7a4e9a9000 r-xp 00000000 08:03 904485                     /lib64/libdl-2.11.1.so
7f7a4e9a9000-7f7a4eba9000 ---p 00002000 08:03 904485                     /lib64/libdl-2.11.1.so
7f7a4eba9000-7f7a4ebaa000 r--p 00002000 08:03 904485                     /lib64/libdl-2.11.1.so
7f7a4ebaa000-7f7a4ebab000 rw-p 00003000 08:03 904485                     /lib64/libdl-2.11.1.so
7f7a4ebab000-7f7a4ebcb000 r-xp 00000000 08:03 904812                     /lib64/ld-2.11.1.so
7f7a4ed98000-7f7a4ed9b000 rw-p 00000000 00:00 0 
7f7a4edc9000-7f7a4edca000 rw-p 00000000 00:00 0 
7f7a4edca000-7f7a4edcb000 r--p 0001f000 08:03 904812                     /lib64/ld-2.11.1.so
7f7a4edcb000-7f7a4edcc000 rw-p 00020000 08:03 904812                     /lib64/ld-2.11.1.so
7f7a4edcc000-7f7a4edcd000 rw-p 00000000 00:00 0 
7fff6310e000-7fff63123000 rw-p 00000000 00:00 0                          [stack]
7fff63194000-7fff63195000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
 * start-stop-daemon: failed to start `/usr/sbin/cpufreqd'
 [ !! ]
 * ERROR: cpufreqd failed to start
Comment 1 Tony Vroon (RETIRED) gentoo-dev 2010-05-03 15:41:58 UTC
This is missing:
1) emerge --info
2) emerge -pv cpufreqd
3) emerge -pv gcc

Please provide the missing information before you reopen the bug.
Comment 2 fkhp 2010-05-03 23:53:17 UTC
gentoo shm # emerge --info
Portage 2.1.8.3 (default/linux/amd64/10.0, gcc-4.5.0, glibc-2.11.1-r0, 2.6.33-ccs-r2 x86_64)
=================================================================
System uname: Linux-2.6.33-ccs-r2-x86_64-Intel-R-_Core-TM-2_Duo_CPU_T9300_@_2.50GHz-with-gentoo-2.0.1
Timestamp of tree: Mon, 03 May 2010 23:00:01 +0000
ccache version 2.4 [enabled]
app-shells/bash:     4.1_p5
dev-java/java-config: 2.1.11
dev-lang/python:     2.6.5-r99, 3.1.2-r3
dev-util/ccache:     2.4-r8
dev-util/cmake:      2.8.1-r1
sys-apps/baselayout: 2.0.1
sys-apps/openrc:     0.6.1-r1
sys-apps/sandbox:    2.2
sys-devel/autoconf:  2.13, 2.65
sys-devel/automake:  1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:  2.20.1
sys-devel/gcc:       4.5.0
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6b
virtual/os-headers:  2.6.33
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-mtune=core2 -march=core2 -O2 -msse4.1 -fomit-frame-pointer -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/X11/xkb /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/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="-mtune=core2 -march=core2 -O2 -msse4.1 -fomit-frame-pointer -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests ccache collision-protect distlocks fixpackages news parallel-fetch protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch"
GENTOO_MIRRORS="ftp://ftp.osuosl.org/pub/gentoo/distfiles/ "
LANG="zh_CN.utf8"
LDFLAGS="-Wl,-O1"
LINGUAS="zh_CN en_US zh en"
MAKEOPTS="-j1"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage /var/lib/layman/x11 /var/lib/layman/vmware /var/lib/layman/gentoo-china /var/lib/layman/gentoo-taiwan /var/lib/layman/sunrise /var/lib/layman/gnome /var/lib/layman/kvm /var/lib/layman/sage-on-gentoo /var/lib/layman/suka /var/lib/layman/wolf31o2 /var/lib/layman/openoffice-geki"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X a52 aac accessibility acl acpi alsa amd64 ao apache2 bash-completion berkdb branding bzip2 cairo caps cdr cjk cli consolekit cracklib crypt cups cxx dbus djvu doc dri dts dvd dvdr eds emboss encode esd evo examples exif fam ffmpeg firefox flac fortran gdbm gdu gif gimp gnome gnome-keyring gphoto2 gpm gstreamer gtk guile i18n iconv icu jadetex java jpeg jpeg2k latex lcms ldap libnotify mad midi mikmod mmap mmx mng modules mp3 mp4 mpeg mudflap multilib mysql nas nautilus ncurses networkmanager nfs nls nntp nptl nptlonly nsplugin nvidia ogg opengl openmp pam pango pch pcre pda pdf perl png policykit ppds pppd python qt3support qt4 readline reflection samba scsi sdl session smp snmp spell spl sqlite sse sse2 ssl ssse3 startup-notification suid svg sysfs tcpd threads tiff tk truetype unicode usb v4l2 vim-syntax vorbis x264 xattr xcb xml xmp xorg xulrunner xv xvid xvmc zlib" ALSA_CARDS="ens1370 hda-intel" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="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 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" ELIBC="glibc" INPUT_DEVICES="evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="zh_CN en_US zh en" QEMU_SOFTMMU_TARGETS="x86_64" QEMU_USER_TARGETS="x86_64" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="vmwgfx vmwlegacy nouveau nvidia nv vmware vesa svga" XTABLES_ADDONS="cui gfw zhang ipset" 
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

gentoo shm # emerge -pv cpufreqd

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R   ] sys-power/cpufreqd-2.3.4-r2  USE="acpi lm_sensors nvidia -apm -nforce2 -pmu" 0 kB [?=>0]

Total: 1 package (1 reinstall), Size of downloads: 0 kB
Portage tree and overlays:
 [0] /usr/portage
 [?] indicates that the source repository could not be determined
gentoo shm # emerge -pv gcc

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R   ] sys-devel/gcc-4.5.0  USE="doc fortran gcj graphite gtk lto mudflap (multilib) multislot nls nptl objc objc++ objc-gc openmp (-altivec) -bootstrap -build (-fixed-point) (-hardened) (-libffi) (-n32) (-n64) -nocxx -test -vanilla" 0 kB [?=>0]

Total: 1 package (1 reinstall), Size of downloads: 0 kB
Portage tree and overlays:
 [0] /usr/portage
 [?] indicates that the source repository could not be determined
gentoo shm # LANG=en_US.utf8 gcc -v
Using built-in specs.
COLLECT_GCC=/usr/x86_64-pc-linux-gnu/gcc-bin/4.5.0/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.5.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /var/tmp/paludis/sys-devel-gcc-4.5.0/work/gcc-4.5.0/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.5.0 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.0/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.5.0 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.5.0/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.5.0/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.0/include/g++-v4 --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec --disable-fixed-point --with-ppl --with-cloog --enable-lto --enable-nls --without-included-gettext --with-system-zlib --disable-checking --disable-werror --enable-secureplt --enable-multilib --enable-libmudflap --disable-libssp --enable-libgomp --enable-cld --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.5.0/python --enable-java-awt=gtk --enable-objc-gc --enable-languages=c,c++,java,objc,obj-c++,fortran --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.5.0 p1.0'
Thread model: posix
gcc version 4.5.0 (Gentoo 4.5.0 p1.0) 
gentoo shm # 



Comment 3 fkhp 2010-05-06 00:29:17 UTC
pufreqd 2.4.2 buffer overflown and fails to start at boot(source package from http://www.linux.it/~malattia/wiki/index.php/Cpufreqd)
# export CFLAGS="-mtune=core2 -march=core2 -O2 -msse4.1 -fomit-frame-pointer -pipe"
# export CXXFLAGS="${CFLAGS}"
# export CHOST="x86_64-pc-linux-gnu"
# ./configure --prefix=/usr 
# make
# importare -i -l `pwd` sys-power/cpufreqd 2.4.2

==============error messages:
 * Starting CPU Frequency Daemon ...
*** buffer overflow detected ***: /usr/sbin/cpufreqd terminated
======= Backtrace: =========
/lib/libc.so.6(__fortify_fail+0x37)[0x7f898a91dcc7]
/lib/libc.so.6(+0xf7b20)[0x7f898a91bb20]
/lib/libc.so.6(+0xf819b)[0x7f898a91c19b]
/usr/sbin/cpufreqd(main+0x7fe)[0x403d7e]
/lib/libc.so.6(__libc_start_main+0xfd)[0x7f898a842b6d]
/usr/sbin/cpufreqd[0x402ec9]
======= Memory map: ========
00400000-0040b000 r-xp 00000000 08:03 806861                             /usr/sbin/cpufreqd
0060b000-0060c000 r--p 0000b000 08:03 806861                             /usr/sbin/cpufreqd
0060c000-0060d000 rw-p 0000c000 08:03 806861                             /usr/sbin/cpufreqd
0060d000-0062e000 rw-p 00000000 00:00 0                                  [heap]
7f898a60e000-7f898a623000 r-xp 00000000 08:03 665060                     /lib64/libgcc_s.so.1
7f898a623000-7f898a822000 ---p 00015000 08:03 665060                     /lib64/libgcc_s.so.1
7f898a822000-7f898a823000 r--p 00014000 08:03 665060                     /lib64/libgcc_s.so.1
7f898a823000-7f898a824000 rw-p 00015000 08:03 665060                     /lib64/libgcc_s.so.1
7f898a824000-7f898a990000 r-xp 00000000 08:03 904813                     /lib64/libc-2.11.1.so
7f898a990000-7f898ab8f000 ---p 0016c000 08:03 904813                     /lib64/libc-2.11.1.so
7f898ab8f000-7f898ab93000 r--p 0016b000 08:03 904813                     /lib64/libc-2.11.1.so
7f898ab93000-7f898ab94000 rw-p 0016f000 08:03 904813                     /lib64/libc-2.11.1.so
7f898ab94000-7f898ab9a000 rw-p 00000000 00:00 0 
7f898ab9a000-7f898ab9f000 r-xp 00000000 08:03 673524                     /usr/lib64/libcpufreq.so.0.0.0
7f898ab9f000-7f898ad9e000 ---p 00005000 08:03 673524                     /usr/lib64/libcpufreq.so.0.0.0
7f898ad9e000-7f898ad9f000 r--p 00004000 08:03 673524                     /usr/lib64/libcpufreq.so.0.0.0
7f898ad9f000-7f898ada0000 rw-p 00005000 08:03 673524                     /usr/lib64/libcpufreq.so.0.0.0
7f898ada0000-7f898ada2000 r-xp 00000000 08:03 904485                     /lib64/libdl-2.11.1.so
7f898ada2000-7f898afa2000 ---p 00002000 08:03 904485                     /lib64/libdl-2.11.1.so
7f898afa2000-7f898afa3000 r--p 00002000 08:03 904485                     /lib64/libdl-2.11.1.so
7f898afa3000-7f898afa4000 rw-p 00003000 08:03 904485                     /lib64/libdl-2.11.1.so
7f898afa4000-7f898afc4000 r-xp 00000000 08:03 904812                     /lib64/ld-2.11.1.so
7f898b192000-7f898b195000 rw-p 00000000 00:00 0 
7f898b1c2000-7f898b1c3000 rw-p 00000000 00:00 0 
7f898b1c3000-7f898b1c4000 r--p 0001f000 08:03 904812                     /lib64/ld-2.11.1.so
7f898b1c4000-7f898b1c5000 rw-p 00020000 08:03 904812                     /lib64/ld-2.11.1.so
7f898b1c5000-7f898b1c6000 rw-p 00000000 00:00 0 
7fff158c4000-7fff158d9000 rw-p 00000000 00:00 0                          [stack]
7fff159ff000-7fff15a00000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
 * start-stop-daemon: failed to start `/usr/sbin/cpufreqd'
 [ !! ]
 * ERROR: cpufreqd failed to start
Comment 4 Perttu Luukko 2010-05-29 17:34:02 UTC
I can confirm this with gcc-4.5.0 and cpufreqd-2.3.4-r2 and 2.4.2

# emerge --info

Portage 2.2_rc67 (default/linux/x86/10.0/desktop, gcc-4.5.0, glibc-2.10.1-r0, 2.6.32.11 i686)
=================================================================
System uname: Linux-2.6.32.11-i686-Intel-R-_Atom-TM-_CPU_N270_@_1.60GHz-with-gentoo-2.0.1
Timestamp of tree: Sat, 29 May 2010 06:15:01 +0000
distcc 3.1 i686-pc-linux-gnu [disabled]
app-shells/bash:     4.0_p24
dev-java/java-config: 2.1.7
dev-lang/python:     2.6.5-r1
dev-util/cmake:      2.6.3
sys-apps/baselayout: 2.0.1
sys-apps/openrc:     0.6.1-r1
sys-apps/sandbox:    2.2
sys-devel/autoconf:  2.13, 2.63-r1
sys-devel/automake:  1.9.6-r2, 1.10.2, 1.11
sys-devel/binutils:  2.19.1-r1
sys-devel/gcc:       4.4.1, 4.5.0
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6b
virtual/os-headers:  2.6.30
ACCEPT_KEYWORDS="x86 ~x86"
ACCEPT_LICENSE="* -@EULA"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=atom -O2 -mssse3 -mfpmath=sse -fexcess-precision=fast -fomit-frame-pointer -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /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=atom -O2 -mssse3 -mfpmath=sse -fexcess-precision=fast -fomit-frame-pointer -pipe"
DISTDIR="/var/tmp/distfiles"
EMERGE_DEFAULT_OPTS="--keep-going"
FEATURES="assume-digests distlocks fixpackages gpg news parallel-fetch preserve-libs protect-owned sandbox sfperms strict suidctl unmerge-logs unmerge-orphans userfetch usersync"
GENTOO_MIRRORS="http://trumpetti.atm.tut.fi/gentoo/ http://gentoo.osuosl.org/"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en"
MAKEOPTS="-j2"
PKGDIR="/var/tmp/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/var/lib/layman/finnish /usr/local/portage/local /usr/local/portage/nuteater"
SYNC="rsync://rsync.fi.gentoo.org/gentoo-portage"
USE="X a52 aac acl acpi alsa ares avahi bash-completion berkdb bluetooth bonjour branding bzip2 cairo caps cdr cli consolekit cracklib crypt cxx dbus divx djvu dri dts dvd dvdr dvi emboss enchant encode exif fam ffmpeg fftw firefox flac fontconfig gdbm gif glitz gmp gpg gpgme gpm graphite gsl hal hdf5 ical iconv imagemagick imaging imap ipv6 ipython joystick jpeg kpathsea laptop latex lcms libnl libnotify lto lua lzma lzo mad matroska mbox mdnsresponder-compat mikmod mmx mng modplug modules mp3 mp4 mpeg mudflap ncurses nls nptl nptlonly nsplugin ntp ogg opengl openmp pam pango pcre pdf perl png policykit pop ppds pppd pth python qt3support quicktime readline reflection sdl session smime smp socks5 speex spell spl sse sse2 sse3 ssl ssse3 startup-notification subversion svg sysfs syslog t1lib tcpd theora threads tiff tordns truetype unicode usb v4l2 vim-pager vim-syntax vorbis wifi wmp x264 x86 xcb xft xml xorg xulrunner xv xvid xvmc zeroconf zlib" ALSA_CARDS="hda-intel" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="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 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" CAMERAS="canon ptp2" ELIBC="glibc" INPUT_DEVICES="evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="intel" 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, FFLAGS, INSTALL_MASK, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 5 Perttu Luukko 2010-06-07 20:21:53 UTC
I have done some testing and at least on my setup and cpufreqd-2.4.2 substituting -O0 for -O2 in my CFLAGS makes the problem go away. Just -O1 won't work. On the other hand just building with CFLAGS="-O2" LDFLAGS="" (and same again with -O1) makes cpufreqd also die at startup. 

Also, starting cpufreqd without the -f option works, but when specifying the config file (as done in /etc/init.d/cpufreqd) cpufreqd dies. It does not seem to matter what file is specified as the config file.

I guess next is pinpointing whether this is a bug in cpufreqd or gcc or both or what.

Here is the gdb backtrace:
(gdb) bt
#0  0xffffe424 in __kernel_vsyscall ()
#1  0xb7ea0980 in raise () from /lib/libc.so.6
#2  0xb7ea21c8 in abort () from /lib/libc.so.6
#3  0xb7edc8ad in ?? () from /lib/libc.so.6
#4  0xb7f5e548 in __fortify_fail () from /lib/libc.so.6
#5  0xb7f5c590 in __chk_fail () from /lib/libc.so.6
#6  0xb7f5cd18 in __realpath_chk () from /lib/libc.so.6
#7  0x0804b004 in realpath (argc=3, argv=0xbfffee84) at /usr/include/bits/stdlib.h:44
#8  read_args (argc=3, argv=0xbfffee84) at main.c:316
#9  main (argc=3, argv=0xbfffee84) at main.c:682

The actual source of the error seems to be at main.c:316

if (realpath(optarg, configuration->config_file) == NULL) {

Another bug 299385 looks very similar and there it is stated at #1:
(buffer is the second argument of realpath).

"""
On systems which define `PATH_MAX' ... the buffer must be large enough for a
pathname of this size. 

Since HAL_PATH_MAX=1024 is smaller then PATH_MAX=4096 this causes this abort.
hal should be fixed here.
"""

On the other hand if this is really the problem this should also affect earlier versions of gcc (from 4.3 onwards). Somehow it has to be related though since the error, the dependence on -O and the function producing it are the same.

I'll have a look at this some more later. I'll appreciate if someone wiser took a look at this problem.
Comment 6 Perttu Luukko 2010-06-09 20:03:40 UTC
Created attachment 234765 [details, diff]
Patch to increase path buffer size to PATH_MAX
Comment 7 Perttu Luukko 2010-06-09 20:04:05 UTC
I tried increasing the size of the path buffer and it seems to have
fixed this problem. The size is set at cpufreqd.h to 512.
man 3 realpath tells me that realpath wants a buffer of
size PATH_MAX, so I modified cpufreqd.h to include limits.h
if it is present and use PATH_MAX. I am not an expert on portability
so please check my method but this patch works for me.

Original reporter: please reopen this bug, as we have more
info now.
Comment 8 fkhp 2010-06-10 03:04:39 UTC
the patch works well. thank you very much.


(In reply to comment #6)
> Created an attachment (id=234765) [details]
> Patch to increase path buffer size to PATH_MAX
> 
Comment 9 Perttu Luukko 2010-06-10 14:35:17 UTC
(In reply to comment #8)
> the patch works well. thank you very much.

That is good to hear :)

fkhp: Please reopen this bug so that somebody notices it.
Comment 10 fkhp 2010-06-10 15:33:37 UTC
reopened

> fkhp: Please reopen this bug so that somebody notices it.
> 

Comment 11 fkhp 2010-06-10 15:36:01 UTC
this patch should go upstream

Comment 12 Michael Weber (RETIRED) gentoo-dev 2010-06-11 14:35:56 UTC
Please file an upstream bug and leave a reference in the URL field (and vice versa on the upstream bug).
Comment 13 Perttu Luukko 2010-06-12 07:46:27 UTC
An upstream bug was already filed by the original reporter in 2010-05-06
with a link pointing to this bug.
So far there has been no action upstream.

The address is http://sourceforge.net/tracker/?func=detail&aid=2997375&group_id=58904&atid=489239
Unfortunately I don't have the power to put it into the URL field.
Comment 14 fkhp 2010-06-13 22:58:22 UTC
(In reply to comment #12)
> Please file an upstream bug and leave a reference in the URL field (and vice
> versa on the upstream bug).
> 

On Sat, Jun 12, 2010 at 08:29:43AM +0800, fkhp wrote: > hi,malattia there's a patch for cpufreqd so that gcc4.5 could used to > compile a working > cpufreqd.http://bugs.gentoo.org/show_bug.cgi?id=318287	 > thank you very much! thanks, I applied the patch to my tree. It will be in the next release. -- mattia :wq!
Comment 15 fkhp 2010-06-13 23:31:22 UTC
Perttu Luukko, your patch has gone upstream, thank you very much!
Comment 16 vp 2010-09-24 16:04:29 UTC
this is still an issue. maybe this patch should also be merged in a 2.4.2-r1 kind of thing?
Comment 17 Sven Eden 2010-12-14 11:07:08 UTC
Created attachment 257121 [details]
Updated ebuild utilizing the posted patch

As I need cpufreqd I tried out the posted patch and it works for me. As there is no cpufreqd-2.4.2-r1.ebuild, I post mine here. (Really no rocket-science, just one epatch-line. ;))
Comment 18 Jochen Schlick 2010-12-17 19:58:08 UTC
the specified ebuild fails - when the nvidia use flag is active!
(the path-max-epatch line must be executed before the nvidia-epatch line)
Comment 19 rafnov 2011-01-28 06:54:47 UTC
Confirmed here.

~ # /etc/init.d/cpufreqd start
cpufreqd                  | * Starting CPU Frequency Daemon ...
cpufreqd                  |*** buffer overflow detected ***: /usr/sbin/cpufreqd terminated
cpufreqd                  |======= Backtrace: =========
cpufreqd                  |/lib/libc.so.6(__fortify_fail+0x50)[0xb775d640]
cpufreqd                  |/lib/libc.so.6(+0xe35ca)[0xb775b5ca]
cpufreqd                  |/lib/libc.so.6(+0xe3d38)[0xb775bd38]
cpufreqd                  |/usr/sbin/cpufreqd(main+0x844)[0x804b324]
cpufreqd                  |/lib/libc.so.6(__libc_start_main+0xe6)[0xb768ecc6]
cpufreqd                  |/usr/sbin/cpufreqd[0x804a441]
cpufreqd                  |======= Memory map: ========
cpufreqd                  |08048000-08052000 r-xp 00000000 08:01 131560     /usr/sbin/cpufreqd
cpufreqd                  |08052000-08053000 r--p 00009000 08:01 131560     /usr/sbin/cpufreqd
cpufreqd                  |08053000-08054000 rw-p 0000a000 08:01 131560     /usr/sbin/cpufreqd
cpufreqd                  |0958b000-095ac000 rw-p 00000000 00:00 0          [heap]
cpufreqd                  |b765b000-b7674000 r-xp 00000000 08:01 269278     /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/libgcc_s.so.1
cpufreqd                  |b7674000-b7675000 r--p 00018000 08:01 269278     /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/libgcc_s.so.1
cpufreqd                  |b7675000-b7676000 rw-p 00019000 08:01 269278     /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/libgcc_s.so.1
cpufreqd                  |b7676000-b7678000 rw-p 00000000 00:00 0
cpufreqd                  |b7678000-b77d0000 r-xp 00000000 08:01 74419      /lib/libc-2.12.2.so
cpufreqd                  |b77d0000-b77d1000 ---p 00158000 08:01 74419      /lib/libc-2.12.2.so
cpufreqd                  |b77d1000-b77d3000 r--p 00158000 08:01 74419      /lib/libc-2.12.2.so
cpufreqd                  |b77d3000-b77d4000 rw-p 0015a000 08:01 74419      /lib/libc-2.12.2.so
cpufreqd                  |b77d4000-b77d7000 rw-p 00000000 00:00 0
cpufreqd                  |b77d7000-b77db000 r-xp 00000000 08:01 267470     /usr/lib/libcpufreq.so.0.0.0
cpufreqd                  |b77db000-b77dc000 r--p 00003000 08:01 267470     /usr/lib/libcpufreq.so.0.0.0
cpufreqd                  |b77dc000-b77dd000 rw-p 00004000 08:01 267470     /usr/lib/libcpufreq.so.0.0.0
cpufreqd                  |b77dd000-b77df000 r-xp 00000000 08:01 74404      /lib/libdl-2.12.2.so
cpufreqd                  |b77df000-b77e0000 r--p 00001000 08:01 74404      /lib/libdl-2.12.2.so
cpufreqd                  |b77e0000-b77e1000 rw-p 00002000 08:01 74404      /lib/libdl-2.12.2.so
cpufreqd                  |b77f2000-b77f3000 rw-p 00000000 00:00 0
cpufreqd                  |b77f3000-b77f4000 r-xp 00000000 00:00 0          [vdso]
cpufreqd                  |b77f4000-b7810000 r-xp 00000000 08:01 74483      /lib/ld-2.12.2.so
cpufreqd                  |b7810000-b7811000 r--p 0001b000 08:01 74483      /lib/ld-2.12.2.so
cpufreqd                  |b7811000-b7812000 rw-p 0001c000 08:01 74483      /lib/ld-2.12.2.so
cpufreqd                  |bfa30000-bfa51000 rw-p 00000000 00:00 0          [stack]
cpufreqd                  | * start-stop-daemon: failed to start `/usr/sbin/cpufreqd'                                    [ !! ]qd                  |
cpufreqd                  | * ERROR: cpufreqd failed to start
Comment 20 rafnov 2011-01-28 06:57:40 UTC
Created attachment 260892 [details]
Attachment for commend #19
Comment 21 Juergen Rose 2011-04-04 11:04:03 UTC
I just hit the same issue. I have cpufreqd-2.4.2 compiled with  nvidia USE flag and cpufreqd crashes with:
oot@impala:/root(11)# /etc/init.d/cpufreqd -v start
 * Starting CPU Frequency Daemon ...
 * Detaching to start `/usr/sbin/cpufreqd' ...
*** buffer overflow detected ***: /usr/sbin/cpufreqd terminated
======= Backtrace: =========
/lib64/libc.so.6(__fortify_fail+0x37)[0x7f9fc3362f57]
/lib64/libc.so.6(+0xebda0)[0x7f9fc3360da0]
/lib64/libc.so.6(+0xec42b)[0x7f9fc336142b]
/usr/sbin/cpufreqd(main+0x7c9)[0x403d89]
/lib64/libc.so.6(__libc_start_main+0xfd)[0x7f9fc3293f0d]
/usr/sbin/cpufreqd[0x402ec9]
======= Memory map: ========
...


How is the state of the solution of the bug? The last comment is more than two month old.
Comment 22 Juergen Rose 2011-04-04 12:42:19 UTC
Now I disabled the nvidia USE flag for cpufreqd, but I still get the same error:

root@impala:/root(4)# emerge -pvq cpufreqd
[ebuild   R   ] sys-power/cpufreqd-2.4.2  USE="acpi lm_sensors -apm -nforce2 -nvidia -pmu" 

root@impala:/root(5)# /etc/init.d/cpufreqd -v start
 * Starting CPU Frequency Daemon ...
 * Detaching to start `/usr/sbin/cpufreqd' ...
*** buffer overflow detected ***: /usr/sbin/cpufreqd terminated
======= Backtrace: =========
/lib64/libc.so.6(__fortify_fail+0x37)[0x7f39c22f4f57]
/lib64/libc.so.6(+0xebda0)[0x7f39c22f2da0]
/lib64/libc.so.6(+0xec42b)[0x7f39c22f342b]
/usr/sbin/cpufreqd(main+0x7c9)[0x403d89]
/lib64/libc.so.6(__libc_start_main+0xfd)[0x7f39c2225f0d]
/usr/sbin/cpufreqd[0x402ec9]
======= Memory map: ========
00400000-0040b000 r-xp 00000000 fd:00 4071495                            /usr/sbin/cpufreqd
...
 *   start-stop-daemon: failed to start `/usr/sbin/cpufreqd'                                                     [ !! ]
 * ERROR: cpufreqd failed to start
root@impala:/root(6)# genlop -t sys-power/cpufreqd | tail -n 7

     Mon Apr  4 13:05:45 2011 >>> sys-power/cpufreqd-2.4.2
       merge time: 32 seconds.

     Mon Apr  4 13:43:20 2011 >>> sys-power/cpufreqd-2.4.2
       merge time: 25 seconds.
Comment 23 Jeroen Roovers (RETIRED) gentoo-dev 2011-04-05 14:32:32 UTC
*** Bug 362029 has been marked as a duplicate of this bug. ***
Comment 24 Giorgio Pretto 2011-04-08 14:57:32 UTC
Hi, i'm having the same issue.
my info http://paste.pocoo.org/show/367939/

i tried before even with only the acpi use flag, same result
Comment 25 Perttu Luukko 2011-04-09 07:47:19 UTC
Recent commenters: are you experiencing a different bug, or does the attached patch fix your problems? This bug is already known by cpufreqd upstream, and the attached patch is already incorporated in their git repo. The problem is that upstream has not released a new version that includes this patch. If this bug continues to affect people and upstream still does not release a fixed version I think it would be a good idea for the gentoo maintainer to release 2.4.2-r1 with this patch included. In any case I don't see point in posting new bug reports or confirmations unless you are hitting a different bug.
Comment 26 Giorgio Pretto 2011-04-09 16:41:11 UTC
(In reply to comment #25)
> Recent commenters: are you experiencing a different bug, or does the attached
> patch fix your problems? This bug is already known by cpufreqd upstream, and
> the attached patch is already incorporated in their git repo. The problem is
> that upstream has not released a new version that includes this patch. If this
> bug continues to affect people and upstream still does not release a fixed
> version I think it would be a good idea for the gentoo maintainer to release
> 2.4.2-r1 with this patch included. In any case I don't see point in posting new
> bug reports or confirmations unless you are hitting a different bug.

I think it's the same bug..
since it is not fondamental i'll wait for the patch.
Comment 27 Vladimir Rusinov 2011-04-16 09:51:05 UTC
Please, add ebuild with patch to main tree.
Comment 28 ron widler 2011-05-23 11:57:50 UTC
Created attachment 274391 [details]
fixed ebuild using the max-path.patch

changed the patch order, compiles and runs fine on my ~amd64 system.

(somehow i don't have the option to mark the old ebuild as obsolete, sorry)
Comment 29 rafnov 2011-06-16 12:48:15 UTC
Isn't fixed yet, just tried to /etc/init.d/cpufreqd start, this is the result:

# /etc/init.d/cpufreqd restart 
cpufreqd           | * Caching service dependencies ...                                                      [ ok ]
cpufreqd           | * Starting CPU Frequency Daemon ...
cpufreqd           |*** buffer overflow detected ***: /usr/sbin/cpufreqd terminated
cpufreqd           |======= Backtrace: =========
cpufreqd           |/lib/libc.so.6(__fortify_fail+0x50)[0xb78047c0]
cpufreqd           |/lib/libc.so.6(+0xe374a)[0xb780274a]
cpufreqd           |/lib/libc.so.6(+0xe3eb8)[0xb7802eb8]
cpufreqd           |/usr/sbin/cpufreqd(main+0x84b)[0x804b32b]
cpufreqd           |/lib/libc.so.6(__libc_start_main+0xe6)[0xb7735e16]
cpufreqd           |/usr/sbin/cpufreqd[0x804a441]
cpufreqd           |======= Memory map: ========
cpufreqd           |08048000-08052000 r-xp 00000000 08:02 394361     /usr/sbin/cpufreqd
cpufreqd           |08052000-08053000 r--p 00009000 08:02 394361     /usr/sbin/cpufreqd
cpufreqd           |08053000-08054000 rw-p 0000a000 08:02 394361     /usr/sbin/cpufreqd
cpufreqd           |085c9000-085ea000 rw-p 00000000 00:00 0          [heap]
cpufreqd           |b7702000-b771b000 r-xp 00000000 08:02 544607     /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/libgcc_s.so.1
cpufreqd           |b771b000-b771c000 r--p 00018000 08:02 544607     /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/libgcc_s.so.1
cpufreqd           |b771c000-b771d000 rw-p 00019000 08:02 544607     /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/libgcc_s.so.1
cpufreqd           |b771d000-b771f000 rw-p 00000000 00:00 0 
cpufreqd           |b771f000-b7877000 r-xp 00000000 08:02 440925     /lib/libc-2.13.so
cpufreqd           |b7877000-b7879000 r--p 00158000 08:02 440925     /lib/libc-2.13.so
cpufreqd           |b7879000-b787a000 rw-p 0015a000 08:02 440925     /lib/libc-2.13.so
cpufreqd           |b787a000-b787d000 rw-p 00000000 00:00 0 
cpufreqd           |b787d000-b7881000 r-xp 00000000 08:02 543588     /usr/lib/libcpufreq.so.0.0.0
cpufreqd           |b7881000-b7882000 r--p 00003000 08:02 543588     /usr/lib/libcpufreq.so.0.0.0
cpufreqd           |b7882000-b7883000 rw-p 00004000 08:02 543588     /usr/lib/libcpufreq.so.0.0.0
cpufreqd           |b7883000-b7885000 r-xp 00000000 08:02 440914     /lib/libdl-2.13.so
cpufreqd           |b7885000-b7886000 r--p 00001000 08:02 440914     /lib/libdl-2.13.so
cpufreqd           |b7886000-b7887000 rw-p 00002000 08:02 440914     /lib/libdl-2.13.so
cpufreqd           |b78a1000-b78a2000 rw-p 00000000 00:00 0 
cpufreqd           |b78a2000-b78a3000 r-xp 00000000 00:00 0          [vdso]
cpufreqd           |b78a3000-b78bf000 r-xp 00000000 08:02 441030     /lib/ld-2.13.so
cpufreqd           |b78bf000-b78c0000 r--p 0001b000 08:02 441030     /lib/ld-2.13.so
cpufreqd           |b78c0000-b78c1000 rw-p 0001c000 08:02 441030     /lib/ld-2.13.so
cpufreqd           |bf91e000-bf93f000 rw-p 00000000 00:00 0          [stack]
cpufreqd           | * start-stop-daemon: failed to start `/usr/sbin/cpufreqd'                                     [ !! ]qd           |
cpufreqd           | * ERROR: cpufreqd failed to start
Comment 30 rafnov 2011-06-16 12:48:50 UTC
Created attachment 277235 [details]
emerge --info on x86
Comment 31 Nathan Phillip Brink (binki) (RETIRED) gentoo-dev 2011-10-29 21:44:37 UTC
(In reply to comment #25)
> Recent commenters: are you experiencing a different bug, or does the attached
> patch fix your problems? This bug is already known by cpufreqd upstream, and
> the attached patch is already incorporated in their git repo.

I am unable to verify that upstream even knows that this bug exists because of https://sourceforge.net/tracker/?func=detail&aid=3430207&group_id=58904&atid=489239 and https://sourceforge.net/tracker/?func=detail&aid=3430209&group_id=58904&atid=489239 ;-). Ideally, if upstream has already committed this somewheres we should just `git format-patch' it into gentoo-x86...
Comment 32 Perttu Luukko 2011-10-29 22:02:40 UTC
(In reply to comment #31)
> (In reply to comment #25)
> > Recent commenters: are you experiencing a different bug, or does the attached
> > patch fix your problems? This bug is already known by cpufreqd upstream, and
> > the attached patch is already incorporated in their git repo.
> 
> I am unable to verify that upstream even knows that this bug exists because of
> https://sourceforge.net/tracker/?func=detail&aid=3430207&group_id=58904&atid=489239
> and
> https://sourceforge.net/tracker/?func=detail&aid=3430209&group_id=58904&atid=489239
> ;-). Ideally, if upstream has already committed this somewheres we should just
> `git format-patch' it into gentoo-x86...

Yes, upstream's git repo is gone, but they did manage to merge the patch and actually even tag a 2.4.3 release before disappearing. I think that by now it's safe to assume they are not coming back.

This is a very simple bug with a very simple, known solution (the attached patch). If somebody with the power to do so would just add the patch to the version in portage we could let this bug finally rest in peace.
Comment 33 Nathan Phillip Brink (binki) (RETIRED) gentoo-dev 2011-10-30 04:16:54 UTC
Created attachment 291197 [details, diff]
cpufreqd-2.4.2-PATH_MAX.patch

I cleaned up the existing patch posted here and fixed #include "limits.h" to be #include <limits.h>.

Since upstream purportedly has committed the equivalent of this patch already, it should be fair game to include it. Unfortunately, upstream isn't able/willing to make the git repo available so we can't pull the patch straight out of there until upstream's circumstances change.
Comment 34 Nathan Phillip Brink (binki) (RETIRED) gentoo-dev 2011-10-30 05:00:18 UTC
Committed into cpufreqd-2.4.2-r1.ebuild:

*cpufreqd-2.4.2-r1 (30 Oct 2011)

  30 Oct 2011; Nathan Phillip Brink <binki@gentoo.org>
  +cpufreqd-2.4.2-r1.ebuild, +files/cpufreqd-2.4.2-PATH_MAX.patch:
  Add patch from bug #318287 by Sven Eden <yamakuzure@gmx.net> fixing glibc
  abort() for potential buffer overflow on startup when compiled with gcc-4.5
  and CFLAGS="-O1" and passed the -f flag. OKed by steev_.

Thanks for the bug :-).
Comment 35 Pacho Ramos gentoo-dev 2012-11-18 12:14:30 UTC
*** Bug 398387 has been marked as a duplicate of this bug. ***