diff options
Diffstat (limited to 'security/capability.c')
| -rw-r--r-- | security/capability.c | 128 | 
1 files changed, 97 insertions, 31 deletions
diff --git a/security/capability.c b/security/capability.c index 30ae00fbecd..e76373de312 100644 --- a/security/capability.c +++ b/security/capability.c @@ -12,7 +12,7 @@  #include <linux/security.h> -static int cap_sysctl(ctl_table *table, int op) +static int cap_syslog(int type)  {  	return 0;  } @@ -54,6 +54,11 @@ static int cap_sb_copy_data(char *orig, char *copy)  	return 0;  } +static int cap_sb_remount(struct super_block *sb, void *data) +{ +	return 0; +} +  static int cap_sb_kern_mount(struct super_block *sb, int flags, void *data)  {  	return 0; @@ -69,8 +74,8 @@ static int cap_sb_statfs(struct dentry *dentry)  	return 0;  } -static int cap_sb_mount(char *dev_name, struct path *path, char *type, -			unsigned long flags, void *data) +static int cap_sb_mount(const char *dev_name, struct path *path, +			const char *type, unsigned long flags, void *data)  {  	return 0;  } @@ -86,16 +91,20 @@ static int cap_sb_pivotroot(struct path *old_path, struct path *new_path)  }  static int cap_sb_set_mnt_opts(struct super_block *sb, -			       struct security_mnt_opts *opts) +			       struct security_mnt_opts *opts, +			       unsigned long kern_flags, +			       unsigned long *set_kern_flags) +  {  	if (unlikely(opts->num_mnt_opts))  		return -EOPNOTSUPP;  	return 0;  } -static void cap_sb_clone_mnt_opts(const struct super_block *oldsb, +static int cap_sb_clone_mnt_opts(const struct super_block *oldsb,  				  struct super_block *newsb)  { +	return 0;  }  static int cap_sb_parse_opts_str(char *options, struct security_mnt_opts *opts) @@ -103,6 +112,13 @@ static int cap_sb_parse_opts_str(char *options, struct security_mnt_opts *opts)  	return 0;  } +static int cap_dentry_init_security(struct dentry *dentry, int mode, +					struct qstr *name, void **ctx, +					u32 *ctxlen) +{ +	return -EOPNOTSUPP; +} +  static int cap_inode_alloc_security(struct inode *inode)  {  	return 0; @@ -113,13 +129,14 @@ static void cap_inode_free_security(struct inode *inode)  }  static int cap_inode_init_security(struct inode *inode, struct inode *dir, -				   char **name, void **value, size_t *len) +				   const struct qstr *qstr, const char **name, +				   void **value, size_t *len)  {  	return -EOPNOTSUPP;  }  static int cap_inode_create(struct inode *inode, struct dentry *dentry, -			    int mask) +			    umode_t mask)  {  	return 0;  } @@ -142,7 +159,7 @@ static int cap_inode_symlink(struct inode *inode, struct dentry *dentry,  }  static int cap_inode_mkdir(struct inode *inode, struct dentry *dentry, -			   int mask) +			   umode_t mask)  {  	return 0;  } @@ -153,7 +170,7 @@ static int cap_inode_rmdir(struct inode *inode, struct dentry *dentry)  }  static int cap_inode_mknod(struct inode *inode, struct dentry *dentry, -			   int mode, dev_t dev) +			   umode_t mode, dev_t dev)  {  	return 0;  } @@ -229,13 +246,13 @@ static void cap_inode_getsecid(const struct inode *inode, u32 *secid)  }  #ifdef CONFIG_SECURITY_PATH -static int cap_path_mknod(struct path *dir, struct dentry *dentry, int mode, +static int cap_path_mknod(struct path *dir, struct dentry *dentry, umode_t mode,  			  unsigned int dev)  {  	return 0;  } -static int cap_path_mkdir(struct path *dir, struct dentry *dentry, int mode) +static int cap_path_mkdir(struct path *dir, struct dentry *dentry, umode_t mode)  {  	return 0;  } @@ -273,13 +290,12 @@ static int cap_path_truncate(struct path *path)  	return 0;  } -static int cap_path_chmod(struct dentry *dentry, struct vfsmount *mnt, -			  mode_t mode) +static int cap_path_chmod(struct path *path, umode_t mode)  {  	return 0;  } -static int cap_path_chown(struct path *path, uid_t uid, gid_t gid) +static int cap_path_chown(struct path *path, kuid_t uid, kgid_t gid)  {  	return 0;  } @@ -343,7 +359,7 @@ static int cap_file_receive(struct file *file)  	return 0;  } -static int cap_dentry_open(struct file *file, const struct cred *cred) +static int cap_file_open(struct file *file, const struct cred *cred)  {  	return 0;  } @@ -353,6 +369,10 @@ static int cap_task_create(unsigned long clone_flags)  	return 0;  } +static void cap_task_free(struct task_struct *task) +{ +} +  static int cap_cred_alloc_blank(struct cred *cred, gfp_t gfp)  {  	return 0; @@ -386,6 +406,11 @@ static int cap_kernel_module_request(char *kmod_name)  	return 0;  } +static int cap_kernel_module_from_file(struct file *file) +{ +	return 0; +} +  static int cap_task_setpgid(struct task_struct *p, pid_t pgid)  {  	return 0; @@ -543,7 +568,7 @@ static int cap_sem_semop(struct sem_array *sma, struct sembuf *sops,  }  #ifdef CONFIG_SECURITY_NETWORK -static int cap_unix_stream_connect(struct socket *sock, struct socket *other, +static int cap_unix_stream_connect(struct sock *sock, struct sock *other,  				   struct sock *newsk)  {  	return 0; @@ -695,24 +720,45 @@ static void cap_req_classify_flow(const struct request_sock *req,  {  } +static int cap_tun_dev_alloc_security(void **security) +{ +	return 0; +} + +static void cap_tun_dev_free_security(void *security) +{ +} +  static int cap_tun_dev_create(void)  {  	return 0;  } -static void cap_tun_dev_post_create(struct sock *sk) +static int cap_tun_dev_attach_queue(void *security)  { +	return 0;  } -static int cap_tun_dev_attach(struct sock *sk) +static int cap_tun_dev_attach(struct sock *sk, void *security)  {  	return 0;  } + +static int cap_tun_dev_open(void *security) +{ +	return 0; +} + +static void cap_skb_owned_by(struct sk_buff *skb, struct sock *sk) +{ +} +  #endif	/* CONFIG_SECURITY_NETWORK */  #ifdef CONFIG_SECURITY_NETWORK_XFRM  static int cap_xfrm_policy_alloc_security(struct xfrm_sec_ctx **ctxp, -					  struct xfrm_user_sec_ctx *sec_ctx) +					  struct xfrm_user_sec_ctx *sec_ctx, +					  gfp_t gfp)  {  	return 0;  } @@ -732,9 +778,15 @@ static int cap_xfrm_policy_delete_security(struct xfrm_sec_ctx *ctx)  	return 0;  } -static int cap_xfrm_state_alloc_security(struct xfrm_state *x, -					 struct xfrm_user_sec_ctx *sec_ctx, -					 u32 secid) +static int cap_xfrm_state_alloc(struct xfrm_state *x, +				struct xfrm_user_sec_ctx *sec_ctx) +{ +	return 0; +} + +static int cap_xfrm_state_alloc_acquire(struct xfrm_state *x, +					struct xfrm_sec_ctx *polsec, +					u32 secid)  {  	return 0;  } @@ -755,7 +807,7 @@ static int cap_xfrm_policy_lookup(struct xfrm_sec_ctx *ctx, u32 sk_sid, u8 dir)  static int cap_xfrm_state_pol_flow_match(struct xfrm_state *x,  					 struct xfrm_policy *xp, -					 struct flowi *fl) +					 const struct flowi *fl)  {  	return 1;  } @@ -781,6 +833,11 @@ static int cap_setprocattr(struct task_struct *p, char *name, void *value,  	return -EINVAL;  } +static int cap_ismaclabel(const char *name) +{ +	return 0; +} +  static int cap_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)  {  	return -EOPNOTSUPP; @@ -808,7 +865,7 @@ static int cap_inode_setsecctx(struct dentry *dentry, void *ctx, u32 ctxlen)  static int cap_inode_getsecctx(struct inode *inode, void **ctx, u32 *ctxlen)  { -	return 0; +	return -EOPNOTSUPP;  }  #ifdef CONFIG_KEYS  static int cap_key_alloc(struct key *key, const struct cred *cred, @@ -822,7 +879,7 @@ static void cap_key_free(struct key *key)  }  static int cap_key_permission(key_ref_t key_ref, const struct cred *cred, -			      key_perm_t perm) +			      unsigned perm)  {  	return 0;  } @@ -875,7 +932,6 @@ void __init security_fixup_ops(struct security_operations *ops)  	set_to_cap_if_null(ops, capable);  	set_to_cap_if_null(ops, quotactl);  	set_to_cap_if_null(ops, quota_on); -	set_to_cap_if_null(ops, sysctl);  	set_to_cap_if_null(ops, syslog);  	set_to_cap_if_null(ops, settime);  	set_to_cap_if_null(ops, vm_enough_memory); @@ -887,6 +943,7 @@ void __init security_fixup_ops(struct security_operations *ops)  	set_to_cap_if_null(ops, sb_alloc_security);  	set_to_cap_if_null(ops, sb_free_security);  	set_to_cap_if_null(ops, sb_copy_data); +	set_to_cap_if_null(ops, sb_remount);  	set_to_cap_if_null(ops, sb_kern_mount);  	set_to_cap_if_null(ops, sb_show_options);  	set_to_cap_if_null(ops, sb_statfs); @@ -896,6 +953,7 @@ void __init security_fixup_ops(struct security_operations *ops)  	set_to_cap_if_null(ops, sb_set_mnt_opts);  	set_to_cap_if_null(ops, sb_clone_mnt_opts);  	set_to_cap_if_null(ops, sb_parse_opts_str); +	set_to_cap_if_null(ops, dentry_init_security);  	set_to_cap_if_null(ops, inode_alloc_security);  	set_to_cap_if_null(ops, inode_free_security);  	set_to_cap_if_null(ops, inode_init_security); @@ -940,15 +998,17 @@ void __init security_fixup_ops(struct security_operations *ops)  	set_to_cap_if_null(ops, file_alloc_security);  	set_to_cap_if_null(ops, file_free_security);  	set_to_cap_if_null(ops, file_ioctl); -	set_to_cap_if_null(ops, file_mmap); +	set_to_cap_if_null(ops, mmap_addr); +	set_to_cap_if_null(ops, mmap_file);  	set_to_cap_if_null(ops, file_mprotect);  	set_to_cap_if_null(ops, file_lock);  	set_to_cap_if_null(ops, file_fcntl);  	set_to_cap_if_null(ops, file_set_fowner);  	set_to_cap_if_null(ops, file_send_sigiotask);  	set_to_cap_if_null(ops, file_receive); -	set_to_cap_if_null(ops, dentry_open); +	set_to_cap_if_null(ops, file_open);  	set_to_cap_if_null(ops, task_create); +	set_to_cap_if_null(ops, task_free);  	set_to_cap_if_null(ops, cred_alloc_blank);  	set_to_cap_if_null(ops, cred_free);  	set_to_cap_if_null(ops, cred_prepare); @@ -956,6 +1016,7 @@ void __init security_fixup_ops(struct security_operations *ops)  	set_to_cap_if_null(ops, kernel_act_as);  	set_to_cap_if_null(ops, kernel_create_files_as);  	set_to_cap_if_null(ops, kernel_module_request); +	set_to_cap_if_null(ops, kernel_module_from_file);  	set_to_cap_if_null(ops, task_fix_setuid);  	set_to_cap_if_null(ops, task_setpgid);  	set_to_cap_if_null(ops, task_getpgid); @@ -993,10 +1054,10 @@ void __init security_fixup_ops(struct security_operations *ops)  	set_to_cap_if_null(ops, sem_semctl);  	set_to_cap_if_null(ops, sem_semop);  	set_to_cap_if_null(ops, netlink_send); -	set_to_cap_if_null(ops, netlink_recv);  	set_to_cap_if_null(ops, d_instantiate);  	set_to_cap_if_null(ops, getprocattr);  	set_to_cap_if_null(ops, setprocattr); +	set_to_cap_if_null(ops, ismaclabel);  	set_to_cap_if_null(ops, secid_to_secctx);  	set_to_cap_if_null(ops, secctx_to_secid);  	set_to_cap_if_null(ops, release_secctx); @@ -1034,16 +1095,21 @@ void __init security_fixup_ops(struct security_operations *ops)  	set_to_cap_if_null(ops, secmark_refcount_inc);  	set_to_cap_if_null(ops, secmark_refcount_dec);  	set_to_cap_if_null(ops, req_classify_flow); +	set_to_cap_if_null(ops, tun_dev_alloc_security); +	set_to_cap_if_null(ops, tun_dev_free_security);  	set_to_cap_if_null(ops, tun_dev_create); -	set_to_cap_if_null(ops, tun_dev_post_create); +	set_to_cap_if_null(ops, tun_dev_open); +	set_to_cap_if_null(ops, tun_dev_attach_queue);  	set_to_cap_if_null(ops, tun_dev_attach); +	set_to_cap_if_null(ops, skb_owned_by);  #endif	/* CONFIG_SECURITY_NETWORK */  #ifdef CONFIG_SECURITY_NETWORK_XFRM  	set_to_cap_if_null(ops, xfrm_policy_alloc_security);  	set_to_cap_if_null(ops, xfrm_policy_clone_security);  	set_to_cap_if_null(ops, xfrm_policy_free_security);  	set_to_cap_if_null(ops, xfrm_policy_delete_security); -	set_to_cap_if_null(ops, xfrm_state_alloc_security); +	set_to_cap_if_null(ops, xfrm_state_alloc); +	set_to_cap_if_null(ops, xfrm_state_alloc_acquire);  	set_to_cap_if_null(ops, xfrm_state_free_security);  	set_to_cap_if_null(ops, xfrm_state_delete_security);  	set_to_cap_if_null(ops, xfrm_policy_lookup);  | 
