Re: [PATCH] New version of mmid patch, against 2.3.12

Alexander Viro (viro@math.psu.edu)
Fri, 30 Jul 1999 00:47:17 -0400 (EDT)


On Thu, 29 Jul 1999 cd_smith@ou.edu wrote:

> Hey,
>
> Here's my mmid patch against 2.3.12. I took the suggestion of Martijn van
> Oosterhout to use current->mm as the mm_id. I thought about it, and I've
> convinced myself there are no security issues with that. So it's actually
> substantially smaller than the old one. And there's really no extra
> memory required besides a tiny amount of additional code in the proc
> filesystem. That worked out very nicely. (Thanks Martijn!)
>
> If anyone has any comments or complaints, let me know. If not, Linus
> please consider this for 2.3.13.

First of all, check for init_mm is wrong. Kernel threads have NULL
->mm now. Another thing being that you have a potential race here. Correct
way to do the thing:

static int get_mm_id(int pid, char * buffer)
{
struct mm_struct *mm = get_mm(pid);
int res = sprintf(buffer,"%lu\n", (unsigned long)mm);
mmput(mm);
return res;
}

and the rest as in your variant.

Cheers,
Al (tweaking procfs right now ;-)

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