Subject: Re: src/sys/kern/kern_prot.c, function crcmp
To: None <tech-kern@netbsd.org>
From: Christos Zoulas <christos@astron.com>
List: tech-kern
Date: 08/22/2005 17:22:10
In article <4309EC8B.4050109@NetBSD.org>,
Roland Illig  <rillig@NetBSD.org> wrote:
>Hi all,
>
>I just fixed a bug in the crcmp function, but I strongly believe there's 
>another one. That's why I have put the big FIXME comment into it.
>
>As I am completely new to the kernel code, I can tell neither under 
>which exact circumstances the function is called nor if the memcpy() is 
>sufficient for comparing the group lists.
>
>If it is sufficient, could someone please replace my FIXME comment with 
>a comment that explains _why_ it is sufficient?
>
>If it is not sufficient we need a simple and fast algorithm to compare 
>the two group lists, maybe including the primary egid of each list. As 
>the function is currently only used in one place (vfs_subr.c), even a 
>simpler algorithm might do the job. Do we really need to know if both 
>lists are equal or does it suffice if one list is a sublist of the other?

The lists need to be equal since this determines if as new one will be
allocated or the one from the pool can be used. I.e. if crcmp always
returns 1, a new one will be allocated and the system will still work.

christos