Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-3]: src/sys/kern Pull up revision 1.35 (requested by elad in tick...



details:   https://anonhg.NetBSD.org/src/rev/a28c156e9daf
branches:  netbsd-3
changeset: 576984:a28c156e9daf
user:      tron <tron%NetBSD.org@localhost>
date:      Tue Aug 16 12:43:11 2005 +0000

description:
Pull up revision 1.35 (requested by elad in ticket #669):
The veriexec API uses dev_t and ino_t for device and inode numbers.
VOP_GETATTR() fills a struct vattr, where va_fsid and va_fileid (device
and inode..) are typed as long.
Add some casts when using these values and surround them with XXXs about
the potential size mismatch, as long can be 64 bits but dev_t and ino_t
are always 32 bits. This is safe because *for now* we're still using
32 bit inode numbers.
Discussed with blymn@.

diffstat:

 sys/kern/kern_verifiedexec.c |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (31 lines):

diff -r b5f75f31f4fe -r a28c156e9daf sys/kern/kern_verifiedexec.c
--- a/sys/kern/kern_verifiedexec.c      Tue Aug 16 12:34:57 2005 +0000
+++ b/sys/kern/kern_verifiedexec.c      Tue Aug 16 12:43:11 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_verifiedexec.c,v 1.9.2.22 2005/08/16 12:34:50 tron Exp $  */
+/*     $NetBSD: kern_verifiedexec.c,v 1.9.2.23 2005/08/16 12:43:11 tron Exp $  */
 
 /*-
  * Copyright 2005 Elad Efrat <elad%bsd.org.il@localhost>
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_verifiedexec.c,v 1.9.2.22 2005/08/16 12:34:50 tron Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_verifiedexec.c,v 1.9.2.23 2005/08/16 12:43:11 tron Exp $");
 
 #include <sys/param.h>
 #include <sys/mount.h>
@@ -359,7 +359,11 @@
                return (0);
 
        /* Lookup veriexec table entry, save pointer if requested. */
-       vhe = veriexec_lookup(va->va_fsid, va->va_fileid);
+       /*
+        * XXX: Both va_fsid and va_fileid are long (32/64 bits), while
+        * XXX: veriexec_lookup() is passed dev_t and ino_t - uint32_t.
+        */
+       vhe = veriexec_lookup((dev_t)va->va_fsid, (ino_t)va->va_fileid);
        if (ret != NULL)
                *ret = vhe;
        if (vhe == NULL)



Home | Main Index | Thread Index | Old Index