Skip to contentSkip to conversation

A series of patches towards limiting memory corruption and foot print

Powertop Alexandra Yates 1 participant 1 message May 5, 2014

lore
Share & tools
lore

Alexandra Yates

author
#0 lore raw
Quoted 7 lines · Daniel
Quoted 3 lines

Sorry about a second post, looks like email stripped the
attachements.Â
Second attempt here.

Hello,

Quoted 7 lines

it's much easier to review/comment/etc if a patch is inlined in your email, in plain text. (http://www.tux.org/lkml/#s1-10)

care to resend using git send-email?
thanks.

	-ss

Hi Dan,

Thank you for re-sending your patches. This time I added the patches to PowerTOP v2.6-rc2 to facilitate other people's reviews. However, in the future please send your patches using git send-mail. As Sergey indicated that is a easier way for every one to review patches.

Thank you,
Alexandra.

Quoted 99 lines
Quoted 94 lines

Â

From: PowerTop [mailto:powertop-bounces(a)lists.01.org] On Behalf Of Kalowsky, Daniel
Sent: Tuesday, April 29, 2014 5:15 PM
To: powertop(a)lists.01.org
Subject: [Powertop] A series of patches towards limiting memory
corruption
and foot print

Â

Hi Powertop,

Â

I’ve been working with the interactive mode and have run into cases
where
powertop will crash due to a series of memory corruptions.  The
following
series of patches have helped to reduce the frequency of the issue, although not completely solved it.  The issues arise much faster on platforms where there are constrained amounts of RAM to work within.

Â

Patch 1 – When shutting down the interactive display, the display
bits of
memory is not correctly released.  This patch provides a method for correctly doing so.Â

Â

Patch 2 – Solving a documented memory leak with a non-elegant
solution.Â
The path either adds the bundle to the stack, or it forgets about
it.  If
it is forgotten about, make sure to clear that memory before moving
on.Â
This is done with a simple flag variable being set.Â

Â

Patch 3 – When the tuning window is updated, the current pointer is
just
set adrift and not properly free’d.  This patch catches that issue
and
removes the dangling pointer by holding a reference to the pointer
until
it is reset or specifically free’d.

Â

Patch 4 – Someone actually added in the code to create a onetime pretty-print array, this patch just puts it to use by setting the variable.Â

Â

Patch 5 – Limiting the buffer copy to the size of the allocated
buffer
with snprintf.

Â

Patch 6 – There exist some processes and entries that can and do
extend
beyond the length of these buffers.  This limits those entries so as
not
to corrupt other memory on the system when in interactive mode.Â

Â

Patch 7 – This is an untested patch, but follows along the same
lines of
Patch 6.  It applies the same principals only for the report
method.Â

Â

Patch 8 – Creates a clean_shutdown function that can be used to
cleanup
the memory space at shutdown time.  Calls upon parts of Patch 1 to
make
this happen.Â

Â

There will more than likely be some more patches in the future as
time
permits.Â

Quoted 4 lines

_______________________________________________
PowerTop mailing list
PowerTop(a)lists.01.org
https://lists.01.org/mailman/listinfo/powertop

Quoted 5 lines

_______________________________________________
PowerTop mailing list
PowerTop(a)lists.01.org
https://lists.01.org/mailman/listinfo/powertop

Thank you,
Alexandra.