Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 556480 - app-admin/conky-1.9.0-r3 : conky crashes with a SEGV in a CPU hotplug environment
Summary: app-admin/conky-1.9.0-r3 : conky crashes with a SEGV in a CPU hotplug environ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Daniel Pielmeier
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-02 02:02 UTC by devsk
Modified: 2017-11-26 14:30 UTC (History)
0 users

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


Attachments
Do not go beyond the size of the array allocated for CPUs (conky-1.9.0-segv_numCPUs.patch,371 bytes, patch)
2015-08-02 02:03 UTC, devsk
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description devsk 2015-08-02 02:02:23 UTC
There is a bug in conky code where it gets the number of CPUs at the startup and if the CPUs are added or removed with hotplug, it SEGVs.

I noticed this because I hotplug remove the hyper-threaded CPUs (I can't disable HT at the BIOS level, its a Macbook). On resume from sleep, temporarily, all CPUs are enabled. So, conky tries to write for 8 CPUs to an array which it allocated only for 4 CPUs.

The attached patch just stops after the cpu_count, thereby fixing the SEGV.

Reproducible: Always

Steps to Reproduce:
1. run conky
2. suspend
3. resume
Actual Results:  
conky crashes with SSEGV

Expected Results:  
conky keeps running
Comment 1 devsk 2015-08-02 02:03:42 UTC
Created attachment 408130 [details, diff]
Do not go beyond the size of the array allocated for CPUs
Comment 2 devsk 2015-08-02 02:05:12 UTC
Not sure about the state of the conky project, that's why filing it here. If we can do r4 release with the patch, it would be great!
Comment 3 Daniel Pielmeier gentoo-dev 2015-08-03 13:48:15 UTC
(In reply to devsk from comment #2)
> Not sure about the state of the conky project, that's why filing it here. If
> we can do r4 release with the patch, it would be great!

Thank you very much for the patch.

The conky project seemed to have stalled but gained speed again and a lot of patches were added recently. See (https://github.com/brndnmtthws/conky/commits/master)

I would appreciate it if you propose this patch also to the conky project.
Comment 4 devsk 2015-08-04 18:29:16 UTC
I filed: https://github.com/brndnmtthws/conky/issues/127
Comment 5 Daniel Pielmeier gentoo-dev 2017-11-18 11:46:34 UTC
Fixed in GIT.
Comment 6 Bug Bugs 2017-11-22 11:17:57 UTC
But according to /proc/stat where data taken from idx==0 it's total cpu usage and idx==1 it's first cpu (cpu0, and cpu3 for idx==4). So patch is wrong and at least should be modified like `if (idx > info.cpu_count) {`.

Check:
1. add config for your last cpu with `${cpugraph cpu4}` for example
2. there is data w/o patch
3. empty graph w/ patch
Comment 7 Daniel Pielmeier gentoo-dev 2017-11-26 14:30:17 UTC
Thanks for noticing. This is fixed in GIT for conky-1.10.6-r6.