lkml.org 
[lkml]   [1999]   [Jul]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Uniquely identifying memory usage


On Sat, 31 Jul 1999, Martijn van Oosterhout wrote:

> But userspace programs only need the number to compare. They can't
> use it for anything else. It's just a number. Trying to generate a
> small integer elsewhere only leads to consistancy problems if not
> done right.

Keep in mind that those animals are reused. OTOH adding a generation
number to mm_struct is trivial - the only static one is init_mm (*never*
happens to be tsk->mm under 2.3.11+, only for kernel threads under the
earlier kernels) and the rest is always created by mm_alloc(). So it's a
matter of one static counter.

> In other words, you're hardly exporting state secrets. Any program
> that tries to use this value for anything other than comparisons
> should be shot.

It's a race unless you are dealing with your children. Nothing guarantees
that process will not be killed and its PID reused between the moments
when you read the ids. The only way to do it without race is to watch for
SIGCHLD.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:53    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site