Re: [PATCH] Uniquely identifying memory usage

Martijn van Oosterhout (s3100411@student.anu.edu.au)
Sat, 31 Jul 1999 00:48:42 +1000


Ralf Baechle wrote:
> > > Wouldn't it be a lot easier if the id was simply current->mm?
> > > Thus when CLONE_MM is used they get the same number. Guarenteed
> > > never to be reused while in use.

> > Yeah, it would. Is there any good reason not to do this? If this doesn't
> > have problems, why isn't the same thing done for other kernel ID's? I
> > can't think of a single place in the kernel where kernel space pointers
> > get exported to user space as opaque handles, and that makes me nervous
> > about being the first person to do it. (OTOH, I can think of several
> > places where NT does this... which makes me even more nervous about doing
> > it in Linux. <g>)

> It's much easier to change the validity of a small integer as an id than
> a pointer. Think of file descriptors, for example.

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.

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.

Martijn van Oosterhout
Australia

-
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/