Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys The veriexec API uses dev_t and ino_t for device and ino...
details: https://anonhg.NetBSD.org/src/rev/04248f1624ab
branches: trunk
changeset: 583581:04248f1624ab
user: elad <elad%NetBSD.org@localhost>
date: Sat Aug 13 12:56:44 2005 +0000
description:
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/dev/verified_exec.c | 21 +++++++++++++++------
sys/kern/kern_verifiedexec.c | 10 +++++++---
2 files changed, 22 insertions(+), 9 deletions(-)
diffs (85 lines):
diff -r dba996b506d0 -r 04248f1624ab sys/dev/verified_exec.c
--- a/sys/dev/verified_exec.c Sat Aug 13 12:08:34 2005 +0000
+++ b/sys/dev/verified_exec.c Sat Aug 13 12:56:44 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: verified_exec.c,v 1.20 2005/08/13 12:08:34 elad Exp $ */
+/* $NetBSD: verified_exec.c,v 1.21 2005/08/13 12:56:44 elad Exp $ */
/*-
* Copyright 2005 Elad Efrat <elad%bsd.org.il@localhost>
@@ -31,9 +31,9 @@
#include <sys/cdefs.h>
#if defined(__NetBSD__)
-__KERNEL_RCSID(0, "$NetBSD: verified_exec.c,v 1.20 2005/08/13 12:08:34 elad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: verified_exec.c,v 1.21 2005/08/13 12:56:44 elad Exp $");
#else
-__RCSID("$Id: verified_exec.c,v 1.20 2005/08/13 12:08:34 elad Exp $\n$NetBSD: verified_exec.c,v 1.20 2005/08/13 12:08:34 elad Exp $");
+__RCSID("$Id: verified_exec.c,v 1.21 2005/08/13 12:56:44 elad Exp $\n$NetBSD: verified_exec.c,v 1.21 2005/08/13 12:56:44 elad Exp $");
#endif
#include <sys/param.h>
@@ -229,12 +229,20 @@
vrele(nid.ni_vp);
/* Get table for the device. */
- tbl = veriexec_tblfind(va.va_fsid);
+ /*
+ * XXX: va_fsid is long (32/64 bits) and veriexec_tblfind()
+ * XXX: is passed a dev_t - uint32_t.
+ */
+ tbl = veriexec_tblfind((dev_t)va.va_fsid);
if (tbl == NULL) {
return (EINVAL);
}
- hh = 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.
+ */
+ hh = veriexec_lookup((dev_t)va.va_fsid, (ino_t)va.va_fileid);
if (hh != NULL) {
/*
* Duplicate entry means something is wrong in
@@ -257,7 +265,8 @@
}
e = malloc(sizeof(*e), M_TEMP, M_WAITOK);
- e->inode = va.va_fileid;
+ /* XXX: va_fileid is long (32/64 bits), ino_t is uint32_t. */
+ e->inode = (ino_t)va.va_fileid;
e->type = params->type;
e->status = FINGERPRINT_NOTEVAL;
if ((e->ops = veriexec_find_ops(params->fp_type)) == NULL) {
diff -r dba996b506d0 -r 04248f1624ab sys/kern/kern_verifiedexec.c
--- a/sys/kern/kern_verifiedexec.c Sat Aug 13 12:08:34 2005 +0000
+++ b/sys/kern/kern_verifiedexec.c Sat Aug 13 12:56:44 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_verifiedexec.c,v 1.34 2005/08/13 12:08:34 elad Exp $ */
+/* $NetBSD: kern_verifiedexec.c,v 1.35 2005/08/13 12:56:44 elad 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.34 2005/08/13 12:08:34 elad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_verifiedexec.c,v 1.35 2005/08/13 12:56:44 elad Exp $");
#include "opt_verified_exec.h"
@@ -361,7 +361,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