Subject: Re: ucred work
To: None <tech-kern@netbsd.org>
From: David Laight <david@l8s.co.uk>
List: tech-kern
Date: 10/24/2002 12:17:27
Ok: Mechanical change missed from (at least):
- compat/irix/irix_mount (use crdup() instead crget and memcpy())
- compat/irix/irix_prctl.c
- compat/irix/irix_signal
- compat/linux/arch/alpha/linux_exec_alpha.c
- compat/linux/arch/powerpc/linux_exec_powerpc.c
- compat/netbsd32/netbsd32_execve.c
- compat/netbsd32/netbsd32_netbsd.c
- compat/netbsd32/netbsd32_wait.c
- compat/osf1/osf1_prot.c
- compat/svr4/svr4_misc.c
- compat/svr4/svr4_resource.c
- compat/svr4_32/svr4_32_exec_elf32.c
- compat/svr4_32/svr4_32_lwp.c
- compat/svr4_32/svr4_32_misc.c
- compat/svr4_32/svr4_32_resource.c
- filecorefs/filecore_vfsops.c
- netkey/key.c

NFS loads user credentials directly, to be absolutely sure
root privileged are not checked by mistake the 'e' and 'sv'
fields should be set to be the same as the 'r' one.

You have broken binaray compatibility for users of the
(depracated) sysctl proc interface.  If this is a problem
then defining ucred as:

 struct ucred {
        u_int32_t       cr_ref;                 /* reference count */
+       uid_t           cr_ruid;                /* Real user id */
+       uid_t           cr_svuid;               /* Saved effective user id */
+       gid_t           cr_rgid;                /* Real group id */
+       gid_t           cr_svgid;               /* Saved effective group id */
+       u_int32_t       cr_pad[2];              /* for binary compatibility */
        uid_t           cr_uid;                 /* effective user id */
        gid_t           cr_gid;                 /* effective group id */
        u_int32_t       cr_ngroups;             /* number of groups */
        gid_t           cr_groups[NGROUPS];     /* groups */
 };

will maintain compatibility, in any case you have the cr_ruid
out of position.

In sys_execve (kern_exec.c) and fork1 (kern_fork.c) you are
calling crcopy() when the cred structure is unchanged.
This stops structure being shared.....

Why did you use memcpy() instead of structure assignment in
crdup and crcopy?

	David

-- 
David Laight: david@l8s.co.uk