From owner-freebsd-current@FreeBSD.ORG Mon Nov 6 14:13:57 2006 Return-Path: X-Original-To: current@FreeBSD.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D935016A47E for ; Mon, 6 Nov 2006 14:13:57 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [209.31.154.42]) by mx1.FreeBSD.org (Postfix) with ESMTP id E60D243D82 for ; Mon, 6 Nov 2006 14:13:46 +0000 (GMT) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [209.31.154.41]) by cyrus.watson.org (Postfix) with ESMTP id 3784C46BF8 for ; Mon, 6 Nov 2006 09:13:46 -0500 (EST) Date: Mon, 6 Nov 2006 14:13:46 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: current@FreeBSD.org Message-ID: <20061106141332.A28593@fledge.watson.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Subject: Heads up: priv(9) committed X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Nov 2006 14:13:58 -0000 Dear all, I've just committed support for the priv(9) kernel API to the CVS HEAD. Per the commit message below, this is a revised interface for checking privilege within the kernel. In principle, there should be little actual functional change with this commit (although in one case, an IPSEC-related check moves from being permitted in Jail to not being permitted in Jail), but this will facilitate future work. I've now started the post-commit builds. Please let me know (ideally with a CC to current@) if you start running into odd permissions problems -- either things that are no longer permitted that should be, or things that are now permitted that should not be! Thanks, Robert N M Watson Computer Laboratory University of Cambridge ---------- Forwarded message ---------- Date: Mon, 6 Nov 2006 13:37:19 +0000 (UTC) From: Robert Watson To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/sys/kern kern_jail.c kern_priv.c kern_prot.c src/sys/security/mac mac_framework.h mac_internal.h mac_priv.c src/sys/sys jail.h priv.h systm.h src/sys/conf files src/share/man/man9 Makefile priv.9 suser.9 rwatson 2006-11-06 13:37:19 UTC FreeBSD src repository Modified files: sys/kern kern_jail.c kern_prot.c sys/security/mac mac_framework.h mac_internal.h sys/sys jail.h systm.h sys/conf files share/man/man9 Makefile suser.9 Added files: sys/kern kern_priv.c sys/security/mac mac_priv.c sys/sys priv.h share/man/man9 priv.9 Log: Add a new priv(9) kernel interface for checking the availability of privilege for threads and credentials. Unlike the existing suser(9) interface, priv(9) exposes a named privilege identifier to the privilege checking code, allowing more complex policies regarding the granting of privilege to be expressed. Two interfaces are provided, replacing the existing suser(9) interface: suser(td) -> priv_check(td, priv) suser_cred(cred, flags) -> priv_check_cred(cred, priv, flags) A comprehensive list of currently available kernel privileges may be found in priv.h. New privileges are easily added as required, but the comments on adding privileges found in priv.h and priv(9) should be read before doing so. The new privilege interface exposed sufficient information to the privilege checking routine that it will now be possible for jail to determine whether a particular privilege is granted in the check routine, rather than relying on hints from the calling context via the SUSER_ALLOWJAIL flag. For now, the flag is maintained, but a new jail check function, prison_priv_check(), is exposed from kern_jail.c and used by the privilege check routine to determine if the privilege is permitted in jail. As a result, a centralized list of privileges permitted in jail is now present in kern_jail.c. The MAC Framework is now also able to instrument privilege checks, both to deny privileges otherwise granted (mac_priv_check()), and to grant privileges otherwise denied (mac_priv_grant()), permitting MAC Policy modules to implement privilege models, as well as control a much broader range of system behavior in order to constrain processes running with root privilege. The suser() and suser_cred() functions remain implemented, now in terms of priv_check() and the PRIV_ROOT privilege, for use during the transition and possibly continuing use by third party kernel modules that have not been updated. The PRIV_DRIVER privilege exists to allow device drivers to check privilege without adopting a more specific privilege identifier. This change does not modify the actual security policy, rather, it modifies the interface for privilege checks so changes to the security policy become more feasible. Sponsored by: nCircle Network Security, Inc. Obtained from: TrustedBSD Project Discussed on: arch@ Reviewed (at least in part) by: mlaier, jmg, pjd, bde, ceri, Alex Lyashkov , Skip Ford , Antoine Brodin Revision Changes Path 1.283 +1 -0 src/share/man/man9/Makefile 1.1 +115 -0 src/share/man/man9/priv.9 (new) 1.30 +8 -1 src/share/man/man9/suser.9 1.1160 +2 -0 src/sys/conf/files 1.54 +168 -1 src/sys/kern/kern_jail.c 1.1 +154 -0 src/sys/kern/kern_priv.c (new) 1.206 +58 -89 src/sys/kern/kern_prot.c 1.75 +2 -0 src/sys/security/mac/mac_framework.h 1.115 +34 -0 src/sys/security/mac/mac_internal.h 1.1 +64 -0 src/sys/security/mac/mac_priv.c (new) 1.27 +1 -0 src/sys/sys/jail.h 1.1 +457 -0 src/sys/sys/priv.h (new) 1.246 +1 -1 src/sys/sys/systm.h ---------- Forwarded message ---------- Date: Mon, 6 Nov 2006 13:42:10 +0000 (UTC) From: Robert Watson To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/sys/amd64/amd64 io.c src/sys/compat/linux linux_misc.c linux_uid16.c src/sys/compat/svr4 svr4_fcntl.c svr4_misc.c src/sys/contrib/altq/altq altq_cbq.c altq_cdnr.c altq_hfsc.c altq_priq.c altq_red.c altq_rio.c ... rwatson 2006-11-06 13:42:10 UTC FreeBSD src repository Modified files: sys/amd64/amd64 io.c sys/compat/linux linux_misc.c linux_uid16.c sys/compat/svr4 svr4_fcntl.c svr4_misc.c sys/contrib/altq/altq altq_cbq.c altq_cdnr.c altq_hfsc.c altq_priq.c altq_red.c altq_rio.c sys/contrib/pf/net if_pfsync.c sys/dev/an if_an.c sys/dev/arl if_arl.c sys/dev/asr asr.c sys/dev/ata atapi-cd.c sys/dev/ce if_ce.c sys/dev/cnw if_cnw.c sys/dev/cp if_cp.c sys/dev/ctau if_ct.c sys/dev/cx if_cx.c sys/dev/dcons dcons_os.c sys/dev/drm drmP.h sys/dev/fdc fdc.c sys/dev/hwpmc hwpmc_mod.c sys/dev/if_ndis if_ndis.c sys/dev/kbd kbd.c sys/dev/lmc if_lmc.c if_lmc.h sys/dev/nmdm nmdm.c sys/dev/null null.c sys/dev/ofw ofw_console.c sys/dev/random randomdev.c sys/dev/sbni if_sbni.c sys/dev/sbsh if_sbsh.c sys/dev/si si.c sys/dev/syscons syscons.c sysmouse.c sys/dev/wi if_wi.c sys/dev/wl if_wl.c sys/dev/zs zs.c sys/fs/devfs devfs_rule.c devfs_vnops.c sys/fs/hpfs hpfs_vnops.c sys/fs/msdosfs msdosfs_vfsops.c msdosfs_vnops.c sys/fs/procfs procfs_ioctl.c sys/fs/smbfs smbfs_vnops.c sys/fs/udf udf_vfsops.c sys/fs/umapfs umap_vfsops.c sys/gnu/fs/ext2fs ext2_vfsops.c ext2_vnops.c sys/gnu/fs/reiserfs reiserfs_fs.h reiserfs_vfsops.c sys/gnu/fs/xfs/FreeBSD xfs_super.c sys/i386/i386 io.c sys_machdep.c vm86.c sys/i386/ibcs2 ibcs2_misc.c ibcs2_socksys.c ibcs2_sysi86.c sys/i386/linux linux_machdep.c sys/i4b/driver i4b_ipr.c sys/ia64/ia64 ssc.c sys/isofs/cd9660 cd9660_vfsops.c sys/kern kern_acct.c kern_descrip.c kern_environment.c kern_exec.c kern_fork.c kern_ktrace.c kern_linker.c kern_ntptime.c kern_resource.c kern_shutdown.c kern_sysctl.c kern_thr.c kern_time.c kern_umtx.c kern_xxx.c subr_acl_posix1e.c subr_firmware.c subr_prf.c subr_witness.c sysv_ipc.c sysv_msg.c tty.c tty_cons.c tty_pts.c tty_pty.c uipc_mqueue.c uipc_sem.c vfs_mount.c vfs_subr.c vfs_syscalls.c vfs_vnops.c sys/net bpf.c if.c if_bridge.c if_gre.c if_ppp.c if_sl.c if_tap.c if_tun.c ppp_tty.c raw_usrreq.c rtsock.c sys/net80211 ieee80211_ioctl.c sys/netatalk at_control.c ddp_pcb.c sys/netatm atm_usrreq.c sys/netgraph ng_socket.c ng_tty.c sys/netgraph/bluetooth/drivers/h4 ng_h4.c sys/netgraph/bluetooth/socket ng_btsocket_hci_raw.c ng_btsocket_l2cap_raw.c sys/netinet in.c in_pcb.c ip_carp.c ip_divert.c ip_fw2.c ip_mroute.c ip_output.c raw_ip.c tcp_subr.c udp_usrreq.c sys/netinet6 in6.c in6_pcb.c in6_src.c ipsec.c udp6_usrreq.c sys/netipsec ipsec_osdep.h sys/netipx ipx_pcb.c ipx_usrreq.c sys/netncp ncp_conn.c ncp_mod.c ncp_subr.h sys/netsmb smb_conn.c smb_subr.h sys/nfsserver nfs_syscalls.c sys/pc98/cbus fdc.c sys/posix4 p1003_1b.c sys/security/audit audit.c audit_pipe.c audit_syscalls.c sys/security/mac mac_net.c mac_system.c sys/security/mac_bsdextended mac_bsdextended.c sys/security/mac_lomac mac_lomac.c sys/security/mac_partition mac_partition.c sys/security/mac_portacl mac_portacl.c sys/security/mac_seeotheruids mac_seeotheruids.c sys/sun4v/sun4v hvcons.c sys/sys mac_policy.h sys/ufs/ffs ffs_alloc.c ffs_vfsops.c ffs_vnops.c sys/ufs/ufs ufs_extattr.c ufs_quota.c ufs_vnops.c sys/vm swap_pager.c vm_mmap.c Log: Sweep kernel replacing suser(9) calls with priv(9) calls, assigning specific privilege names to a broad range of privileges. These may require some future tweaking. Sponsored by: nCircle Network Security, Inc. Obtained from: TrustedBSD Project Discussed on: arch@ Reviewed (at least in part) by: mlaier, jmg, pjd, bde, ceri, Alex Lyashkov , Skip Ford , Antoine Brodin Revision Changes Path 1.2 +2 -1 src/sys/amd64/amd64/io.c 1.192 +4 -2 src/sys/compat/linux/linux_misc.c 1.20 +3 -1 src/sys/compat/linux/linux_uid16.c 1.39 +3 -1 src/sys/compat/svr4/svr4_fcntl.c 1.91 +3 -1 src/sys/compat/svr4/svr4_misc.c 1.4 +3 -1 src/sys/contrib/altq/altq/altq_cbq.c 1.3 +3 -1 src/sys/contrib/altq/altq/altq_cdnr.c 1.3 +4 -1 src/sys/contrib/altq/altq/altq_hfsc.c 1.3 +4 -1 src/sys/contrib/altq/altq/altq_priq.c 1.3 +3 -1 src/sys/contrib/altq/altq/altq_red.c 1.4 +4 -1 src/sys/contrib/altq/altq/altq_rio.c 1.31 +4 -1 src/sys/contrib/pf/net/if_pfsync.c 1.80 +6 -5 src/sys/dev/an/if_an.c 1.14 +4 -3 src/sys/dev/arl/if_arl.c 1.81 +2 -1 src/sys/dev/asr/asr.c 1.190 +5 -1 src/sys/dev/ata/atapi-cd.c 1.4 +65 -22 src/sys/dev/ce/if_ce.c 1.24 +4 -3 src/sys/dev/cnw/if_cnw.c 1.30 +28 -27 src/sys/dev/cp/if_cp.c 1.30 +17 -16 src/sys/dev/ctau/if_ct.c 1.53 +11 -10 src/sys/dev/cx/if_cx.c 1.12 +3 -1 src/sys/dev/dcons/dcons_os.c 1.18 +7 -0 src/sys/dev/drm/drmP.h 1.314 +4 -2 src/sys/dev/fdc/fdc.c 1.26 +12 -7 src/sys/dev/hwpmc/hwpmc_mod.c 1.118 +6 -5 src/sys/dev/if_ndis/if_ndis.c 1.46 +10 -9 src/sys/dev/kbd/kbd.c 1.30 +3 -0 src/sys/dev/lmc/if_lmc.c 1.5 +5 -1 src/sys/dev/lmc/if_lmc.h 1.38 +3 -1 src/sys/dev/nmdm/nmdm.c 1.32 +2 -1 src/sys/dev/null/null.c 1.35 +2 -1 src/sys/dev/ofw/ofw_console.c 1.61 +2 -1 src/sys/dev/random/randomdev.c 1.23 +3 -2 src/sys/dev/sbni/if_sbni.c 1.17 +4 -3 src/sys/dev/sbsh/if_sbsh.c 1.138 +2 -1 src/sys/dev/si/si.c 1.448 +3 -2 src/sys/dev/syscons/syscons.c 1.29 +3 -1 src/sys/dev/syscons/sysmouse.c 1.200 +4 -3 src/sys/dev/wi/if_wi.c 1.74 +6 -5 src/sys/dev/wl/if_wl.c 1.36 +1 -1 src/sys/dev/zs/zs.c 1.23 +7 -4 src/sys/fs/devfs/devfs_rule.c 1.140 +16 -8 src/sys/fs/devfs/devfs_vnops.c 1.69 +6 -5 src/sys/fs/hpfs/hpfs_vnops.c 1.154 +19 -18 src/sys/fs/msdosfs/msdosfs_vfsops.c 1.165 +32 -18 src/sys/fs/msdosfs/msdosfs_vnops.c 1.14 +14 -2 src/sys/fs/procfs/procfs_ioctl.c 1.64 +7 -5 src/sys/fs/smbfs/smbfs_vnops.c 1.45 +2 -1 src/sys/fs/udf/udf_vfsops.c 1.66 +2 -1 src/sys/fs/umapfs/umap_vfsops.c 1.159 +20 -15 src/sys/gnu/fs/ext2fs/ext2_vfsops.c 1.106 +30 -14 src/sys/gnu/fs/ext2fs/ext2_vnops.c 1.5 +1 -0 src/sys/gnu/fs/reiserfs/reiserfs_fs.h 1.7 +9 -9 src/sys/gnu/fs/reiserfs/reiserfs_vfsops.c 1.5 +11 -8 src/sys/gnu/fs/xfs/FreeBSD/xfs_super.c 1.2 +2 -1 src/sys/i386/i386/io.c 1.107 +2 -1 src/sys/i386/i386/sys_machdep.c 1.60 +2 -1 src/sys/i386/i386/vm86.c 1.66 +14 -8 src/sys/i386/ibcs2/ibcs2_misc.c 1.22 +0 -3 src/sys/i386/ibcs2/ibcs2_socksys.c 1.23 +0 -2 src/sys/i386/ibcs2/ibcs2_sysi86.c 1.64 +2 -1 src/sys/i386/linux/linux_machdep.c 1.36 +1 -1 src/sys/i4b/driver/i4b_ipr.c 1.29 +2 -1 src/sys/ia64/ia64/ssc.c 1.147 +2 -1 src/sys/isofs/cd9660/cd9660_vfsops.c 1.85 +2 -2 src/sys/kern/kern_acct.c 1.299 +2 -1 src/sys/kern/kern_descrip.c 1.46 +11 -3 src/sys/kern/kern_environment.c 1.299 +5 -1 src/sys/kern/kern_exec.c 1.264 +6 -2 src/sys/kern/kern_fork.c 1.112 +4 -2 src/sys/kern/kern_ktrace.c 1.144 +3 -2 src/sys/kern/kern_linker.c 1.60 +3 -2 src/sys/kern/kern_ntptime.c 1.162 +5 -3 src/sys/kern/kern_resource.c 1.180 +2 -1 src/sys/kern/kern_shutdown.c 1.172 +5 -6 src/sys/kern/kern_sysctl.c 1.55 +2 -1 src/sys/kern/kern_thr.c 1.135 +3 -2 src/sys/kern/kern_time.c 1.54 +3 -2 src/sys/kern/kern_umtx.c 1.47 +6 -4 src/sys/kern/kern_xxx.c 1.51 +50 -43 src/sys/kern/subr_acl_posix1e.c 1.6 +3 -1 src/sys/kern/subr_firmware.c 1.127 +2 -1 src/sys/kern/subr_prf.c 1.219 +5 -1 src/sys/kern/subr_witness.c 1.30 +65 -37 src/sys/kern/sysv_ipc.c 1.64 +2 -1 src/sys/kern/sysv_msg.c 1.263 +8 -6 src/sys/kern/tty.c 1.138 +2 -1 src/sys/kern/tty_cons.c 1.13 +5 -2 src/sys/kern/tty_pts.c 1.151 +5 -2 src/sys/kern/tty_pty.c 1.17 +16 -4 src/sys/kern/uipc_mqueue.c 1.26 +13 -4 src/sys/kern/uipc_sem.c 1.242 +21 -9 src/sys/kern/vfs_mount.c 1.689 +23 -40 src/sys/kern/vfs_subr.c 1.428 +39 -29 src/sys/kern/vfs_syscalls.c 1.246 +2 -1 src/sys/kern/vfs_vnops.c 1.174 +2 -1 src/sys/net/bpf.c 1.264 +20 -14 src/sys/net/if.c 1.86 +2 -1 src/sys/net/if_bridge.c 1.45 +63 -9 src/sys/net/if_gre.c 1.117 +18 -7 src/sys/net/if_ppp.c 1.133 +2 -1 src/sys/net/if_sl.c 1.66 +7 -3 src/sys/net/if_tap.c 1.161 +6 -3 src/sys/net/if_tun.c 1.71 +9 -4 src/sys/net/ppp_tty.c 1.44 +6 -2 src/sys/net/raw_usrreq.c 1.139 +6 -2 src/sys/net/rtsock.c 1.51 +6 -5 src/sys/net80211/ieee80211_ioctl.c 1.45 +2 -0 src/sys/netatalk/at_control.c 1.50 +2 -1 src/sys/netatalk/ddp_pcb.c 1.28 +21 -8 src/sys/netatm/atm_usrreq.c 1.15 +2 -1 src/sys/netgraph/bluetooth/drivers/h4/ng_h4.c 1.23 +2 -1 src/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c 1.20 +2 -1 src/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c 1.81 +5 -2 src/sys/netgraph/ng_socket.c 1.37 +3 -1 src/sys/netgraph/ng_tty.c 1.95 +29 -7 src/sys/netinet/in.c 1.183 +6 -2 src/sys/netinet/in_pcb.c 1.45 +5 -2 src/sys/netinet/ip_carp.c 1.122 +6 -2 src/sys/netinet/ip_divert.c 1.153 +2 -1 src/sys/netinet/ip_fw2.c 1.122 +2 -1 src/sys/netinet/ip_mroute.c 1.268 +15 -2 src/sys/netinet/ip_output.c 1.167 +23 -10 src/sys/netinet/raw_ip.c 1.266 +5 -2 src/sys/netinet/tcp_subr.c 1.196 +3 -1 src/sys/netinet/udp_usrreq.c 1.65 +41 -17 src/sys/netinet6/in6.c 1.74 +6 -1 src/sys/netinet6/in6_pcb.c 1.40 +4 -1 src/sys/netinet6/in6_src.c 1.47 +9 -2 src/sys/netinet6/ipsec.c 1.69 +3 -1 src/sys/netinet6/udp6_usrreq.c 1.4 +3 -1 src/sys/netipsec/ipsec_osdep.h 1.46 +4 -4 src/sys/netipx/ipx_pcb.c 1.58 +8 -2 src/sys/netipx/ipx_usrreq.c 1.29 +1 -0 src/sys/netncp/ncp_conn.c 1.16 +1 -0 src/sys/netncp/ncp_mod.c 1.10 +1 -1 src/sys/netncp/ncp_subr.h 1.18 +1 -0 src/sys/netsmb/smb_conn.c 1.13 +1 -1 src/sys/netsmb/smb_subr.h 1.108 +2 -1 src/sys/nfsserver/nfs_syscalls.c 1.168 +4 -3 src/sys/pc98/cbus/fdc.c 1.31 +5 -3 src/sys/posix4/p1003_1b.c 1.22 +3 -1 src/sys/security/audit/audit.c 1.10 +3 -3 src/sys/security/audit/audit_pipe.c 1.9 +10 -9 src/sys/security/audit/audit_syscalls.c 1.120 +5 -4 src/sys/security/mac/mac_net.c 1.107 +6 -0 src/sys/security/mac/mac_system.c 1.30 +3 -0 src/sys/security/mac_bsdextended/mac_bsdextended.c 1.42 +4 -1 src/sys/security/mac_lomac/mac_lomac.c 1.12 +2 -1 src/sys/security/mac_partition/mac_partition.c 1.10 +3 -1 src/sys/security/mac_portacl/mac_portacl.c 1.9 +2 -1 src/sys/security/mac_seeotheruids/mac_seeotheruids.c 1.4 +3 -1 src/sys/sun4v/sun4v/hvcons.c 1.78 +4 -0 src/sys/sys/mac_policy.h 1.141 +3 -2 src/sys/ufs/ffs/ffs_alloc.c 1.323 +18 -15 src/sys/ufs/ffs/ffs_vfsops.c 1.162 +4 -2 src/sys/ufs/ffs/ffs_vnops.c 1.85 +3 -1 src/sys/ufs/ufs/ufs_extattr.c 1.85 +25 -9 src/sys/ufs/ufs/ufs_quota.c 1.283 +31 -14 src/sys/ufs/ufs/ufs_vnops.c 1.285 +5 -5 src/sys/vm/swap_pager.c 1.208 +6 -5 src/sys/vm/vm_mmap.c