cache'd pid recycling adds cached info to hash again causing double free on exit cleanup

Bug #1631050 reported by Colin Ian King
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cpustat (Ubuntu)
Fix Released
High
Colin Ian King
Xenial
Fix Released
High
Colin Ian King

Bug Description

[XENIAL SRU]

[Impact]
Cached pid info is added to the hash table even when it's a re-used pid info causing a double free on exit cleanup. Only add pid info to hash table if it is newly allocated.

[Test Case]
Run cpustat for a long duration as follows:

cpustat 1 -T -g

..and work through a lot of processes IDs until we re-use a PID, e.g.:

stress-ng --fork 0 &

and stop cpustat with SIGINT, one hits a double free as it exits

[Regression Potential]

Minimal, the fix stops an item being added to a cache'd hash list more than once, and that is a minimal impact on the main cpustat functionality.

[Fix]
Upstream commit http://kernel.ubuntu.com/git/cking/cpustat.git/commit/?id=dc7d2fe45560c414645bc286a7cd63f13b69dc6c

Revision history for this message
Colin Ian King (colin-king) wrote :

fix commited:

commit dc7d2fe45560c414645bc286a7cd63f13b69dc6c
Author: Colin Ian King <email address hidden>
Date: Thu Oct 6 17:12:00 2016 +0100

    cpustat: only add pid info to hash table if it is new (LP: #1631050)

Changed in cpustat (Ubuntu):
status: New → In Progress
importance: Undecided → High
assignee: nobody → Colin Ian King (colin-king)
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cpustat - 0.01.27-1ubuntu0

---------------
cpustat (0.01.27-1ubuntu0) yakkety; urgency=medium

  * Only add pid info to hash table if it is new (LP: #1631050)
    - fixes double free error on exit

 -- Colin King <email address hidden> Thu, 6 Oct 2016 17:17:18 +0100

Changed in cpustat (Ubuntu):
status: Fix Committed → Fix Released
description: updated
Changed in cpustat (Ubuntu Xenial):
status: New → In Progress
importance: Undecided → High
assignee: nobody → Colin Ian King (colin-king)
Revision history for this message
Andy Whitcroft (apw) wrote : Please test proposed package

Hello Colin, or anyone else affected,

Accepted cpustat into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/cpustat/0.01.25-1ubuntu0 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in cpustat (Ubuntu Xenial):
status: In Progress → Fix Committed
tags: added: verification-needed
Revision history for this message
Colin Ian King (colin-king) wrote :

Given this a good thrash test on the raspi2 board where I first detected this and it no longer breaks with the latest version in -proposed. It's fixed.

tags: added: verification-done
removed: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cpustat - 0.01.25-1ubuntu0

---------------
cpustat (0.01.25-1ubuntu0) xenial; urgency=medium

  * Only add pid info to hash table if it is new (LP: #1631050)
    - fixes double free error on exit

 -- Colin King <email address hidden> Thu, 6 Oct 2016 17:17:18 +0100

Changed in cpustat (Ubuntu Xenial):
status: Fix Committed → Fix Released
Revision history for this message
Martin Pitt (pitti) wrote : Update Released

The verification of the Stable Release Update for cpustat has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.