PERFORCE change 15255 for review
Robert Watson
rwatson at freebsd.org
Wed Jul 31 00:52:27 GMT 2002
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=15255
Change 15255 by rwatson at rwatson_tislabs on 2002/07/30 17:51:47
Trickle IFC recent MAC commits back into the TrustedBSD tree.
Affected files ...
.. //depot/projects/trustedbsd/base/sys/fs/ntfs/ntfs_vnops.c#5 integrate
.. //depot/projects/trustedbsd/base/sys/kern/init_main.c#13 integrate
.. //depot/projects/trustedbsd/base/sys/kern/init_sysent.c#13 integrate
.. //depot/projects/trustedbsd/base/sys/kern/kern_prot.c#16 integrate
.. //depot/projects/trustedbsd/base/sys/kern/syscalls.c#13 integrate
.. //depot/projects/trustedbsd/base/sys/sys/mac.h#2 integrate
.. //depot/projects/trustedbsd/base/sys/sys/syscall.h#14 integrate
.. //depot/projects/trustedbsd/base/sys/sys/syscall.mk#14 integrate
.. //depot/projects/trustedbsd/base/sys/sys/sysproto.h#15 integrate
Differences ...
==== //depot/projects/trustedbsd/base/sys/fs/ntfs/ntfs_vnops.c#5 (text+ko) ====
@@ -35,7 +35,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/fs/ntfs/ntfs_vnops.c,v 1.30 2002/05/16 21:25:39 trhodes Exp $
+ * $FreeBSD: src/sys/fs/ntfs/ntfs_vnops.c,v 1.31 2002/07/31 00:42:57 semenu Exp $
*
*/
@@ -101,7 +101,9 @@
register struct ntnode *ip = FTONT(fp);
struct uio *uio = ap->a_uio;
struct ntfsmount *ntmp = ip->i_mp;
- u_int64_t toread;
+ struct buf *bp;
+ daddr_t cn;
+ int resid, off, toread;
int error;
dprintf(("ntfs_read: ino: %d, off: %d resid: %d, segflg: %d\n",ip->i_number,(u_int32_t)uio->uio_offset,uio->uio_resid,uio->uio_segflg));
@@ -110,23 +112,36 @@
/* don't allow reading after end of file */
if (uio->uio_offset > fp->f_size)
- toread = 0;
- else
- toread = min( uio->uio_resid, fp->f_size - uio->uio_offset );
+ return (0);
+
+ resid = min(uio->uio_resid, fp->f_size - uio->uio_offset);
+
+ dprintf((", resid: %d\n", resid));
+
+ error = 0;
+ while (resid) {
+ cn = ntfs_btocn(uio->uio_offset);
+ off = ntfs_btocnoff(uio->uio_offset);
+
+ toread = min(off + resid, ntfs_cntob(1));
- dprintf((", toread: %d\n",(u_int32_t)toread));
+ error = bread(vp, cn, ntfs_cntob(1), NOCRED, &bp);
+ if (error) {
+ brelse(bp);
+ break;
+ }
- if (toread == 0)
- return (0);
+ error = uiomove(bp->b_data + off, toread - off, uio);
+ if(error) {
+ brelse(bp);
+ break;
+ }
+ brelse(bp);
- error = ntfs_readattr(ntmp, ip, fp->f_attrtype,
- fp->f_attrname, uio->uio_offset, toread, NULL, uio);
- if (error) {
- printf("ntfs_read: ntfs_readattr failed: %d\n",error);
- return (error);
+ resid -= toread - off;
}
- return (0);
+ return (error);
}
static int
==== //depot/projects/trustedbsd/base/sys/kern/init_main.c#13 (text+ko) ====
@@ -39,10 +39,11 @@
* SUCH DAMAGE.
*
* @(#)init_main.c 8.9 (Berkeley) 1/21/94
- * $FreeBSD: src/sys/kern/init_main.c,v 1.199 2002/07/20 02:56:11 peter Exp $
+ * $FreeBSD: src/sys/kern/init_main.c,v 1.200 2002/07/31 00:39:19 rwatson Exp $
*/
#include "opt_init_path.h"
+#include "opt_mac.h"
#include <sys/param.h>
#include <sys/kernel.h>
@@ -50,6 +51,7 @@
#include <sys/filedesc.h>
#include <sys/ktr.h>
#include <sys/lock.h>
+#include <sys/mac.h>
#include <sys/mount.h>
#include <sys/mutex.h>
#include <sys/sysctl.h>
@@ -362,6 +364,9 @@
p->p_ucred->cr_uidinfo = uifind(0);
p->p_ucred->cr_ruidinfo = uifind(0);
p->p_ucred->cr_prison = NULL; /* Don't jail it. */
+#ifdef MAC
+ mac_create_proc0(p->p_ucred);
+#endif
td->td_ucred = crhold(p->p_ucred);
/* Create procsig. */
@@ -657,6 +662,9 @@
initproc->p_flag |= P_SYSTEM;
oldcred = initproc->p_ucred;
crcopy(newcred, oldcred);
+#ifdef MAC
+ mac_create_proc1(newcred);
+#endif
initproc->p_ucred = newcred;
PROC_UNLOCK(initproc);
crfree(oldcred);
==== //depot/projects/trustedbsd/base/sys/kern/init_sysent.c#13 (text+ko) ====
@@ -2,8 +2,8 @@
* System call switch table.
*
* DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/kern/init_sysent.c,v 1.128 2002/07/30 16:52:21 rwatson Exp $
- * created from FreeBSD: src/sys/kern/syscalls.master,v 1.118 2002/07/30 16:50:25 rwatson Exp
+ * $FreeBSD: src/sys/kern/init_sysent.c,v 1.129 2002/07/31 00:16:58 rwatson Exp $
+ * created from FreeBSD: src/sys/kern/syscalls.master,v 1.119 2002/07/30 22:43:20 rwatson Exp
*/
#include "opt_compat.h"
==== //depot/projects/trustedbsd/base/sys/kern/kern_prot.c#16 (text+ko) ====
@@ -37,7 +37,7 @@
* SUCH DAMAGE.
*
* @(#)kern_prot.c 8.6 (Berkeley) 1/21/94
- * $FreeBSD: src/sys/kern/kern_prot.c,v 1.161 2002/07/11 02:18:33 mini Exp $
+ * $FreeBSD: src/sys/kern/kern_prot.c,v 1.162 2002/07/31 00:39:19 rwatson Exp $
*/
/*
@@ -45,6 +45,7 @@
*/
#include "opt_compat.h"
+#include "opt_mac.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -52,6 +53,7 @@
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/malloc.h>
+#include <sys/mac.h>
#include <sys/mutex.h>
#include <sys/sx.h>
#include <sys/proc.h>
@@ -1670,6 +1672,9 @@
MALLOC(cr, struct ucred *, sizeof(*cr), M_CRED, M_WAITOK | M_ZERO);
cr->cr_ref = 1;
cr->cr_mtxp = mtx_pool_find(cr);
+#ifdef MAC
+ mac_init_cred(cr);
+#endif
return (cr);
}
@@ -1714,6 +1719,9 @@
*/
if (jailed(cr))
prison_free(cr->cr_prison);
+#ifdef MAC
+ mac_destroy_cred(cr);
+#endif
FREE(cr, M_CRED);
mtx_unlock(&Giant);
} else {
@@ -1750,6 +1758,9 @@
uihold(dest->cr_ruidinfo);
if (jailed(dest))
prison_hold(dest->cr_prison);
+#ifdef MAC
+ mac_create_cred(src, dest);
+#endif
}
/*
==== //depot/projects/trustedbsd/base/sys/kern/syscalls.c#13 (text+ko) ====
@@ -2,8 +2,8 @@
* System call names.
*
* DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/kern/syscalls.c,v 1.114 2002/07/30 16:52:22 rwatson Exp $
- * created from FreeBSD: src/sys/kern/syscalls.master,v 1.118 2002/07/30 16:50:25 rwatson Exp
+ * $FreeBSD: src/sys/kern/syscalls.c,v 1.115 2002/07/31 00:16:58 rwatson Exp $
+ * created from FreeBSD: src/sys/kern/syscalls.master,v 1.119 2002/07/30 22:43:20 rwatson Exp
*/
char *syscallnames[] = {
==== //depot/projects/trustedbsd/base/sys/sys/mac.h#2 (text+ko) ====
@@ -34,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/sys/mac.h,v 1.1 2002/07/30 21:32:34 rwatson Exp $
+ * $FreeBSD: src/sys/sys/mac.h,v 1.2 2002/07/31 00:03:26 rwatson Exp $
*/
/*
* Userland/kernel interface for Mandatory Access Control.
@@ -184,7 +184,7 @@
* and various other messes.
*/
-#define MAC_MAX_POLICIES 8
+#define MAC_MAX_POLICIES 4
struct label {
int l_flags;
==== //depot/projects/trustedbsd/base/sys/sys/syscall.h#14 (text+ko) ====
@@ -2,8 +2,8 @@
* System call numbers.
*
* DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/sys/syscall.h,v 1.113 2002/07/30 16:52:22 rwatson Exp $
- * created from FreeBSD: src/sys/kern/syscalls.master,v 1.118 2002/07/30 16:50:25 rwatson Exp
+ * $FreeBSD: src/sys/sys/syscall.h,v 1.114 2002/07/31 00:16:58 rwatson Exp $
+ * created from FreeBSD: src/sys/kern/syscalls.master,v 1.119 2002/07/30 22:43:20 rwatson Exp
*/
#define SYS_syscall 0
==== //depot/projects/trustedbsd/base/sys/sys/syscall.mk#14 (text+ko) ====
@@ -1,7 +1,7 @@
# FreeBSD system call names.
# DO NOT EDIT-- this file is automatically generated.
-# $FreeBSD: src/sys/sys/syscall.mk,v 1.68 2002/07/30 16:52:22 rwatson Exp $
-# created from FreeBSD: src/sys/kern/syscalls.master,v 1.118 2002/07/30 16:50:25 rwatson Exp
+# $FreeBSD: src/sys/sys/syscall.mk,v 1.69 2002/07/31 00:16:58 rwatson Exp $
+# created from FreeBSD: src/sys/kern/syscalls.master,v 1.119 2002/07/30 22:43:20 rwatson Exp
MIASM = \
syscall.o \
exit.o \
==== //depot/projects/trustedbsd/base/sys/sys/sysproto.h#15 (text+ko) ====
@@ -2,8 +2,8 @@
* System call prototypes.
*
* DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/sys/sysproto.h,v 1.105 2002/07/30 16:52:22 rwatson Exp $
- * created from FreeBSD: src/sys/kern/syscalls.master,v 1.118 2002/07/30 16:50:25 rwatson Exp
+ * $FreeBSD: src/sys/sys/sysproto.h,v 1.106 2002/07/31 00:16:58 rwatson Exp $
+ * created from FreeBSD: src/sys/kern/syscalls.master,v 1.119 2002/07/30 22:43:20 rwatson Exp
*/
#ifndef _SYS_SYSPROTO_H_
@@ -1075,26 +1075,26 @@
register_t dummy;
};
struct __mac_get_proc_args {
- char dummy_l_[PADL_(void *)]; void * dummy; char dummy_r_[PADR_(void *)];
+ char mac_p_l_[PADL_(struct mac *)]; struct mac * mac_p; char mac_p_r_[PADR_(struct mac *)];
};
struct __mac_set_proc_args {
- char dummy_l_[PADL_(void *)]; void * dummy; char dummy_r_[PADR_(void *)];
+ char mac_p_l_[PADL_(struct mac *)]; struct mac * mac_p; char mac_p_r_[PADR_(struct mac *)];
};
struct __mac_get_fd_args {
char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
- char dummy_l_[PADL_(void *)]; void * dummy; char dummy_r_[PADR_(void *)];
+ char mac_p_l_[PADL_(struct mac *)]; struct mac * mac_p; char mac_p_r_[PADR_(struct mac *)];
};
struct __mac_get_file_args {
char path_p_l_[PADL_(const char *)]; const char * path_p; char path_p_r_[PADR_(const char *)];
- char dummy_l_[PADL_(void *)]; void * dummy; char dummy_r_[PADR_(void *)];
+ char mac_p_l_[PADL_(struct mac *)]; struct mac * mac_p; char mac_p_r_[PADR_(struct mac *)];
};
struct __mac_set_fd_args {
char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
- char dummy_l_[PADL_(void *)]; void * dummy; char dummy_r_[PADR_(void *)];
+ char mac_p_l_[PADL_(struct mac *)]; struct mac * mac_p; char mac_p_r_[PADR_(struct mac *)];
};
struct __mac_set_file_args {
char path_p_l_[PADL_(const char *)]; const char * path_p; char path_p_r_[PADR_(const char *)];
- char dummy_l_[PADL_(void *)]; void * dummy; char dummy_r_[PADR_(void *)];
+ char mac_p_l_[PADL_(struct mac *)]; struct mac * mac_p; char mac_p_r_[PADR_(struct mac *)];
};
struct kenv_args {
char what_l_[PADL_(int)]; int what; char what_r_[PADR_(int)];
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message
More information about the trustedbsd-cvs
mailing list