Package: powertop Version: 2.0-0.2 Severity: normal Tags: upstream patch Powertop crashes because /proc/cpuinfo on ARM differs from the usual Intel /proc/cpuinfo, so a function is called with a bad processor number (-1).
A patch was sent to the powertop mailing list. -- System Information: Debian Release: wheezy/sid APT prefers testing-proposed-updates APT policy: (500, 'testing-proposed-updates'), (500, 'testing') Architecture: armel (armv6l) Kernel: Linux 3.1.9+ (PREEMPT) Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages powertop depends on: ii libc6 2.13-33 ii libgcc1 1:4.7.1-2 ii libncursesw5 5.9-10 ii libnl-3-200 3.2.7-4 ii libnl-genl-3-200 3.2.7-4 ii libpci3 1:3.1.9-5 ii libstdc++6 4.7.1-2 ii libtinfo5 5.9-10 ii zlib1g 1:1.2.7.dfsg-13 powertop recommends no packages. Versions of packages powertop suggests: pn cpufrequtils <none> pn laptop-mode-tools <none> -- no debconf information
>From 46702a2bb5f6adb6c4735bebb69ec2828d695ef6 Mon Sep 17 00:00:00 2001 From: Stefan Weil <[email protected]> Date: Thu, 12 Jul 2012 20:10:32 +0200 Subject: [PATCH] Fix crash on Linux ARM hosts /proc/cpuinfo on ARM hosts is different and resulted in a call of handle_one_cpu() with number == -1 which finally raised a SIGSEGV crash (noticed on Debian Wheezy for ARM). Fix this by testing the value of "number". After number was used, it is now reset to -1 just to make sure that the new test also works for a potential 2nd cpu with unexpected information in /proc/cpuinfo. Signed-off-by: Stefan Weil <[email protected]> --- Please note that even with this patch, powertop on ARM will only work partially: handle_one_cpu() is never called, so there is no cpu information. For ARM hosts with a single core cpu (the most common case), using a case insensitive compare for 'processor' would work. This is my /proc/cpuinfo: Processor : ARMv6-compatible processor rev 7 (v6l) BogoMIPS : 697.95 Features : swp half thumb fastmult vfp edsp java tls CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part : 0xb76 CPU revision : 7 Hardware : BCM2708 Revision : 0002 Serial : 00000000e16a63c5 For multicore cpus, a better 2nd patch is needed. If anybody has a /proc/cpuinfo of that kind, please tell me the format - otherwise I'll have to look in the Linux source. Regards, Stefan Weil src/cpu/cpu.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/cpu/cpu.cpp b/src/cpu/cpu.cpp index 4096835..d08bdcd 100644 --- a/src/cpu/cpu.cpp +++ b/src/cpu/cpu.cpp @@ -271,8 +271,11 @@ void enumerate_cpus(void) } } if (strncasecmp(line, "bogomips\t", 9) == 0) { - handle_one_cpu(number, vendor, family, model); - set_max_cpu(number); + if (number >= 0) { + handle_one_cpu(number, vendor, family, model); + set_max_cpu(number); + number = -1; + } } } -- 1.7.10

