PERFORCE change 15256 for review
Robert Watson
rwatson at freebsd.org
Wed Jul 31 00:57:34 GMT 2002
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=15256
Change 15256 by rwatson at rwatson_tislabs on 2002/07/30 17:57:23
Trickle IFC MAC changes back into the MAC tree. Preserve the
policy count of 8 in the MAC tree, whereas the main tree uses
4. Fix one cosmetic #ifdef bug in the process.
Affected files ...
.. //depot/projects/trustedbsd/mac/sys/fs/ntfs/ntfs_vnops.c#7 integrate
.. //depot/projects/trustedbsd/mac/sys/kern/init_main.c#24 integrate
.. //depot/projects/trustedbsd/mac/sys/kern/init_sysent.c#23 edit
.. //depot/projects/trustedbsd/mac/sys/kern/kern_prot.c#27 integrate
.. //depot/projects/trustedbsd/mac/sys/kern/syscalls.c#23 edit
.. //depot/projects/trustedbsd/mac/sys/sys/mac.h#140 integrate
.. //depot/projects/trustedbsd/mac/sys/sys/syscall.h#24 edit
.. //depot/projects/trustedbsd/mac/sys/sys/syscall.mk#24 edit
.. //depot/projects/trustedbsd/mac/sys/sys/sysproto.h#25 edit
Differences ...
==== //depot/projects/trustedbsd/mac/sys/fs/ntfs/ntfs_vnops.c#7 (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/mac/sys/kern/init_main.c#24 (text+ko) ====
@@ -39,7 +39,7 @@
* 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"
@@ -51,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>
@@ -369,6 +370,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. */
@@ -667,6 +671,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/mac/sys/kern/init_sysent.c#23 (text+ko) ====
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: src/sys/kern/syscalls.master,v 1.118 2002/07/30 16:50:25 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/mac/sys/kern/kern_prot.c#27 (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 $
*/
/*
@@ -1695,7 +1695,7 @@
cr->cr_mtxp = mtx_pool_find(cr);
#ifdef MAC
mac_init_cred(cr);
-#endif /* MAC */
+#endif
return (cr);
}
@@ -1742,7 +1742,7 @@
prison_free(cr->cr_prison);
#ifdef MAC
mac_destroy_cred(cr);
-#endif /* MAC */
+#endif
FREE(cr, M_CRED);
mtx_unlock(&Giant);
} else {
@@ -1779,7 +1779,7 @@
uihold(dest->cr_ruidinfo);
if (jailed(dest))
prison_hold(dest->cr_prison);
-#if MAC
+#ifdef MAC
mac_create_cred(src, dest);
#endif
}
==== //depot/projects/trustedbsd/mac/sys/kern/syscalls.c#23 (text+ko) ====
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: src/sys/kern/syscalls.master,v 1.118 2002/07/30 16:50:25 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/mac/sys/sys/mac.h#140 (text+ko) ====
@@ -34,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: $
+ * $FreeBSD: src/sys/sys/mac.h,v 1.2 2002/07/31 00:03:26 rwatson Exp $
*/
/*
* Userland/kernel interface for Mandatory Access Control.
==== //depot/projects/trustedbsd/mac/sys/sys/syscall.h#24 (text+ko) ====
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: src/sys/kern/syscalls.master,v 1.118 2002/07/30 16:50:25 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/mac/sys/sys/syscall.mk#24 (text+ko) ====
@@ -1,7 +1,7 @@
# FreeBSD system call names.
# DO NOT EDIT-- this file is automatically generated.
# $FreeBSD$
-# created from FreeBSD: src/sys/kern/syscalls.master,v 1.118 2002/07/30 16:50:25 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/mac/sys/sys/sysproto.h#25 (text+ko) ====
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: src/sys/kern/syscalls.master,v 1.118 2002/07/30 16:50:25 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_
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