Date: Sat, 26 Aug 2006 17:03:53 GMT From: Robert Watson <rwatson@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 105117 for review Message-ID: <200608261703.k7QH3rX8090599@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=105117 Change 105117 by rwatson@rwatson_zoo on 2006/08/26 17:03:44 Integrate TrustedBSD base from FreeBSD CVS, primarily to loop back the recent OpenBSM update in CVS: - OpenBSM 1.0a9. - cp -l - security/410.logincheck - restore chown fixes for short symlinks - More armage. - User thread library priority propagation - bluetooth updated for socket changes - Misc bug fixes, changes, etc. Affected files ... .. //depot/projects/trustedbsd/base/bin/cp/cp.1#11 integrate .. //depot/projects/trustedbsd/base/bin/cp/cp.c#18 integrate .. //depot/projects/trustedbsd/base/bin/cp/extern.h#10 integrate .. //depot/projects/trustedbsd/base/bin/cp/utils.c#16 integrate .. //depot/projects/trustedbsd/base/contrib/openbsm/FREEBSD-upgrade#5 integrate .. //depot/projects/trustedbsd/base/contrib/openbsm/HISTORY#4 integrate .. //depot/projects/trustedbsd/base/contrib/openbsm/README#5 integrate .. //depot/projects/trustedbsd/base/contrib/openbsm/VERSION#4 integrate .. //depot/projects/trustedbsd/base/contrib/openbsm/bin/auditd/auditd.c#5 integrate .. //depot/projects/trustedbsd/base/contrib/openbsm/bin/auditfilterd/auditfilterd.c#2 integrate .. //depot/projects/trustedbsd/base/contrib/openbsm/bin/auditfilterd/auditfilterd.h#2 integrate .. //depot/projects/trustedbsd/base/contrib/openbsm/bin/auditfilterd/auditfilterd_conf.c#2 integrate .. //depot/projects/trustedbsd/base/contrib/openbsm/bsm/audit.h#4 integrate .. //depot/projects/trustedbsd/base/contrib/openbsm/bsm/audit_filter.h#2 integrate .. //depot/projects/trustedbsd/base/contrib/openbsm/bsm/audit_internal.h#3 integrate .. //depot/projects/trustedbsd/base/contrib/openbsm/bsm/audit_kevents.h#3 integrate .. //depot/projects/trustedbsd/base/contrib/openbsm/bsm/audit_record.h#4 integrate .. //depot/projects/trustedbsd/base/contrib/openbsm/bsm/libbsm.h#6 integrate .. //depot/projects/trustedbsd/base/contrib/openbsm/config/config.h#3 integrate .. //depot/projects/trustedbsd/base/contrib/openbsm/config/config.h.in#3 integrate .. //depot/projects/trustedbsd/base/contrib/openbsm/configure#4 integrate .. //depot/projects/trustedbsd/base/contrib/openbsm/configure.ac#4 integrate .. //depot/projects/trustedbsd/base/contrib/openbsm/etc/audit_event#4 integrate .. //depot/projects/trustedbsd/base/contrib/openbsm/libbsm/au_token.3#3 integrate .. //depot/projects/trustedbsd/base/contrib/openbsm/libbsm/bsm_audit.c#4 integrate .. //depot/projects/trustedbsd/base/contrib/openbsm/libbsm/bsm_event.c#2 integrate .. //depot/projects/trustedbsd/base/contrib/openbsm/libbsm/bsm_io.c#4 integrate .. //depot/projects/trustedbsd/base/contrib/openbsm/libbsm/bsm_token.c#5 integrate .. //depot/projects/trustedbsd/base/contrib/openbsm/man/audit.log.5#3 integrate .. //depot/projects/trustedbsd/base/contrib/openbsm/modules/auditfilter_noop/auditfilter_noop.c#2 integrate .. //depot/projects/trustedbsd/base/contrib/openbsm/test/bsm/generate.c#3 integrate .. //depot/projects/trustedbsd/base/contrib/openbsm/tools/Makefile.am#2 integrate .. //depot/projects/trustedbsd/base/contrib/openbsm/tools/Makefile.in#2 integrate .. //depot/projects/trustedbsd/base/etc/defaults/periodic.conf#20 integrate .. //depot/projects/trustedbsd/base/etc/etc.alpha/ttys#4 delete .. //depot/projects/trustedbsd/base/etc/periodic/security/410.logincheck#1 branch .. //depot/projects/trustedbsd/base/etc/periodic/security/Makefile#6 integrate .. //depot/projects/trustedbsd/base/gnu/usr.bin/gdb/Makefile#3 integrate .. //depot/projects/trustedbsd/base/gnu/usr.bin/gdb/kgdb/kthr.c#4 integrate .. //depot/projects/trustedbsd/base/gnu/usr.bin/gdb/kgdb/trgt_powerpc.c#1 branch .. //depot/projects/trustedbsd/base/lib/libc/sys/kqueue.2#14 integrate .. //depot/projects/trustedbsd/base/release/doc/en_US.ISO8859-1/relnotes/common/new.sgml#108 integrate .. //depot/projects/trustedbsd/base/sbin/restore/tape.c#15 integrate .. //depot/projects/trustedbsd/base/share/man/man9/VFS_ROOT.9#6 integrate .. //depot/projects/trustedbsd/base/share/man/man9/ithread.9#6 integrate .. //depot/projects/trustedbsd/base/share/mk/bsd.lib.mk#30 integrate .. //depot/projects/trustedbsd/base/sys/amd64/linux32/linux32_machdep.c#9 integrate .. //depot/projects/trustedbsd/base/sys/arm/arm/busdma_machdep.c#12 integrate .. //depot/projects/trustedbsd/base/sys/arm/arm/cpufunc.c#7 integrate .. //depot/projects/trustedbsd/base/sys/arm/arm/elf_trampoline.c#6 integrate .. //depot/projects/trustedbsd/base/sys/arm/arm/identcpu.c#7 integrate .. //depot/projects/trustedbsd/base/sys/arm/at91/if_ate.c#9 integrate .. //depot/projects/trustedbsd/base/sys/arm/conf/EP80219#1 branch .. //depot/projects/trustedbsd/base/sys/arm/include/armreg.h#4 integrate .. //depot/projects/trustedbsd/base/sys/arm/include/cpuconf.h#6 integrate .. //depot/projects/trustedbsd/base/sys/arm/include/cpufunc.h#6 integrate .. //depot/projects/trustedbsd/base/sys/arm/include/elf.h#5 integrate .. //depot/projects/trustedbsd/base/sys/arm/include/vmparam.h#6 integrate .. //depot/projects/trustedbsd/base/sys/arm/xscale/i80321/ep80219_machdep.c#1 branch .. //depot/projects/trustedbsd/base/sys/arm/xscale/i80321/files.ep80219#1 branch .. //depot/projects/trustedbsd/base/sys/arm/xscale/i80321/files.i80219#1 branch .. //depot/projects/trustedbsd/base/sys/arm/xscale/i80321/i80321_intr.h#3 integrate .. //depot/projects/trustedbsd/base/sys/arm/xscale/i80321/i80321_pci.c#7 integrate .. //depot/projects/trustedbsd/base/sys/arm/xscale/i80321/i80321reg.h#3 integrate .. //depot/projects/trustedbsd/base/sys/arm/xscale/i80321/i80321var.h#4 integrate .. //depot/projects/trustedbsd/base/sys/arm/xscale/i80321/iq31244_machdep.c#12 integrate .. //depot/projects/trustedbsd/base/sys/arm/xscale/i80321/iq80321.c#10 integrate .. //depot/projects/trustedbsd/base/sys/arm/xscale/i80321/iq80321reg.h#3 integrate .. //depot/projects/trustedbsd/base/sys/arm/xscale/i80321/std.ep80219#1 branch .. //depot/projects/trustedbsd/base/sys/arm/xscale/i80321/std.i80219#1 branch .. //depot/projects/trustedbsd/base/sys/bsm/audit.h#5 integrate .. //depot/projects/trustedbsd/base/sys/bsm/audit_internal.h#3 integrate .. //depot/projects/trustedbsd/base/sys/bsm/audit_kevents.h#5 integrate .. //depot/projects/trustedbsd/base/sys/bsm/audit_record.h#4 integrate .. //depot/projects/trustedbsd/base/sys/compat/linux/linux_futex.c#3 integrate .. //depot/projects/trustedbsd/base/sys/compat/linux/linux_misc.c#45 integrate .. //depot/projects/trustedbsd/base/sys/conf/files.powerpc#24 integrate .. //depot/projects/trustedbsd/base/sys/conf/options.arm#12 integrate .. //depot/projects/trustedbsd/base/sys/dev/ata/ata-raid.c#39 integrate .. //depot/projects/trustedbsd/base/sys/dev/fb/creator.c#11 integrate .. //depot/projects/trustedbsd/base/sys/i386/linux/linux_machdep.c#23 integrate .. //depot/projects/trustedbsd/base/sys/ia64/include/vmparam.h#12 integrate .. //depot/projects/trustedbsd/base/sys/kern/init_main.c#44 integrate .. //depot/projects/trustedbsd/base/sys/kern/kern_thr.c#21 integrate .. //depot/projects/trustedbsd/base/sys/kern/kern_umtx.c#16 integrate .. //depot/projects/trustedbsd/base/sys/kern/sched_4bsd.c#27 integrate .. //depot/projects/trustedbsd/base/sys/kern/sched_core.c#3 integrate .. //depot/projects/trustedbsd/base/sys/kern/sched_ule.c#30 integrate .. //depot/projects/trustedbsd/base/sys/kern/subr_witness.c#58 integrate .. //depot/projects/trustedbsd/base/sys/kern/vfs_mount.c#51 integrate .. //depot/projects/trustedbsd/base/sys/net/if_bridge.c#15 integrate .. //depot/projects/trustedbsd/base/sys/net/if_ethersubr.c#50 integrate .. //depot/projects/trustedbsd/base/sys/net/if_vlan.c#39 integrate .. //depot/projects/trustedbsd/base/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c#18 integrate .. //depot/projects/trustedbsd/base/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c#15 integrate .. //depot/projects/trustedbsd/base/sys/powerpc/include/gdb_machdep.h#1 branch .. //depot/projects/trustedbsd/base/sys/powerpc/include/vmparam.h#3 integrate .. //depot/projects/trustedbsd/base/sys/powerpc/powerpc/gdb_machdep.c#1 branch .. //depot/projects/trustedbsd/base/sys/security/audit/audit_bsm.c#7 integrate .. //depot/projects/trustedbsd/base/sys/security/audit/audit_bsm_token.c#5 integrate .. //depot/projects/trustedbsd/base/sys/sys/kobj.h#6 integrate .. //depot/projects/trustedbsd/base/sys/sys/proc.h#76 integrate .. //depot/projects/trustedbsd/base/sys/sys/sched.h#13 integrate .. //depot/projects/trustedbsd/base/sys/sys/umtx.h#8 integrate .. //depot/projects/trustedbsd/base/sys/vm/vm_contig.c#31 integrate .. //depot/projects/trustedbsd/base/sys/vm/vm_page.h#33 integrate .. //depot/projects/trustedbsd/base/sys/vm/vm_pageq.c#21 integrate Differences ... ==== //depot/projects/trustedbsd/base/bin/cp/cp.1#11 (text+ko) ==== @@ -30,9 +30,9 @@ .\" SUCH DAMAGE. .\" .\" @(#)cp.1 8.3 (Berkeley) 4/18/94 -.\" $FreeBSD: src/bin/cp/cp.1,v 1.33 2005/02/25 00:40:46 trhodes Exp $ +.\" $FreeBSD: src/bin/cp/cp.1,v 1.35 2006/08/25 09:58:13 ru Exp $ .\" -.Dd February 23, 2005 +.Dd August 24, 2006 .Dt CP 1 .Os .Sh NAME @@ -45,7 +45,7 @@ .Op Fl H | Fl L | Fl P .Oc .Op Fl f | i | n -.Op Fl pv +.Op Fl lpv .Ar source_file target_file .Nm .Oo @@ -53,7 +53,7 @@ .Op Fl H | Fl L | Fl P .Oc .Op Fl f | i | n -.Op Fl pv +.Op Fl lpv .Ar source_file ... target_directory .Sh DESCRIPTION In the first synopsis form, the @@ -144,6 +144,8 @@ or .Fl n options.) +.It Fl l +Create hard links to regular files in a hierarchy instead of copying. .It Fl n Do not overwrite an existing file. (The ==== //depot/projects/trustedbsd/base/bin/cp/cp.c#18 (text+ko) ==== @@ -42,7 +42,7 @@ #endif /* not lint */ #endif #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/bin/cp/cp.c,v 1.53 2006/07/04 20:52:36 maxim Exp $"); +__FBSDID("$FreeBSD: src/bin/cp/cp.c,v 1.54 2006/08/24 20:45:38 julian Exp $"); /* * Cp copies source files to target files. @@ -83,7 +83,7 @@ PATH_T to = { to.p_path, emptystring, "" }; -int fflag, iflag, nflag, pflag, vflag; +int fflag, iflag, lflag, nflag, pflag, vflag; static int Rflag, rflag; volatile sig_atomic_t info; @@ -102,7 +102,7 @@ char *target; Hflag = Lflag = Pflag = 0; - while ((ch = getopt(argc, argv, "HLPRfinprv")) != -1) + while ((ch = getopt(argc, argv, "HLPRfinprvl")) != -1) switch (ch) { case 'H': Hflag = 1; @@ -140,6 +140,9 @@ case 'v': vflag = 1; break; + case 'l': + lflag = 1; + break; default: usage(); break; @@ -457,6 +460,9 @@ badcp = rval = 1; } break; + case S_IFSOCK: + warnx("%s is a socket (not copied).", + curr->fts_path); case S_IFIFO: if (Rflag) { if (copy_fifo(curr->fts_statp, !dne)) ==== //depot/projects/trustedbsd/base/bin/cp/extern.h#10 (text+ko) ==== @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * @(#)extern.h 8.2 (Berkeley) 4/1/94 - * $FreeBSD: src/bin/cp/extern.h,v 1.20 2005/09/05 04:36:08 csjp Exp $ + * $FreeBSD: src/bin/cp/extern.h,v 1.21 2006/08/24 20:45:38 julian Exp $ */ typedef struct { @@ -37,7 +37,7 @@ } PATH_T; extern PATH_T to; -extern int fflag, iflag, nflag, pflag, vflag; +extern int fflag, iflag, lflag, nflag, pflag, vflag; extern volatile sig_atomic_t info; __BEGIN_DECLS ==== //depot/projects/trustedbsd/base/bin/cp/utils.c#16 (text+ko) ==== @@ -33,7 +33,7 @@ #endif #endif /* not lint */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/bin/cp/utils.c,v 1.46 2005/09/05 04:36:08 csjp Exp $"); +__FBSDID("$FreeBSD: src/bin/cp/utils.c,v 1.49 2006/08/25 09:58:13 ru Exp $"); #include <sys/types.h> #include <sys/acl.h> @@ -61,7 +61,7 @@ { static char buf[MAXBSIZE]; struct stat *fs; - int ch, checkch, from_fd, rcount, rval, to_fd; + int ch, checkch, from_fd = 0, rcount, rval, to_fd = 0; ssize_t wcount; size_t wresid; size_t wtotal; @@ -109,15 +109,20 @@ /* remove existing destination file name, * create a new file */ (void)unlink(to.p_path); - to_fd = open(to.p_path, O_WRONLY | O_TRUNC | O_CREAT, - fs->st_mode & ~(S_ISUID | S_ISGID)); - } else - /* overwrite existing destination file name */ - to_fd = open(to.p_path, O_WRONLY | O_TRUNC, 0); - } else - to_fd = open(to.p_path, O_WRONLY | O_TRUNC | O_CREAT, - fs->st_mode & ~(S_ISUID | S_ISGID)); - + if (!lflag) + to_fd = open(to.p_path, O_WRONLY | O_TRUNC | O_CREAT, + fs->st_mode & ~(S_ISUID | S_ISGID)); + } else { + if (!lflag) + /* overwrite existing destination file name */ + to_fd = open(to.p_path, O_WRONLY | O_TRUNC, 0); + } + } else { + if (!lflag) + to_fd = open(to.p_path, O_WRONLY | O_TRUNC | O_CREAT, + fs->st_mode & ~(S_ISUID | S_ISGID)); + } + if (to_fd == -1) { warn("%s", to.p_path); (void)close(from_fd); @@ -126,77 +131,85 @@ rval = 0; - /* - * Mmap and write if less than 8M (the limit is so we don't totally - * trash memory on big files. This is really a minor hack, but it - * wins some CPU back. - */ + if (!lflag) { + /* + * Mmap and write if less than 8M (the limit is so we don't totally + * trash memory on big files. This is really a minor hack, but it + * wins some CPU back. + */ #ifdef VM_AND_BUFFER_CACHE_SYNCHRONIZED - if (S_ISREG(fs->st_mode) && fs->st_size > 0 && - fs->st_size <= 8 * 1048576) { - if ((p = mmap(NULL, (size_t)fs->st_size, PROT_READ, - MAP_SHARED, from_fd, (off_t)0)) == MAP_FAILED) { - warn("%s", entp->fts_path); - rval = 1; - } else { - wtotal = 0; - for (bufp = p, wresid = fs->st_size; ; - bufp += wcount, wresid -= (size_t)wcount) { - wcount = write(to_fd, bufp, wresid); - wtotal += wcount; - if (info) { - info = 0; - (void)fprintf(stderr, - "%s -> %s %3d%%\n", - entp->fts_path, to.p_path, - cp_pct(wtotal, fs->st_size)); - - } - if (wcount >= (ssize_t)wresid || wcount <= 0) - break; - } - if (wcount != (ssize_t)wresid) { - warn("%s", to.p_path); - rval = 1; - } - /* Some systems don't unmap on close(2). */ - if (munmap(p, fs->st_size) < 0) { + if (S_ISREG(fs->st_mode) && fs->st_size > 0 && + fs->st_size <= 8 * 1048576) { + if ((p = mmap(NULL, (size_t)fs->st_size, PROT_READ, + MAP_SHARED, from_fd, (off_t)0)) == MAP_FAILED) { warn("%s", entp->fts_path); rval = 1; + } else { + wtotal = 0; + for (bufp = p, wresid = fs->st_size; ; + bufp += wcount, wresid -= (size_t)wcount) { + wcount = write(to_fd, bufp, wresid); + wtotal += wcount; + if (info) { + info = 0; + (void)fprintf(stderr, + "%s -> %s %3d%%\n", + entp->fts_path, to.p_path, + cp_pct(wtotal, fs->st_size)); + + } + if (wcount >= (ssize_t)wresid || wcount <= 0) + break; + } + if (wcount != (ssize_t)wresid) { + warn("%s", to.p_path); + rval = 1; + } + /* Some systems don't unmap on close(2). */ + if (munmap(p, fs->st_size) < 0) { + warn("%s", entp->fts_path); + rval = 1; + } } - } - } else + } else #endif - { - wtotal = 0; - while ((rcount = read(from_fd, buf, MAXBSIZE)) > 0) { - for (bufp = buf, wresid = rcount; ; - bufp += wcount, wresid -= wcount) { - wcount = write(to_fd, bufp, wresid); - wtotal += wcount; - if (info) { - info = 0; - (void)fprintf(stderr, - "%s -> %s %3d%%\n", - entp->fts_path, to.p_path, - cp_pct(wtotal, fs->st_size)); - + { + wtotal = 0; + while ((rcount = read(from_fd, buf, MAXBSIZE)) > 0) { + for (bufp = buf, wresid = rcount; ; + bufp += wcount, wresid -= wcount) { + wcount = write(to_fd, bufp, wresid); + wtotal += wcount; + if (info) { + info = 0; + (void)fprintf(stderr, + "%s -> %s %3d%%\n", + entp->fts_path, to.p_path, + cp_pct(wtotal, fs->st_size)); + + } + if (wcount >= (ssize_t)wresid || wcount <= 0) + break; } - if (wcount >= (ssize_t)wresid || wcount <= 0) + if (wcount != (ssize_t)wresid) { + warn("%s", to.p_path); + rval = 1; break; + } } - if (wcount != (ssize_t)wresid) { - warn("%s", to.p_path); + if (rcount < 0) { + warn("%s", entp->fts_path); rval = 1; - break; } } - if (rcount < 0) { - warn("%s", entp->fts_path); + } else { + if (link(entp->fts_path, to.p_path)) { + warn("%s", to.p_path); rval = 1; } } - + (void)close(from_fd); + /* * Don't remove the target even after an error. The target might * not be a regular file, or its attributes might be important, @@ -204,14 +217,16 @@ * to remove it if we created it and its length is 0. */ - if (pflag && setfile(fs, to_fd)) - rval = 1; - if (pflag && preserve_fd_acls(from_fd, to_fd) != 0) - rval = 1; - (void)close(from_fd); - if (close(to_fd)) { - warn("%s", to.p_path); - rval = 1; + if (!lflag) { + if (pflag && setfile(fs, to_fd)) + rval = 1; + if (pflag && preserve_fd_acls(from_fd, to_fd) != 0) + rval = 1; + (void)close(from_fd); + if (close(to_fd)) { + warn("%s", to.p_path); + rval = 1; + } } return (rval); } @@ -411,8 +426,8 @@ { (void)fprintf(stderr, "%s\n%s\n", -"usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] source_file target_file", -" cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] source_file ... " +"usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-lpv] source_file target_file", +" cp [-R [-H | -L | -P]] [-f | -i | -n] [-lpv] source_file ... " "target_directory"); exit(EX_USAGE); } ==== //depot/projects/trustedbsd/base/contrib/openbsm/FREEBSD-upgrade#5 (text) ==== @@ -23,7 +23,7 @@ - Run configure, commit src/contrib/openbsm/config/config.h. - Replication of src/contrib/openbsm/bsm changes into src/sys/bsm. - Possible updates to src/sys/security/audit, especially relating to - bsm_token.c. + audit_bsm_token.c. - Update any library, tool, or etc BSD Makefiles to add new files, defines, or other generally useful or necessary things. @@ -39,6 +39,10 @@ Propagation of changes to src/sys/{bsm,security/audit} is something that requires careful coordination and attention to detail. These files are not on CVS vendor branches, but do have the same local vs. vendor merge -issues. +issues. Remember that contrib/openbsm (and the rest of the system) will +be built with the version of the bsm/ include files in src/sys/bsm, not +the version in contrib/openbsm/bsm, so buildworld tests before committing +are necessary, and the commits to various parts of the system must be +made in close succession. -$FreeBSD: src/contrib/openbsm/FREEBSD-upgrade,v 1.5 2006/06/27 17:55:38 rwatson Exp $ +$FreeBSD: src/contrib/openbsm/FREEBSD-upgrade,v 1.6 2006/08/26 10:35:54 rwatson Exp $ ==== //depot/projects/trustedbsd/base/contrib/openbsm/HISTORY#4 (text) ==== @@ -1,3 +1,31 @@ +OpenBSM 1.0 alpha 9 + +- Rename many OpenBSM-specific constants and API elements containing the + strings "BSM" and "bsm" to "AUDIT" and "audit", observing that this is true + for almost all existing constants and APIs. +- Instead of passing a per-instance cookie directly into all audit filter + APIs, pass in the audit filter daemon state pointer, which is then used by + the module using an audit_filter_{get,set}cookie() API. This will allow + future service APIs provided by the filter daemon to maintain their own + state -- for example, per-module preselection state. + +OpenBSM 1.0 alpha 8 + +- Correct typo in definition of AUR_INT. +- Adopt OpenSolaris constant values for AUDIT_* configuration flags. +- Arguments to au_to_exec_args() and au_to_exec_env() no longer const. +- Add kernel versions of au_to_exec_args() and au_to_exec_env(). +- Fix exec argument type that is printed for env strings from 'arg' to 'env'. +- New OpenBSM token version number assigned, constants added for other + commonly seen version numbers. +- OpenBSM-specific events assigned numbers in the 43xxx range to avoid future + collisions with Solaris. Darwin events renamed to AUE_DARWIN_foo, as they + are now deprecated numberings. +- autoconf now detects clock_gettime(), which is not available on Darwin. +- praudit output fixes relating to arg32 and arg64 tokens. +- Maximum record size updated to 64k-1 to match Solaris record size limit. +- Various style and comment cleanups in include files. + OpenBSM 1.0 alpha 7 - Adopted Solaris-compatible format for subject32_ex and subject64_ex @@ -175,4 +203,4 @@ to support reloading of kernel event table. - Allow comments in /etc/security configuration files. -$P4: //depot/projects/trustedbsd/openbsm/HISTORY#15 $ +$P4: //depot/projects/trustedbsd/openbsm/HISTORY#25 $ ==== //depot/projects/trustedbsd/base/contrib/openbsm/README#5 (text) ==== @@ -74,6 +74,8 @@ Olivier Houchard Christian Peron Martin Fong + Pawel Worach + Martin Englund In addition, Coverity, Inc.'s Prevent(tm) static analysis tool and Gimpel Software's FlexeLint tool were used to identify a number of bugs in the @@ -95,4 +97,4 @@ http://www.TrustedBSD.org/ -$P4: //depot/projects/trustedbsd/openbsm/README#17 $ +$P4: //depot/projects/trustedbsd/openbsm/README#19 $ ==== //depot/projects/trustedbsd/base/contrib/openbsm/VERSION#4 (text) ==== @@ -1,1 +1,1 @@ -OPENBSM_1_0_ALPHA_7 +OPENBSM_1_0_ALPHA_9 ==== //depot/projects/trustedbsd/base/contrib/openbsm/bin/auditd/auditd.c#5 (text) ==== @@ -30,7 +30,7 @@ * * @APPLE_BSD_LICENSE_HEADER_END@ * - * $P4: //depot/projects/trustedbsd/openbsm/bin/auditd/auditd.c#16 $ + * $P4: //depot/projects/trustedbsd/openbsm/bin/auditd/auditd.c#17 $ */ #include <sys/types.h> @@ -88,7 +88,7 @@ * Free our local list of directory names. */ static void -free_dir_q() +free_dir_q(void) { struct dir_ent *dirent; ==== //depot/projects/trustedbsd/base/contrib/openbsm/bin/auditfilterd/auditfilterd.c#2 (text) ==== @@ -25,7 +25,16 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $P4: //depot/projects/trustedbsd/openbsm/bin/auditfilterd/auditfilterd.c#6 $ + * $P4: //depot/projects/trustedbsd/openbsm/bin/auditfilterd/auditfilterd.c#9 $ + */ + +/* + * Main file for the audit filter daemon, which presents audit records to a + * set of run-time registered loadable modules. This is the main event loop + * of the daemon, which handles starting up, waiting for records, and + * presenting records to configured modules. auditfilterd_conf.c handles the + * reading and management of the configuration, module list and module state, + * etc. */ #include <sys/types.h> @@ -106,13 +115,13 @@ * Present raw BSM to a set of registered and interested filters. */ static void -present_bsmrecord(struct timespec *ts, u_char *data, u_int len) +present_rawrecord(struct timespec *ts, u_char *data, u_int len) { struct auditfilter_module *am; TAILQ_FOREACH(am, &filter_list, am_list) { - if (am->am_bsmrecord != NULL) - (am->am_bsmrecord)(am->am_instance, ts, data, len); + if (am->am_rawrecord != NULL) + (am->am_rawrecord)(am, ts, data, len); } } @@ -140,8 +149,7 @@ TAILQ_FOREACH(am, &filter_list, am_list) { if (am->am_record != NULL) - (am->am_record)(am->am_instance, ts, tokencount, - tokens); + (am->am_record)(am, ts, tokencount, tokens); } } @@ -191,7 +199,7 @@ continue; if (clock_gettime(CLOCK_REALTIME, &ts) < 0) err(-1, "clock_gettime"); - present_bsmrecord(&ts, buf, reclen); + present_rawrecord(&ts, buf, reclen); present_tokens(&ts, buf, reclen); free(buf); } @@ -241,7 +249,7 @@ continue; if (clock_gettime(CLOCK_REALTIME, &ts) < 0) err(-1, "clock_gettime"); - present_bsmrecord(&ts, record, reclen); + present_rawrecord(&ts, record, reclen); present_tokens(&ts, record, reclen); } } ==== //depot/projects/trustedbsd/base/contrib/openbsm/bin/auditfilterd/auditfilterd.h#2 (text) ==== @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $P4: //depot/projects/trustedbsd/openbsm/bin/auditfilterd/auditfilterd.h#3 $ + * $P4: //depot/projects/trustedbsd/openbsm/bin/auditfilterd/auditfilterd.h#5 $ */ #define AUDITFILTERD_CONFFILE "/etc/security/audit_filter" @@ -53,11 +53,11 @@ /* * Fields provided by or extracted from the module. */ - void *am_instance; + void *am_cookie; audit_filter_attach_t am_attach; audit_filter_reinit_t am_reinit; audit_filter_record_t am_record; - audit_filter_bsmrecord_t am_bsmrecord; + audit_filter_rawrecord_t am_rawrecord; audit_filter_detach_t am_detach; /* ==== //depot/projects/trustedbsd/base/contrib/openbsm/bin/auditfilterd/auditfilterd_conf.c#2 (text) ==== @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $P4: //depot/projects/trustedbsd/openbsm/bin/auditfilterd/auditfilterd_conf.c#3 $ + * $P4: //depot/projects/trustedbsd/openbsm/bin/auditfilterd/auditfilterd_conf.c#5 $ */ /* @@ -38,6 +38,12 @@ * Modules are in one of two states: attached, or detached. If attach fails, * detach is not called because it was not attached. If a module is attached * and a call to its reinit method fails, we will detach it. + * + * Modules are passed a (void *) reference to their configuration state so + * that they may pass this into any common APIs we provide which may rely on + * that state. Currently, the only such API is the cookie API, which allows + * per-instance state to be maintained by a module. In the future, this will + * also be used to support per-instance preselection state. */ #include <sys/types.h> @@ -105,8 +111,8 @@ { if (am->am_detach != NULL) - am->am_detach(am->am_instance); - am->am_instance = NULL; + am->am_detach(am); + am->am_cookie = NULL; (void)dlclose(am->am_dlhandle); am->am_dlhandle = NULL; } @@ -149,21 +155,22 @@ am->am_attach = dlsym(am->am_dlhandle, AUDIT_FILTER_ATTACH_STRING); am->am_reinit = dlsym(am->am_dlhandle, AUDIT_FILTER_REINIT_STRING); am->am_record = dlsym(am->am_dlhandle, AUDIT_FILTER_RECORD_STRING); - am->am_bsmrecord = dlsym(am->am_dlhandle, - AUDIT_FILTER_BSMRECORD_STRING); + am->am_rawrecord = dlsym(am->am_dlhandle, + AUDIT_FILTER_RAWRECORD_STRING); am->am_detach = dlsym(am->am_dlhandle, AUDIT_FILTER_DETACH_STRING); if (am->am_attach != NULL) { - if (am->am_attach(&am->am_instance, am->am_argc, am->am_argv) + if (am->am_attach(am, am->am_argc, am->am_argv) != AUDIT_FILTER_SUCCESS) { warnx("auditfilter_module_attach: %s: failed", am->am_modulename); dlclose(am->am_dlhandle); am->am_dlhandle = NULL; + am->am_cookie = NULL; am->am_attach = NULL; am->am_reinit = NULL; am->am_record = NULL; - am->am_bsmrecord = NULL; + am->am_rawrecord = NULL; am->am_detach = NULL; return (-1); } @@ -184,7 +191,7 @@ if (am->am_reinit == NULL) return (0); - if (am->am_reinit(&am->am_instance, am->am_argc, am->am_argv) != + if (am->am_reinit(am, am->am_argc, am->am_argv) != AUDIT_FILTER_SUCCESS) { warnx("auditfilter_module_reinit: %s: failed", am->am_modulename); @@ -483,3 +490,24 @@ auditfilter_module_list_detach(&filter_list); auditfilter_module_list_free(&filter_list); } + +/* + * APIs to allow modules to query and set their per-instance cookie. + */ +void +audit_filter_getcookie(void *instance, void **cookie) +{ + struct auditfilter_module *am; + + am = (struct auditfilter_module *)instance; + *cookie = am->am_cookie; +} + +void +audit_filter_setcookie(void *instance, void *cookie) +{ + struct auditfilter_module *am; + + am = (struct auditfilter_module *)instance; + am->am_cookie = cookie; +} ==== //depot/projects/trustedbsd/base/contrib/openbsm/bsm/audit.h#4 (text) ==== @@ -30,7 +30,7 @@ * * @APPLE_BSD_LICENSE_HEADER_END@ * - * $P4: //depot/projects/trustedbsd/openbsm/bsm/audit.h#16 $ + * $P4: //depot/projects/trustedbsd/openbsm/bsm/audit.h#19 $ */ #ifndef _BSM_AUDIT_H @@ -38,11 +38,12 @@ #define AUDIT_RECORD_MAGIC 0x828a0f1b #define MAX_AUDIT_RECORDS 20 -#define MAX_AUDIT_RECORD_SIZE 4096 +#define MAXAUDITDATA (0x8000 - 1) +#define MAX_AUDIT_RECORD_SIZE MAXAUDITDATA #define MIN_AUDIT_FILE_SIZE (512 * 1024) /* - * Triggers for the audit daemon + * Triggers for the audit daemon. */ #define AUDIT_TRIGGER_MIN 1 #define AUDIT_TRIGGER_LOW_SPACE 1 @@ -53,7 +54,8 @@ #define AUDIT_TRIGGER_MAX 5 /* - * File that will be read for trigger events from the kernel + * Special file that will be read for trigger events from the kernel + * (FreeBSD). */ #define AUDIT_TRIGGER_FILE "/dev/audit" @@ -101,7 +103,7 @@ #define AU_ALL 0xffffffff /* - * IPC types + * IPC types. */ #define AT_IPC_MSG ((u_char)1) /* Message IPC id. */ #define AT_IPC_SEM ((u_char)2) /* Semaphore IPC id. */ @@ -150,16 +152,19 @@ #define AUDIT_AHLT 0x0002 #define AUDIT_ARGV 0x0004 #define AUDIT_ARGE 0x0008 -#define AUDIT_PASSWD 0x0010 -#define AUDIT_SEQ 0x0020 -#define AUDIT_WINDATA 0x0040 -#define AUDIT_USER 0x0080 -#define AUDIT_GROUP 0x0100 -#define AUDIT_TRAIL 0x0200 -#define AUDIT_PATH 0x0400 +#define AUDIT_SEQ 0x0010 +#define AUDIT_WINDATA 0x0020 +#define AUDIT_USER 0x0040 +#define AUDIT_GROUP 0x0080 +#define AUDIT_TRAIL 0x0100 +#define AUDIT_PATH 0x0200 +#define AUDIT_SCNT 0x0400 +#define AUDIT_PUBLIC 0x0800 +#define AUDIT_ZONENAME 0x1000 +#define AUDIT_PERZONE 0x2000 /* - * Audit queue control parameters + * Audit queue control parameters. */ #define AQ_HIWATER 100 #define AQ_MAXHIGH 10000 ==== //depot/projects/trustedbsd/base/contrib/openbsm/bsm/audit_filter.h#2 (text) ==== @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $P4: //depot/projects/trustedbsd/openbsm/bsm/audit_filter.h#2 $ + * $P4: //depot/projects/trustedbsd/openbsm/bsm/audit_filter.h#4 $ */ #ifndef _BSM_AUDIT_FILTER_H_ @@ -38,22 +38,28 @@ * audit_filter_reinit_t - arguments to module have changed * audit_filter_record_t - present parsed record to filter module, with * receipt time - * audit_filter_bsmrecord_t - present bsm format record to filter module, + * audit_filter_rawrecord_t - present BSM format record to filter module, * with receipt time * audit_filter_destach_t - filter module is being detached * * There may be many instances of the same filter, identified by the instance * void pointer maintained by the filter instance. */ -typedef int (*audit_filter_attach_t)(void **instance, int argc, char *argv[]); +typedef int (*audit_filter_attach_t)(void *instance, int argc, char *argv[]); typedef int (*audit_filter_reinit_t)(void *instance, int argc, char *argv[]); typedef void (*audit_filter_record_t)(void *instance, struct timespec *ts, int token_count, const tokenstr_t tok[]); -typedef void (*audit_filter_bsmrecord_t)(void *instance, struct timespec *ts, +typedef void (*audit_filter_rawrecord_t)(void *instance, struct timespec *ts, void *data, u_int len); typedef void (*audit_filter_detach_t)(void *instance); /* + * APIs that may be called by audit filters. + */ +void audit_filter_getcookie(void *instance, void **cookie); +void audit_filter_setcookie(void *instance, void *cookie); + +/* * Values to be returned by audit_filter_init_t. */ #define AUDIT_FILTER_SUCCESS (0) @@ -66,12 +72,12 @@ #define AUDIT_FILTER_ATTACH audit_filter_attach #define AUDIT_FILTER_REINIT audit_filter_reinit #define AUDIT_FILTER_RECORD audit_filter_record -#define AUDIT_FILTER_BSMRECORD audit_filter_bsmrecord +#define AUDIT_FILTER_RAWRECORD audit_filter_rawrecord #define AUDIT_FILTER_DETACH audit_filter_detach #define AUDIT_FILTER_ATTACH_STRING "audit_filter_attach" #define AUDIT_FILTER_REINIT_STRING "audit_filter_reinit" #define AUDIT_FILTER_RECORD_STRING "audit_filter_record" -#define AUDIT_FILTER_BSMRECORD_STRING "audit_filter_bsmrecord" +#define AUDIT_FILTER_RAWRECORD_STRING "audit_filter_rawrecord" #define AUDIT_FILTER_DETACH_STRING "audit_filter_detach" #endif /* !_BSM_AUDIT_FILTER_H_ */ ==== //depot/projects/trustedbsd/base/contrib/openbsm/bsm/audit_internal.h#3 (text) ==== @@ -34,7 +34,7 @@ * * @APPLE_BSD_LICENSE_HEADER_END@ * - * $P4: //depot/projects/trustedbsd/openbsm/bsm/audit_internal.h#13 $ + * $P4: //depot/projects/trustedbsd/openbsm/bsm/audit_internal.h#14 $ */ #ifndef _AUDIT_INTERNAL_H @@ -68,15 +68,15 @@ typedef struct au_record au_record_t; -/* We could determined the header and trailer sizes by - * defining appropriate structures. We hold off that approach - * till we have a consistant way of using structures for all tokens. - * This is not straightforward since these token structures may - * contain pointers of whose contents we dont know the size - * (e.g text tokens) +/* + * We could determined the header and trailer sizes by defining appropriate + * structures. We hold off that approach until we have a consistant way of + * using structures for all tokens. This is not straightforward since these + * token structures may contain pointers of whose contents we dont know the + * size (e.g text tokens). */ -#define BSM_HEADER_SIZE 18 -#define BSM_TRAILER_SIZE 7 +#define AUDIT_HEADER_SIZE 18 +#define AUDIT_TRAILER_SIZE 7 /* * BSM token streams store fields in big endian byte order, so as to be ==== //depot/projects/trustedbsd/base/contrib/openbsm/bsm/audit_kevents.h#3 (text) ==== @@ -30,7 +30,7 @@ * * @APPLE_BSD_LICENSE_HEADER_END@ * - * $P4: //depot/projects/trustedbsd/openbsm/bsm/audit_kevents.h#38 $ + * $P4: //depot/projects/trustedbsd/openbsm/bsm/audit_kevents.h#40 $ */ #ifndef _BSM_AUDIT_KEVENTS_H_ @@ -273,134 +273,200 @@ #define AUE_NTP_ADJTIME 288 /* - * Events not present in OpenSolaris BSM, generally derived from Apple Darwin - * BSM or added in OpenBSM. This start a little too close to the top end of - * the OpenSolaris event list for my comfort. + * Events added for Apple Darwin that potentially collide with future Solaris + * BSM events. These are assigned AUE_DARWIN prefixes, and are deprecated in + * new trails. Systems generating these events should switch to the new + * identifiers that avoid colliding with the Solaris identifier space. */ -#define AUE_GETFSSTAT 301 -#define AUE_PTRACE 302 -#define AUE_CHFLAGS 303 -#define AUE_FCHFLAGS 304 -#define AUE_PROFILE 305 -#define AUE_KTRACE 306 -#define AUE_SETLOGIN 307 +#define AUE_DARWIN_GETFSSTAT 301 +#define AUE_DARWIN_PTRACE 302 +#define AUE_DARWIN_CHFLAGS 303 +#define AUE_DARWIN_FCHFLAGS 304 +#define AUE_DARWIN_PROFILE 305 +#define AUE_DARWIN_KTRACE 306 +#define AUE_DARWIN_SETLOGIN 307 #define AUE_DARWIN_REBOOT 308 /* XXX: See AUE_REBOOT. */ -#define AUE_REVOKE 309 -#define AUE_UMASK 310 -#define AUE_MPROTECT 311 +#define AUE_DARWIN_REVOKE 309 +#define AUE_DARWIN_UMASK 310 +#define AUE_DARWIN_MPROTECT 311 #define AUE_DARWIN_SETPRIORITY 312 /* XXX: See AUE_SETPRIORITY. */ #define AUE_DARWIN_SETTIMEOFDAY 313 /* XXX: See AUE_SETTIMEOFDAY. */ #define AUE_DARWIN_FLOCK 314 /* XXX: See AUE_FLOCK. */ -#define AUE_MKFIFO 315 -#define AUE_POLL 316 +#define AUE_DARWIN_MKFIFO 315 +#define AUE_DARWIN_POLL 316 #define AUE_DARWIN_SOCKETPAIR 317 /* XXXRW: See AUE_SOCKETPAIR. */ -#define AUE_FUTIMES 318 -#define AUE_SETSID 319 -#define AUE_SETPRIVEXEC 320 /* Darwin-specific. */ +#define AUE_DARWIN_FUTIMES 318 +#define AUE_DARWIN_SETSID 319 +#define AUE_DARWIN_SETPRIVEXEC 320 /* Darwin-specific. */ #define AUE_DARWIN_NFSSVC 321 /* XXX: See AUE_NFS_SVC. */ #define AUE_DARWIN_GETFH 322 /* XXX: See AUE_NFS_GETFH. */ #define AUE_DARWIN_QUOTACTL 323 /* XXX: See AUE_QUOTACTL. */ -#define AUE_ADDPROFILE 324 /* Darwin-specific. */ >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200608261703.k7QH3rX8090599>