Bug#509355: cpufreqd: segfault while reading acpi battery info
On Tue, Dec 23, 2008 at 07:57:00PM +0100, Stefan Bühler wrote: The problem is that check_timeout is reset after the first battery got updated, so the values for the second battery are never read. This results in status-value == NULL, and strncmp segfaults. The solution is to update check_timeout after all battery values are updated. excellent, thanks -- mattia :wq! signature.asc Description: Digital signature
Bug#509355: cpufreqd: segfault while reading acpi battery info
The problem is that check_timeout is reset after the first battery got updated, so the values for the second battery are never read. This results in status-value == NULL, and strncmp segfaults. The solution is to update check_timeout after all battery values are updated. kind regards Stefan --- diff -r -u -b cpufreqd-2.3.3/src/cpufreqd_acpi_battery.c cpufreqd-2.3.3.new/src/cpufreqd_acpi_battery.c --- cpufreqd-2.3.3/src/cpufreqd_acpi_battery.c 2008-08-23 05:52:47.0 +0200 +++ cpufreqd-2.3.3.new/src/cpufreqd_acpi_battery.c 2008-12-23 19:39:18.850501003 +0100 @@ -325,7 +325,6 @@ /* if check_timeout is expired */ if (check_timeout = 0) { - check_timeout = acpi_config.battery_update_interval; if (read_battery(info[i]) == 0) n_read++; else @@ -365,6 +364,11 @@ #endif } /* end info loop */ + /* check_timeout is global for all batteries, so update it after all batteries got updated */ + if (check_timeout = 0) { + check_timeout = acpi_config.battery_update_interval; + } + /* calculates medium battery life between all batteries */ if (total_capacity 0) avg_battery_level = 100 * (total_remaining / (double)total_capacity); signature.asc Description: This is a digitally signed message part.
Bug#509355: cpufreqd: segfault while reading acpi battery info
Hello, maybe I can add a bit of information: On Mon, Dec 22, 2008 at 06:54:56AM +0900, Mattia Dongili wrote: On Sun, Dec 21, 2008 at 04:40:28PM +0100, Jonas Zeiger wrote: Package: cpufreqd Version: 2.3.3-3 Severity: grave Justification: renders package unusable I've been trying to run cpufreqd on a Dell Latitude D530 Laptop with a Intel Core2Duo 2.00Ghz CPU, 3GB of DDR2 RAM and two attached battery units using the stock Debian kernel version 2.6.26, but the problem is exactly the same with my custom kernel 2.6.26zlinux (tuned for install on SSD). I have a pretty similar laptop (D530, 2x 2GHz, 2GB RAM, but just one battery). I am running the standard lenny kernel at the moment. I installed cpufreqd to verify this problem, but it does not occur here. So my guess is that it has to do with the second battery... acpi_battery_update : BAT1 - present acpi_battery_update : BAT1 - estimating battery life (timeout: 30.00 - status: (null)) Speicherzugriffsfehler /* german locale, it' a segfault! :( */ ... which seems to get seconded by the status: (null) above (Broken pointer?). To Jonas: What does 'cat /sys/class/power_supply/BAT1/status' print after/before you get this segfault? This is how it looks here: === acpi_battery_update : BAT0 - present acpi_battery_update : BAT0 - estimating battery life (timeout: 28.00 - status: Discharging ) acpi_battery_update : BAT0 - remaining capacity: 5199147 acpi_battery_update : battery life for BAT0 is 112% acpi_battery_update : average battery life 112% === Kind regards, Wolfram -- Dipl.-Ing. Wolfram Sang | http://www.pengutronix.de Pengutronix - Linux Solutions for Science and Industry signature.asc Description: Digital signature
Bug#509355: cpufreqd: segfault while reading acpi battery info
Package: cpufreqd Version: 2.3.3-3 Severity: grave Justification: renders package unusable I've been trying to run cpufreqd on a Dell Latitude D530 Laptop with a Intel Core2Duo 2.00Ghz CPU, 3GB of DDR2 RAM and two attached battery units using the stock Debian kernel version 2.6.26, but the problem is exactly the same with my custom kernel 2.6.26zlinux (tuned for install on SSD). Cpufreqd keeps segfaulting when starting up the system: $ dmesg -snip- cpufreqd[5313]: segfault at 0 ip 7fb47e6941b7 sp 7fff88500a30 error 4 in cpufreqd_acpi.so[7fb47e691000+6000] -snap- Running cpufreqd in foreground (cpufreqd -D -V7): $ cpufreqd -D -V7 get_kversion : read kernel version 2.6.26zlinux. get_kversion : kernel version is 2.6. get_cpu_num : found 2 CPUs main : Limits for cpu0: MIN=80 - MAX=2001000 main : Limits for cpu1: MIN=80 - MAX=2001000 init_configuration : reading configuration file /usr/local/etc/cpufreqd.conf discover_plugins : found plugin: apm discover_plugins : found plugin: sensors discover_plugins : found plugin: nforce2 discover_plugins : found plugin: pmu discover_plugins : found plugin: programs discover_plugins : found plugin: tau discover_plugins : found plugin: acpi discover_plugins : found plugin: exec discover_plugins : found plugin: cpu discover_plugins : found plugin: governor_parameters load_plugin : Loading /usr/local/lib/cpufreqd_apm.so for plugin apm. get_cpufreqd_object : Getting plugin object for apm. initialize_plugin: Initializing plugin apm-apm_plugin. apm_init : /proc/apm: No such file or directory load_plugin_list : plugin failed to load: apm load_plugin_list : discarded plugin apm load_plugin : Loading /usr/local/lib/cpufreqd_sensors.so for plugin sensors. get_cpufreqd_object : Getting plugin object for sensors. initialize_plugin: Initializing plugin sensors-sensors_plugin. load_plugin_list : plugin loaded: sensors_plugin load_plugin : Loading /usr/local/lib/cpufreqd_nforce2.so for plugin nforce2. get_cpufreqd_object : Getting plugin object for nforce2. initialize_plugin: Initializing plugin nforce2-nforce2_atxp1. load_plugin_list : plugin loaded: nforce2_atxp1 load_plugin : Loading /usr/local/lib/cpufreqd_pmu.so for plugin pmu. get_cpufreqd_object : Getting plugin object for pmu. initialize_plugin: Initializing plugin pmu-pmu_plugin. pmu_init : /proc/pmu/info: No such file or directory load_plugin_list : plugin failed to load: pmu load_plugin_list : discarded plugin pmu load_plugin : Loading /usr/local/lib/cpufreqd_programs.so for plugin programs. get_cpufreqd_object : Getting plugin object for programs. initialize_plugin: Initializing plugin programs-programs_plugin. load_plugin_list : plugin loaded: programs_plugin load_plugin : Loading /usr/local/lib/cpufreqd_tau.so for plugin tau. get_cpufreqd_object : Getting plugin object for tau. initialize_plugin: Initializing plugin tau-tau_plugin. tau_init : /proc/cpuinfo file found load_plugin_list : plugin loaded: tau_plugin load_plugin : Loading /usr/local/lib/cpufreqd_acpi.so for plugin acpi. get_cpufreqd_object : Getting plugin object for acpi. initialize_plugin: Initializing plugin acpi-acpi. load_plugin_list : plugin loaded: acpi load_plugin : Loading /usr/local/lib/cpufreqd_exec.so for plugin exec. get_cpufreqd_object : Getting plugin object for exec. initialize_plugin: Initializing plugin exec-exec. load_plugin_list : plugin loaded: exec load_plugin : Loading /usr/local/lib/cpufreqd_cpu.so for plugin cpu. get_cpufreqd_object : Getting plugin object for cpu. initialize_plugin: Initializing plugin cpu-cpu_plugin. cpufreqd_cpu_init: called load_plugin_list : plugin loaded: cpu_plugin load_plugin : Loading /usr/local/lib/cpufreqd_governor_parameters.so for plugin governor_parameters. get_cpufreqd_object : Getting plugin object for governor_parameters. initialize_plugin: Initializing plugin governor_parameters-governor_parameters. gov_parameter_init : called gov_parameter_init : sysfs mount path = /sys gov_parameter_init : sysfs path cpu device = /sys/devices/system/cpu load_plugin_list : plugin loaded: governor_parameters parse_config_general : poll_interval is 2.0 seconds parse_config_general : skipping verbosity, overridden in the command line. sensors_post_conf: using /etc/sensors.conf nforce2_post_conf: Unconfigured, exiting. plugins_post_conf: Unable to configure plugin nforce2_atxp1,
Bug#509355: cpufreqd: segfault while reading acpi battery info
On Sun, Dec 21, 2008 at 04:40:28PM +0100, Jonas Zeiger wrote: Package: cpufreqd Version: 2.3.3-3 Severity: grave Justification: renders package unusable I've been trying to run cpufreqd on a Dell Latitude D530 Laptop with a Intel Core2Duo 2.00Ghz CPU, 3GB of DDR2 RAM and two attached battery units using the stock Debian kernel version 2.6.26, but the problem is exactly the same with my custom kernel 2.6.26zlinux (tuned for install on SSD). Cpufreqd keeps segfaulting when starting up the system: ... acpi_battery_init: found 2 Batteries acpi_battery_update : BAT0 - present read_battery : BAT0 - reading battery levels read_battery : BAT0 - remaining capacity: 520 acpi_battery_update : battery life for BAT0 is 109% acpi_battery_update : BAT1 - present acpi_battery_update : BAT1 - estimating battery life (timeout: 30.00 - status: (null)) Speicherzugriffsfehler /* german locale, it' a segfault! :( */ can you run cpufreqd in a gdb session (make sure to start it with -D so that is doesn't deamonize) and get a stack trace of the segfault? Also, don't forget to build it with debug symbols. Ok, i've already tried to patch cpufreqd_2.3.3-3 with some patch found on the net: (Downloaded cpufreqd_2.3.3-3.diff and cpufreqd_2.3.3.orig.tar.gz) $ tar xvzf cpufreqd_2.3.3.orig.tar.gz $ patch -p0 cpufreqd_2.3.3-3.diff $ cd cpufreqd-2.3.3 $ sudo apt-get install libsensors-dev libcpufreqd-dev $ patch -p0 Index: src/cpufreqd_acpi.c === RCS file: /cvsroot/cpufreqd/sources2/src/cpufreqd_acpi.c,v retrieving revision 1.8 diff -u -r1.8 cpufreqd_acpi.c --- src/cpufreqd_acpi.c 31 Aug 2008 01:17:25 - 1.8 +++ src/cpufreqd_acpi.c 1 Oct 2008 12:22:23 - @@ -246,8 +246,8 @@ /* read `clsname` devices */ devs = sysfs_get_class_devices(cls); - if (!cls) { - clog(LOG_INFO, class '%s' not found (%s)\n, clsname, + if (!devs) { + clog(LOG_INFO, class device '%s' not found (%s)\n, clsname, strerror(errno)); sysfs_close_class(cls); return -1; this shouldn't even apply as it's already applied to the debian package when building. thanks -- mattia :wq! -- To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org