Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 346399 - sys-power/cpufreqd-2.4.2 - cpufreqd crashes on kernel 2.6.36
Summary: sys-power/cpufreqd-2.4.2 - cpufreqd crashes on kernel 2.6.36
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: AMD64 Linux
: High major with 3 votes (vote)
Assignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-22 04:02 UTC by Minko Minkov
Modified: 2012-11-19 21:14 UTC (History)
15 users (show)

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


Attachments
cpufreqd-2.4.2-r1.ebuild (cpufreqd-2.4.2-r1.ebuild,2.13 KB, text/plain)
2010-11-22 04:07 UTC, Minko Minkov
Details
fixes battery issues with cpufreqd (cpufreqd_acpi_battery-energy.patch,5.02 KB, patch)
2010-11-22 04:08 UTC, Minko Minkov
Details | Diff
cpufreqd-2.4.2-r1.ebuild fixing USE="nvidia acpi" (cpufreqd-2.4.2-r1.ebuild,2.13 KB, text/plain)
2011-01-04 09:00 UTC, Panard
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Minko Minkov 2010-11-22 04:02:15 UTC
As of kernel 2.6.36 the current_now attribute is removed from ACPI if the battery reports energy levels.

https://patchwork.kernel.org/patch/125081/

cpufreqd is looking for current_now only to determine the rate at which the battery is drawn. It should be using the power_now attribute for such batteries.

Reproducible: Always

Steps to Reproduce:
1.build kernel 2.6.36
2.emerge cpufreqd 2.4.2
3.as root run cpufreqd -D

Actual Results:  
segmentation fault

Expected Results:  
daemon should work fine

I am attaching an r1 ebuild to patch the issue. Works for me and should be compatible with previous versions of the kernel

Attaching also a patch that fixes the issue in cpufreqd
Comment 1 Minko Minkov 2010-11-22 04:07:38 UTC
Created attachment 255081 [details]
cpufreqd-2.4.2-r1.ebuild

same as the 2.4.2 ebuild
+ apply acpi battery patch
+ add debug use flag
Comment 2 Minko Minkov 2010-11-22 04:08:33 UTC
Created attachment 255083 [details, diff]
fixes battery issues with cpufreqd
Comment 3 Stefan G. Weichinger 2010-12-09 08:09:49 UTC
thanks for that, will asap try that.
Seems to rely also to my gnome-icon, it shows wrong values as well (is this the gnome-power-manager, I have german set as language here).
Comment 4 Stefan G. Weichinger 2010-12-09 08:20:06 UTC
Merged your ebuild right now, but I get this:

# /etc/init.d/cpufreqd restart
 * Starting CPU Frequency Daemon ...
*** buffer overflow detected ***: /usr/sbin/cpufreqd terminated
======= Backtrace: =========
/lib/libc.so.6(__fortify_fail+0x37)[0x7f7f746eecf7]
/lib/libc.so.6(+0xe5b40)[0x7f7f746ecb40]
/lib/libc.so.6(+0xe61cb)[0x7f7f746ed1cb]
/usr/sbin/cpufreqd(main+0x7be)[0x403cde]
/lib/libc.so.6(__libc_start_main+0xfd)[0x7f7f74625d2d]
/usr/sbin/cpufreqd[0x402ec9]
======= Memory map: ========
00400000-0040b000 r-xp 00000000 fe:02 49346                              /usr/sbin/cpufreqd
0060a000-0060b000 r--p 0000a000 fe:02 49346                              /usr/sbin/cpufreqd
0060b000-0060c000 rw-p 0000b000 fe:02 49346                              /usr/sbin/cpufreqd
0060c000-0062d000 rw-p 00000000 00:00 0                                  [heap]
7f7f743f1000-7f7f74406000 r-xp 00000000 fe:02 131576                     /lib64/libgcc_s.so.1
7f7f74406000-7f7f74605000 ---p 00015000 fe:02 131576                     /lib64/libgcc_s.so.1
7f7f74605000-7f7f74606000 r--p 00014000 fe:02 131576                     /lib64/libgcc_s.so.1
7f7f74606000-7f7f74607000 rw-p 00015000 fe:02 131576                     /lib64/libgcc_s.so.1
7f7f74607000-7f7f74764000 r-xp 00000000 fe:02 69594                      /lib64/libc-2.12.1.so
7f7f74764000-7f7f74963000 ---p 0015d000 fe:02 69594                      /lib64/libc-2.12.1.so
7f7f74963000-7f7f74967000 r--p 0015c000 fe:02 69594                      /lib64/libc-2.12.1.so
7f7f74967000-7f7f74968000 rw-p 00160000 fe:02 69594                      /lib64/libc-2.12.1.so
7f7f74968000-7f7f7496d000 rw-p 00000000 00:00 0 
7f7f7496d000-7f7f74972000 r-xp 00000000 fe:02 623133                     /usr/lib64/libcpufreq.so.0.0.0
7f7f74972000-7f7f74b71000 ---p 00005000 fe:02 623133                     /usr/lib64/libcpufreq.so.0.0.0
7f7f74b71000-7f7f74b72000 r--p 00004000 fe:02 623133                     /usr/lib64/libcpufreq.so.0.0.0
7f7f74b72000-7f7f74b73000 rw-p 00005000 fe:02 623133                     /usr/lib64/libcpufreq.so.0.0.0
7f7f74b73000-7f7f74b75000 r-xp 00000000 fe:02 69613                      /lib64/libdl-2.12.1.so
7f7f74b75000-7f7f74d75000 ---p 00002000 fe:02 69613                      /lib64/libdl-2.12.1.so
7f7f74d75000-7f7f74d76000 r--p 00002000 fe:02 69613                      /lib64/libdl-2.12.1.so
7f7f74d76000-7f7f74d77000 rw-p 00003000 fe:02 69613                      /lib64/libdl-2.12.1.so
7f7f74d77000-7f7f74d97000 r-xp 00000000 fe:02 69244                      /lib64/ld-2.12.1.so
7f7f74f69000-7f7f74f6c000 rw-p 00000000 00:00 0 
7f7f74f95000-7f7f74f96000 rw-p 00000000 00:00 0 
7f7f74f96000-7f7f74f97000 r--p 0001f000 fe:02 69244                      /lib64/ld-2.12.1.so
7f7f74f97000-7f7f74f98000 rw-p 00020000 fe:02 69244                      /lib64/ld-2.12.1.so
7f7f74f98000-7f7f74f99000 rw-p 00000000 00:00 0 
7fff4957e000-7fff4959f000 rw-p 00000000 00:00 0                          [stack]
7fff495ff000-7fff49600000 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


# emerge --info
Portage 2.1.9.25 (default/linux/amd64/10.0/desktop/gnome, gcc-4.5.1, glibc-2.12.1-r3, 2.6.36-tuxonice-r2 x86_64)
=================================================================
System uname: Linux-2.6.36-tuxonice-r2-x86_64-Intel-R-_Core-TM-2_Duo_CPU_T8100_@_2.10GHz-with-gentoo-2.0.1
Timestamp of tree: Thu, 09 Dec 2010 07:30:23 +0000
distcc 3.1 x86_64-pc-linux-gnu [disabled]
ccache version 3.1.3 [disabled]
app-shells/bash:     4.1_p9
dev-java/java-config: 2.1.11-r2
dev-lang/python:     2.5.4-r4, 2.6.6-r1, 3.1.2-r4
dev-util/ccache:     3.1.3
dev-util/cmake:      2.8.1-r2
sys-apps/baselayout: 2.0.1-r1
sys-apps/openrc:     0.6.3
sys-apps/sandbox:    2.4
sys-devel/autoconf:  2.13, 2.68
sys-devel/automake:  1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       4.4.5, 4.5.1-r1
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.4-r1
sys-devel/make:      3.82
virtual/os-headers:  2.6.36.1 (sys-kernel/linux-headers)
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=core2 -pipe -fomit-frame-pointer"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config"
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/splash /etc/terminfo"
CXXFLAGS="-O2 -march=core2 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests binpkg-logs distlocks fixlafiles fixpackages news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="de_AT.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="de en"
MAKEOPTS="-j5"
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="/var/lib/layman/wschlich-testing /var/lib/layman/vmware /var/lib/layman/mt-mythtv /usr/local/portage"
SYNC="rsync://172.32.99.6/gentoo-portage"
USE="X a52 aac aalib acl acpi alsa amd64 avahi avi berkdb bitmap-fonts bluetooth branding bzip2 cairo cdparanoia cdr cli consolekit cracklib crypt cups cxx dbus divx4linux dri dts dv dvd dvdr dvdread eds emboss encode evo exif fam ffmpeg firefox flac fortran gdbm gdu gif gnome gnome-keyring gpm gstreamer gtk hal hdaps howl iconv ipv6 jpeg lame lcms libnotify live mad mikmod mjpeg mmx mng modules mp3 mp4 mpeg mudflap multilib nautilus ncurses nls nptlonly ogg opengl openmp pam pango pcre pda pdf perl png policykit ppds pppd python qt3support quicktime readline sdl session spell sse sse2 ssl startup-notification svg sysfs tcpd tetex tiff truetype truetype-fonts type1-fonts unicode usb vcd vorbis x264 xcb xml xmms xorg xulrunner xv xvid zlib" ALSA_CARDS="hda-intel intel8x0 intel8x0m" 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 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" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap 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 ubx" INPUT_DEVICES="evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="de en" PHP_TARGETS="php5-2" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="nvidia" 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, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 5 Minko Minkov 2010-12-11 06:24:12 UTC
Does it work fine without the patch? Looking at the call stack it doesn't look like this is affected by what I changed. The changes I made are in the acpi module and I don't see it referenced. I'll be able to tell more if you compile with symbols and print the call stack.

You can use the debug flag I added and emerge with FEATURES="nostrip"
Comment 6 Stefan G. Weichinger 2010-12-11 17:16:43 UTC
(In reply to comment #5)
> Does it work fine without the patch? Looking at the call stack it doesn't look
> like this is affected by what I changed. The changes I made are in the acpi
> module and I don't see it referenced. I'll be able to tell more if you compile
> with symbols and print the call stack.
> 
> You can use the debug flag I added and emerge with FEATURES="nostrip"

Did that right now and it works now OK ... hmm, maybe my former merge wasn't OK somehow. Thanks anyway.

Comment 7 Joel 2010-12-23 17:03:41 UTC
This patch works for me.  Thanks.
Comment 8 Panard 2011-01-04 08:59:18 UTC
Warning, the patch application conflicts when USE=nvidia (because the nvidia switch does a "cd" somewhere else). I suggest to move up the application of the acpi patch.

Moreover, as in Comment #4 and #6, it seems that cpufreqd keeps crashing as long as "debug" is not set...
Comment 9 Panard 2011-01-04 09:00:33 UTC
Created attachment 258802 [details]
cpufreqd-2.4.2-r1.ebuild fixing USE="nvidia acpi"
Comment 10 Minko Minkov 2011-01-06 04:35:16 UTC
(In reply to comment #8)

> Moreover, as in Comment #4 and #6, it seems that cpufreqd keeps crashing as
> long as "debug" is not set...
> 

I checked again and it turned out I was running debug build as well. I didn't dig enough but it doesn't look like the crash is due to the change in the patch.

If I run cpufreqd -D from the command line the daemon works fine.

If I run it as the init script cpufreqd -D -f /etc/cpufreqd.conf I get the crash. It looks like my change exposed an already existing bug in the application.

There are two ways to work around this.

1. Edit the init script and remove the -f ${CONFIGFILE} from the start-stop-daemon call
2. Emerge cpufreqd without optimizations. (CFLAGS="-O0 ...")

I'll see if I can figure out why after my change the app crashes. Anyway this issue needs to be reported upstream. In addition to this, the battery module has issue with the code:

If the call to acpi_battery_init fails on line 307 in cpufreqd_acpi_battery.c execution will continue and on line 315 it will attempt to read an attribute value that has been already closed, which results in the crash that I originally hit.
Comment 11 David Hallas 2011-02-17 18:45:28 UTC
The patch works flawlessly for me.
Comment 12 niko2gare 2011-03-06 10:07:08 UTC
the patch works for me too.
Comment 13 David Hallas 2011-03-11 12:45:07 UTC
(In reply to comment #12)
> the patch works for me too.

I can see you have created an upstream bug report http://sourceforge.net/tracker/?func=detail&aid=3172707&group_id=58904&atid=489239 and it seems like this will be fixed in the next version. All we can do now is wait :)
Comment 14 Mishael Sibiryakov 2011-04-02 12:34:00 UTC
Ppatch works for me on 2.6.38
Comment 15 Tolga Dalman 2011-06-16 06:32:17 UTC
broken for me as well.

Is there any chance to get this fixed/patched soon ? Otherwise cpufreqd could be masked as well, until the issues are resolved (IMHO).
Comment 16 Yang Yang 2011-07-18 04:42:11 UTC
Will the patches be updated to the official portage source?
Every time I use emerge -avuDN world to update my laptop,
I am asked to downgrade to the crash version.
Thank you!
Comment 17 Eric Gisse 2011-08-27 18:12:52 UTC
I just ran into this problem, did a search, and found this. Kinda surprised it has persisted in portage since late 2010 even though there's been a working ebuild since 11-2010. 

This needs to be put into portage proper, or have the whole package masked because it does not function at all at this time.
Comment 18 Alex Barker 2012-08-12 03:13:16 UTC
Another 2+ year old gentoo bug with no prospect of resolution.
Comment 19 Pacho Ramos gentoo-dev 2012-10-28 12:16:30 UTC
(In reply to comment #18)
> Another 2+ year old gentoo bug with no prospect of resolution.

mobile herd is highly needed of help and manpower, if some of you desire to become a dev or being a proxy-maintainer, that would be nice:
http://www.gentoo.org/proj/en/qa/proxy-maintainers/index.xml
Comment 20 Sergey Popov gentoo-dev 2012-11-19 11:02:27 UTC
Try sys-power/cpufreqd-2.4.2-r2, maybe crashes will gone with extra patch, which was added to it
Comment 21 Oz 2012-11-19 12:01:47 UTC
(In reply to comment #20)
> Try sys-power/cpufreqd-2.4.2-r2, maybe crashes will gone with extra patch,
> which was added to it

I can confirm 2.4.2-r2 (kernel 3.5.7) does not crush :)