Powertop crashes with 'powertop --auto-tune'
Michael Mullin
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Please see the following patch to address the reported crash
- ---
- From e994a414f619410877023fce35ade12d1cfce68d Mon Sep 17 00:00:00 2001
From: Michael Mullin <masmullin(a)hush.com>
Date: Thu, 22 Jan 2015 16:33:31 -0500
Subject: [PATCH] If "dir" is closed early inside create_add_devfreq_devices()
then there is a potential double free due to a second close during the cleanup phase in clear_all_devfreq()
- ---
src/devices/devfreq.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
src/devices/devfreq.cpp +0 -0
- --- a/src/devices/devfreq.cpp
+++ b/src/devices/devfreq.cpp
@@ -247,6 +247,7 @@ void create_all_devfreq_devices(void)
fprintf(stderr, "Devfreq not enabled\n"); is_enabled = false; closedir(dir);
+ dir = NULL;
return;
}
@@ -327,6 +328,8 @@ void clear_all_devfreq()
}
all_devfreq.clear();
/* close /sys/class/devfreq */
- - if (dir != NULL)
+ if (dir != NULL) {
closedir(dir);
+ dir = NULL;
+ }
}
- --
2.2.2
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQEcBAEBCAAGBQJUwXCLAAoJEJHz7fmWOTHsR2YH/3ASltE3MVMu7V6HoKYvGHFL VsjQNenXTEYLSSiVMZfbZHaypHnH8SdhfJTBMHF1+v2fS2LzuEA/qFfleS39+L9S E/EZGdCWXnrK56pa+Lu6JWguwCNmyhNyOQ+nnaU6v9jH0YmQGx5hMPZu/aPhlZTU LWHxj0Knch1WGUATlofOy98XCbhY9yDICQxMDfJicun6cOAahlQminqJcLTSyGbY t5lVWR2E1ybnpojlot8t2BRmCYR210VmB+Pbpralk+nSRtX2rx4yT/Hx5B3wBbwJ msNs+6+6WKG20EVhxxbTSqLAar9ZMf8w+K8Qsz8Zqg4yzaGra3u6kl80Wr/ElqA= =ObTH
-----END PGP SIGNATURE-----
Joerg Mayer
Hmm, it looks like nobody reacted to (and thus duplicated the work of):
Date: Mon, 22 Dec 2014 02:27:26 +0100
From: Joerg Mayer <jmpt(a)loplof.de>
To: powertop(a)ml01.01.org
In-Reply-To: <549762B4.3090108(a)linux.intel.com>
Which contains the first part of the patch (the one causing the crash) but not the second (which isn't *strictly* required but makes sense from a "good style" point of view).
Did anyone but me actually see that message? I verified that I did receive it back via the list (receive headers).
Thanks
Jörg
Quoted 60 lines · Michael Mullin
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256Please see the following patch to address the reported crash
- ---
- Frome994a414f619410877023fce35ade12d1cfce68dMon Sep 17 00:00:00 2001
From: Michael Mullin <masmullin(a)hush.com>
Date: Thu, 22 Jan 2015 16:33:31 -0500
Subject: [PATCH] If "dir" is closed early insidecreate_add_devfreq_devices()
then there is a potential double free due to a second close during the cleanup phase inclear_all_devfreq()Signed-off-by Michael Mullin <masmullin(a)hush.com>- ---
src/devices/devfreq.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)src/devices/devfreq.cpp +5
-3- --- a/src/devices/devfreq.cpp +++ b/src/devices/devfreq.cpp@@ -247,6 +247,7 @@ void create_all_devfreq_devices(void) fprintf(stderr, "Devfreq not enabled\n"); is_enabled = false; closedir(dir); + dir = NULL; return; }@@ -327,6 +328,8 @@ void clear_all_devfreq() } all_devfreq.clear(); /* close /sys/class/devfreq */ - - if (dir != NULL) + if (dir != NULL) { closedir(dir); + dir = NULL; + } } - --2.2.2
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2iQEcBAEBCAAGBQJUwXCLAAoJEJHz7fmWOTHsR2YH/3ASltE3MVMu7V6HoKYvGHFL VsjQNenXTEYLSSiVMZfbZHaypHnH8SdhfJTBMHF1+v2fS2LzuEA/qFfleS39+L9S E/EZGdCWXnrK56pa+Lu6JWguwCNmyhNyOQ+nnaU6v9jH0YmQGx5hMPZu/aPhlZTU LWHxj0Knch1WGUATlofOy98XCbhY9yDICQxMDfJicun6cOAahlQminqJcLTSyGbY t5lVWR2E1ybnpojlot8t2BRmCYR210VmB+Pbpralk+nSRtX2rx4yT/Hx5B3wBbwJ msNs+6+6WKG20EVhxxbTSqLAar9ZMf8w+K8Qsz8Zqg4yzaGra3u6kl80Wr/ElqA= =ObTH
-----END PGP SIGNATURE-----_______________________________________________
PowerTop mailing list
PowerTop(a)lists.01.org
https://lists.01.org/mailman/listinfo/powertop
Signature · 3 lines
Joerg Mayer <jmayer(a)loplof.de> We are stuck with technology when what we really want is just stuff that works. Some say that should read Microsoft instead of technology.
Michael Mullin
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
I did not see your change before I posted the patch below. However, I do see it now.
https://lists.01.org/pipermail/powertop/2014-December/001730.html
Joerg found it first. Please take my patch as a verification of his.
Quoted 20 lines · Joerg Mayer
Hmm, it looks like nobody reacted to (and thus duplicated the work of):
Date: Mon, 22 Dec 2014 02:27:26 +0100 From: Joerg Mayer <jmpt(a)loplof.de> To: powertop(a)ml01.01.org In-Reply-To: <549762B4.3090108(a)linux.intel.com>
Which contains the first part of the patch (the one causing the crash) but not the second (which isn't *strictly* required but makes sense from a "good style" point of view).
Did anyone but me actually see that message? I verified that I did receive it back via the list (receive headers).
Thanks Jörg
On Thu, Jan 22, 2015 at 04:50:10PM -0500, Michael Mullin wrote: Please see the following patch to address the reported crash --- From
e994a414f619410877023fce35ade12d1cfce68dMon Sep 17 00:00:00 2001 From: Michael Mullin <masmullin(a)hush.com> Date: Thu, 22 Jan 2015 16:33:31 -0500 Subject: [PATCH] If "dir" is closed early insidecreate_add_devfreq_devices()then there is a potential double free due to a second close during the cleanup phase inclear_all_devfreq()Signed-off-by Michael Mullin <masmullin(a)hush.com>--- src/devices/devfreq.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
src/devices/devfreq.cpp index d2e56e3..f652a57 100644 --- a/src/devices/devfreq.cpp +++ b/src/devices/devfreq.cpp @@ -247,6 +247,7 @@ void create_all_devfreq_devices(void) fprintf(stderr, "Devfreq not enabled\n"); is_enabled = false; closedir(dir); + dir = NULL; return; } renamed from src/devices/devfreq.cpp +0
-0@@ -327,6 +328,8 @@ void clear_all_devfreq() } all_devfreq.clear(); /* close /sys/class/devfreq */ - if (dir != NULL) + if (dir != NULL) { closedir(dir); + dir = NULL; + } }Quoted 1 line
Quoted 2 lines
Quoted 1 line
_______________________________________________ PowerTop mailing list PowerTop(a)lists.01.org https://lists.01.org/mailman/listinfo/powertop
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQEcBAEBCAAGBQJUwYsGAAoJEJHz7fmWOTHsKyAH/jlGevaIUil2FlGvkkGo4Y+U xeQNfkVKQbtzpvYW8jKvp+3e08AfNpZIfHrhcholOA9YimV4QDCTLeMc56L89IIZ CF1xXf+Li09cb9d52sdctHhwGuGAr9a951HqSumns3uyFVjYkhLDvrJQajOBONaI m+h7qffm6R3VkBfieTHEAw+ywp74aVK5jnGeZGK/z2R2w2LE6aFR0tM2ABvUFARL XenaceU0rFBYiSHd8LipKX4Y/qC3Nk0ExSGMMnXuLZ/pZ304wmogwqpT1ccr7s4n iSFj+Jo3xYyW2OgceL/kw8N9V4kG4P6wXn1ACRX1Uo09ACsMCEcnx0xWopunpiU= =0HBf
-----END PGP SIGNATURE-----
Alexandra Yates
Quoted 63 lines
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256I did not see your change before I posted the patch below. However, I do see it now.
https://lists.01.org/pipermail/powertop/2014-December/001730.htmlJoerg found it first. Please take my patch as a verification of his.
Quoted 37 lines · Joerg Mayer
Hmm, it looks like nobody reacted to (and thus duplicated the work of):
Date: Mon, 22 Dec 2014 02:27:26 +0100 From: Joerg Mayer <jmpt(a)loplof.de>
To: powertop(a)ml01.01.org In-Reply-To: <549762B4.3090108(a)linux.intel.com>Which contains the first part of the patch (the one causing the crash) but not the second (which isn't *strictly* required but makes sense from a "good style" point of view).
Did anyone but me actually see that message? I verified that I did receive it back via the list (receive headers).
Thanks Jörg
On Thu, Jan 22, 2015 at 04:50:10PM -0500, Michael Mullin wrote: Please see the following patch to address the reported crash --- From
e994a414f619410877023fce35ade12d1cfce68dMon Sep 17 00:00:00 2001 From:
Michael Mullin <masmullin(a)hush.com> Date: Thu, 22 Jan 2015 16:33:31 -0500 Subject: [PATCH] If "dir" is closed early insidecreate_add_devfreq_devices()then there is a potential double free due to a second close during the cleanup phase inclear_all_devfreq()Signed-off-by Michael Mullin <masmullin(a)hush.com>--- src/devices/devfreq.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
src/devices/devfreq.cpp index renamed from src/devices/devfreq.cpp +0
-0d2e56e3..f652a57 100644 --- a/src/devices/devfreq.cpp +++ b/src/devices/devfreq.cpp @@ -247,6 +247,7 @@ void
create_all_devfreq_devices(void)fprintf(stderr, "Devfreq not
enabled\n");is_enabled= false; closedir(dir); + dir = NULL; return; }src/devices/devfreq.cpp index renamed from src/devices/devfreq.cpp +0
-0@@ -327,6 +328,8 @@ void clear_all_devfreq() } all_devfreq.clear(); /* close /sys/class/devfreq */ - if (dir != NULL) + if (dir != NULL) { closedir(dir); + dir = NULL; + } }Quoted 1 line
Quoted 3 lines
Quoted 2 lines
_______________________________________________ PowerTop mailing list PowerTop(a)lists.01.org https://lists.01.org/mailman/listinfo/powertop
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2iQEcBAEBCAAGBQJUwYsGAAoJEJHz7fmWOTHsKyAH/jlGevaIUil2FlGvkkGo4Y+U xeQNfkVKQbtzpvYW8jKvp+3e08AfNpZIfHrhcholOA9YimV4QDCTLeMc56L89IIZ CF1xXf+Li09cb9d52sdctHhwGuGAr9a951HqSumns3uyFVjYkhLDvrJQajOBONaI m+h7qffm6R3VkBfieTHEAw+ywp74aVK5jnGeZGK/z2R2w2LE6aFR0tM2ABvUFARL XenaceU0rFBYiSHd8LipKX4Y/qC3Nk0ExSGMMnXuLZ/pZ304wmogwqpT1ccr7s4n iSFj+Jo3xYyW2OgceL/kw8N9V4kG4P6wXn1ACRX1Uo09ACsMCEcnx0xWopunpiU= =0HBf
-----END PGP SIGNATURE-----
Quoted 5 lines
_______________________________________________
PowerTop mailing list
PowerTop(a)lists.01.org
https://lists.01.org/mailman/listinfo/powertop
All,
Big apologies, I though I added Joerg's patch to upstream in December. I've added Michael's now, to include all changes. I would appreciate if you confirm that upstream is fixed now.
I will add a new release after the test are confirmed to work.
Thank you,
Alexandra.