diff options
author | rwatson <rwatson@FreeBSD.org> | 2002-10-05 18:40:10 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2002-10-05 18:40:10 +0000 |
commit | 7b150b70c23f2e2e32cfee0646005b13ef1a75be (patch) | |
tree | 6ab685df96169b084c81758fa864ba83a468cb49 /sys/security | |
parent | 5846242df8bb35367b2f07511b465656800fa74a (diff) | |
download | FreeBSD-src-7b150b70c23f2e2e32cfee0646005b13ef1a75be.zip FreeBSD-src-7b150b70c23f2e2e32cfee0646005b13ef1a75be.tar.gz |
Integrate a devfs/MAC fix from the MAC tree: avoid a race condition during
devfs VOP symlink creation by introducing a new entry point to determine
the label of the devfs_dirent prior to allocation of a vnode for the
symlink.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, Network Associates Laboratories
Diffstat (limited to 'sys/security')
-rw-r--r-- | sys/security/mac/mac_framework.c | 13 | ||||
-rw-r--r-- | sys/security/mac/mac_framework.h | 2 | ||||
-rw-r--r-- | sys/security/mac/mac_internal.h | 13 | ||||
-rw-r--r-- | sys/security/mac/mac_net.c | 13 | ||||
-rw-r--r-- | sys/security/mac/mac_pipe.c | 13 | ||||
-rw-r--r-- | sys/security/mac/mac_policy.h | 4 | ||||
-rw-r--r-- | sys/security/mac/mac_process.c | 13 | ||||
-rw-r--r-- | sys/security/mac/mac_syscalls.c | 13 | ||||
-rw-r--r-- | sys/security/mac/mac_system.c | 13 | ||||
-rw-r--r-- | sys/security/mac/mac_vfs.c | 13 |
10 files changed, 110 insertions, 0 deletions
diff --git a/sys/security/mac/mac_framework.c b/sys/security/mac/mac_framework.c index 5719b01f..8a9de01 100644 --- a/sys/security/mac/mac_framework.c +++ b/sys/security/mac/mac_framework.c @@ -519,6 +519,10 @@ mac_policy_register(struct mac_policy_conf *mpc) mpc->mpc_ops->mpo_create_devfs_directory = mpe->mpe_function; break; + case MAC_CREATE_DEVFS_SYMLINK: + mpc->mpc_ops->mpo_create_devfs_symlink = + mpe->mpe_function; + break; case MAC_CREATE_DEVFS_VNODE: mpc->mpc_ops->mpo_create_devfs_vnode = mpe->mpe_function; @@ -2946,6 +2950,15 @@ mac_create_devfs_device(dev_t dev, struct devfs_dirent *de) MAC_PERFORM(create_devfs_device, dev, de, &de->de_label); } +void +mac_create_devfs_symlink(struct ucred *cred, struct devfs_dirent *dd, + struct devfs_dirent *de) +{ + + MAC_PERFORM(create_devfs_symlink, cred, dd, &dd->de_label, de, + &de->de_label); +} + static int mac_stdcreatevnode_ea(struct vnode *vp) { diff --git a/sys/security/mac/mac_framework.h b/sys/security/mac/mac_framework.h index a646ad3..b0d0468 100644 --- a/sys/security/mac/mac_framework.h +++ b/sys/security/mac/mac_framework.h @@ -244,6 +244,8 @@ void mac_create_devfs_device(dev_t dev, struct devfs_dirent *de); void mac_create_devfs_directory(char *dirname, int dirnamelen, struct devfs_dirent *de); void mac_create_devfs_vnode(struct devfs_dirent *de, struct vnode *vp); +void mac_create_devfs_symlink(struct ucred *cred, struct devfs_dirent *dd, + struct devfs_dirent *de); void mac_create_vnode(struct ucred *cred, struct vnode *parent, struct vnode *child); void mac_create_mount(struct ucred *cred, struct mount *mp); diff --git a/sys/security/mac/mac_internal.h b/sys/security/mac/mac_internal.h index 5719b01f..8a9de01 100644 --- a/sys/security/mac/mac_internal.h +++ b/sys/security/mac/mac_internal.h @@ -519,6 +519,10 @@ mac_policy_register(struct mac_policy_conf *mpc) mpc->mpc_ops->mpo_create_devfs_directory = mpe->mpe_function; break; + case MAC_CREATE_DEVFS_SYMLINK: + mpc->mpc_ops->mpo_create_devfs_symlink = + mpe->mpe_function; + break; case MAC_CREATE_DEVFS_VNODE: mpc->mpc_ops->mpo_create_devfs_vnode = mpe->mpe_function; @@ -2946,6 +2950,15 @@ mac_create_devfs_device(dev_t dev, struct devfs_dirent *de) MAC_PERFORM(create_devfs_device, dev, de, &de->de_label); } +void +mac_create_devfs_symlink(struct ucred *cred, struct devfs_dirent *dd, + struct devfs_dirent *de) +{ + + MAC_PERFORM(create_devfs_symlink, cred, dd, &dd->de_label, de, + &de->de_label); +} + static int mac_stdcreatevnode_ea(struct vnode *vp) { diff --git a/sys/security/mac/mac_net.c b/sys/security/mac/mac_net.c index 5719b01f..8a9de01 100644 --- a/sys/security/mac/mac_net.c +++ b/sys/security/mac/mac_net.c @@ -519,6 +519,10 @@ mac_policy_register(struct mac_policy_conf *mpc) mpc->mpc_ops->mpo_create_devfs_directory = mpe->mpe_function; break; + case MAC_CREATE_DEVFS_SYMLINK: + mpc->mpc_ops->mpo_create_devfs_symlink = + mpe->mpe_function; + break; case MAC_CREATE_DEVFS_VNODE: mpc->mpc_ops->mpo_create_devfs_vnode = mpe->mpe_function; @@ -2946,6 +2950,15 @@ mac_create_devfs_device(dev_t dev, struct devfs_dirent *de) MAC_PERFORM(create_devfs_device, dev, de, &de->de_label); } +void +mac_create_devfs_symlink(struct ucred *cred, struct devfs_dirent *dd, + struct devfs_dirent *de) +{ + + MAC_PERFORM(create_devfs_symlink, cred, dd, &dd->de_label, de, + &de->de_label); +} + static int mac_stdcreatevnode_ea(struct vnode *vp) { diff --git a/sys/security/mac/mac_pipe.c b/sys/security/mac/mac_pipe.c index 5719b01f..8a9de01 100644 --- a/sys/security/mac/mac_pipe.c +++ b/sys/security/mac/mac_pipe.c @@ -519,6 +519,10 @@ mac_policy_register(struct mac_policy_conf *mpc) mpc->mpc_ops->mpo_create_devfs_directory = mpe->mpe_function; break; + case MAC_CREATE_DEVFS_SYMLINK: + mpc->mpc_ops->mpo_create_devfs_symlink = + mpe->mpe_function; + break; case MAC_CREATE_DEVFS_VNODE: mpc->mpc_ops->mpo_create_devfs_vnode = mpe->mpe_function; @@ -2946,6 +2950,15 @@ mac_create_devfs_device(dev_t dev, struct devfs_dirent *de) MAC_PERFORM(create_devfs_device, dev, de, &de->de_label); } +void +mac_create_devfs_symlink(struct ucred *cred, struct devfs_dirent *dd, + struct devfs_dirent *de) +{ + + MAC_PERFORM(create_devfs_symlink, cred, dd, &dd->de_label, de, + &de->de_label); +} + static int mac_stdcreatevnode_ea(struct vnode *vp) { diff --git a/sys/security/mac/mac_policy.h b/sys/security/mac/mac_policy.h index d9f1a8e..d455d3c 100644 --- a/sys/security/mac/mac_policy.h +++ b/sys/security/mac/mac_policy.h @@ -110,6 +110,9 @@ struct mac_policy_ops { struct label *label); void (*mpo_create_devfs_directory)(char *dirname, int dirnamelen, struct devfs_dirent *de, struct label *label); + void (*mpo_create_devfs_symlink)(struct ucred *cred, + struct devfs_dirent *dd, struct label *ddlabel, + struct devfs_dirent *de, struct label *delabel); void (*mpo_create_devfs_vnode)(struct devfs_dirent *de, struct label *direntlabel, struct vnode *vp, struct label *vnodelabel); @@ -387,6 +390,7 @@ enum mac_op_constant { MAC_INTERNALIZE, MAC_CREATE_DEVFS_DEVICE, MAC_CREATE_DEVFS_DIRECTORY, + MAC_CREATE_DEVFS_SYMLINK, MAC_CREATE_DEVFS_VNODE, MAC_CREATE_VNODE, MAC_CREATE_MOUNT, diff --git a/sys/security/mac/mac_process.c b/sys/security/mac/mac_process.c index 5719b01f..8a9de01 100644 --- a/sys/security/mac/mac_process.c +++ b/sys/security/mac/mac_process.c @@ -519,6 +519,10 @@ mac_policy_register(struct mac_policy_conf *mpc) mpc->mpc_ops->mpo_create_devfs_directory = mpe->mpe_function; break; + case MAC_CREATE_DEVFS_SYMLINK: + mpc->mpc_ops->mpo_create_devfs_symlink = + mpe->mpe_function; + break; case MAC_CREATE_DEVFS_VNODE: mpc->mpc_ops->mpo_create_devfs_vnode = mpe->mpe_function; @@ -2946,6 +2950,15 @@ mac_create_devfs_device(dev_t dev, struct devfs_dirent *de) MAC_PERFORM(create_devfs_device, dev, de, &de->de_label); } +void +mac_create_devfs_symlink(struct ucred *cred, struct devfs_dirent *dd, + struct devfs_dirent *de) +{ + + MAC_PERFORM(create_devfs_symlink, cred, dd, &dd->de_label, de, + &de->de_label); +} + static int mac_stdcreatevnode_ea(struct vnode *vp) { diff --git a/sys/security/mac/mac_syscalls.c b/sys/security/mac/mac_syscalls.c index 5719b01f..8a9de01 100644 --- a/sys/security/mac/mac_syscalls.c +++ b/sys/security/mac/mac_syscalls.c @@ -519,6 +519,10 @@ mac_policy_register(struct mac_policy_conf *mpc) mpc->mpc_ops->mpo_create_devfs_directory = mpe->mpe_function; break; + case MAC_CREATE_DEVFS_SYMLINK: + mpc->mpc_ops->mpo_create_devfs_symlink = + mpe->mpe_function; + break; case MAC_CREATE_DEVFS_VNODE: mpc->mpc_ops->mpo_create_devfs_vnode = mpe->mpe_function; @@ -2946,6 +2950,15 @@ mac_create_devfs_device(dev_t dev, struct devfs_dirent *de) MAC_PERFORM(create_devfs_device, dev, de, &de->de_label); } +void +mac_create_devfs_symlink(struct ucred *cred, struct devfs_dirent *dd, + struct devfs_dirent *de) +{ + + MAC_PERFORM(create_devfs_symlink, cred, dd, &dd->de_label, de, + &de->de_label); +} + static int mac_stdcreatevnode_ea(struct vnode *vp) { diff --git a/sys/security/mac/mac_system.c b/sys/security/mac/mac_system.c index 5719b01f..8a9de01 100644 --- a/sys/security/mac/mac_system.c +++ b/sys/security/mac/mac_system.c @@ -519,6 +519,10 @@ mac_policy_register(struct mac_policy_conf *mpc) mpc->mpc_ops->mpo_create_devfs_directory = mpe->mpe_function; break; + case MAC_CREATE_DEVFS_SYMLINK: + mpc->mpc_ops->mpo_create_devfs_symlink = + mpe->mpe_function; + break; case MAC_CREATE_DEVFS_VNODE: mpc->mpc_ops->mpo_create_devfs_vnode = mpe->mpe_function; @@ -2946,6 +2950,15 @@ mac_create_devfs_device(dev_t dev, struct devfs_dirent *de) MAC_PERFORM(create_devfs_device, dev, de, &de->de_label); } +void +mac_create_devfs_symlink(struct ucred *cred, struct devfs_dirent *dd, + struct devfs_dirent *de) +{ + + MAC_PERFORM(create_devfs_symlink, cred, dd, &dd->de_label, de, + &de->de_label); +} + static int mac_stdcreatevnode_ea(struct vnode *vp) { diff --git a/sys/security/mac/mac_vfs.c b/sys/security/mac/mac_vfs.c index 5719b01f..8a9de01 100644 --- a/sys/security/mac/mac_vfs.c +++ b/sys/security/mac/mac_vfs.c @@ -519,6 +519,10 @@ mac_policy_register(struct mac_policy_conf *mpc) mpc->mpc_ops->mpo_create_devfs_directory = mpe->mpe_function; break; + case MAC_CREATE_DEVFS_SYMLINK: + mpc->mpc_ops->mpo_create_devfs_symlink = + mpe->mpe_function; + break; case MAC_CREATE_DEVFS_VNODE: mpc->mpc_ops->mpo_create_devfs_vnode = mpe->mpe_function; @@ -2946,6 +2950,15 @@ mac_create_devfs_device(dev_t dev, struct devfs_dirent *de) MAC_PERFORM(create_devfs_device, dev, de, &de->de_label); } +void +mac_create_devfs_symlink(struct ucred *cred, struct devfs_dirent *dd, + struct devfs_dirent *de) +{ + + MAC_PERFORM(create_devfs_symlink, cred, dd, &dd->de_label, de, + &de->de_label); +} + static int mac_stdcreatevnode_ea(struct vnode *vp) { |