[lkml]   [2009]   [May]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [PATCH 2/2] perf_counter: optimize context switch between identical inherited contexts
    On Fri, 2009-05-22 at 14:27 +1000, Paul Mackerras wrote:

    > The equivalence of contexts is detected by keeping a pointer in
    > each cloned context pointing to the context it was cloned from.
    > To cope with the situation where a context is changed by adding
    > or removing counters after it has been cloned, we also keep a
    > generation number on each context which is incremented every time
    > a context is changed. When a context is cloned we take a copy
    > of the parent's generation number, and two cloned contexts are
    > equivalent only if they have the same parent and the same
    > generation number. In order that the parent context pointer
    > remains valid (and is not reused), we increment the parent
    > context's reference count for each context cloned from it.

    > + u32 generation;

    Suppose someone writes a malicious proglet that inherits the counters,
    puts the child to sleep, does 2^32 mods on the counter set, and then
    wakes up the child.

    Would that merely corrupt the results, or make the kernel explode?

     \ /
      Last update: 2009-05-22 10:35    [W:0.056 / U:41.428 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site