Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Linux Security plug |
| 3 | * |
| 4 | * Copyright (C) 2001 WireX Communications, Inc <chris@wirex.com> |
| 5 | * Copyright (C) 2001 Greg Kroah-Hartman <greg@kroah.com> |
| 6 | * Copyright (C) 2001 Networks Associates Technology, Inc <ssmalley@nai.com> |
| 7 | * Copyright (C) 2001 James Morris <jmorris@intercode.com.au> |
| 8 | * Copyright (C) 2001 Silicon Graphics, Inc. (Trust Technology Group) |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License as published by |
| 12 | * the Free Software Foundation; either version 2 of the License, or |
| 13 | * (at your option) any later version. |
| 14 | * |
| 15 | * Due to this file being licensed under the GPL there is controversy over |
| 16 | * whether this permits you to write a module that #includes this file |
| 17 | * without placing your module under the GPL. Please consult a lawyer for |
| 18 | * advice before doing this. |
| 19 | * |
| 20 | */ |
| 21 | |
| 22 | #ifndef __LINUX_SECURITY_H |
| 23 | #define __LINUX_SECURITY_H |
| 24 | |
| 25 | #include <linux/fs.h> |
| 26 | #include <linux/binfmts.h> |
| 27 | #include <linux/signal.h> |
| 28 | #include <linux/resource.h> |
| 29 | #include <linux/sem.h> |
| 30 | #include <linux/shm.h> |
| 31 | #include <linux/msg.h> |
| 32 | #include <linux/sched.h> |
David Howells | 29db919 | 2005-10-30 15:02:44 -0800 | [diff] [blame] | 33 | #include <linux/key.h> |
Venkat Yekkirala | e0d1caa | 2006-07-24 23:29:07 -0700 | [diff] [blame] | 34 | #include <linux/xfrm.h> |
Venkat Yekkirala | beb8d13 | 2006-08-04 23:12:42 -0700 | [diff] [blame] | 35 | #include <net/flow.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | |
Ahmed S. Darwish | 076c54c | 2008-03-06 18:09:10 +0200 | [diff] [blame] | 37 | /* Maximum number of letters for an LSM name string */ |
| 38 | #define SECURITY_NAME_MAX 10 |
| 39 | |
Eric Paris | 0611216 | 2008-11-11 22:02:50 +1100 | [diff] [blame] | 40 | /* If capable should audit the security request */ |
| 41 | #define SECURITY_CAP_NOAUDIT 0 |
| 42 | #define SECURITY_CAP_AUDIT 1 |
| 43 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | struct ctl_table; |
Ahmed S. Darwish | 03d37d2 | 2008-03-01 22:00:05 +0200 | [diff] [blame] | 45 | struct audit_krule; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | |
| 47 | /* |
| 48 | * These functions are in security/capability.c and are used |
| 49 | * as the default capabilities functions |
| 50 | */ |
Eric Paris | 0611216 | 2008-11-11 22:02:50 +1100 | [diff] [blame] | 51 | extern int cap_capable(struct task_struct *tsk, int cap, int audit); |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 52 | extern int cap_settime(struct timespec *ts, struct timezone *tz); |
David Howells | 5cd9c58 | 2008-08-14 11:37:28 +0100 | [diff] [blame] | 53 | extern int cap_ptrace_may_access(struct task_struct *child, unsigned int mode); |
| 54 | extern int cap_ptrace_traceme(struct task_struct *parent); |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 55 | extern int cap_capget(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); |
David Howells | d84f4f9 | 2008-11-14 10:39:23 +1100 | [diff] [blame^] | 56 | extern int cap_capset(struct cred *new, const struct cred *old, |
| 57 | const kernel_cap_t *effective, |
| 58 | const kernel_cap_t *inheritable, |
| 59 | const kernel_cap_t *permitted); |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 60 | extern int cap_bprm_set_security(struct linux_binprm *bprm); |
David Howells | d84f4f9 | 2008-11-14 10:39:23 +1100 | [diff] [blame^] | 61 | extern int cap_bprm_apply_creds(struct linux_binprm *bprm, int unsafe); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | extern int cap_bprm_secureexec(struct linux_binprm *bprm); |
David Howells | 8f0cfa5 | 2008-04-29 00:59:41 -0700 | [diff] [blame] | 63 | extern int cap_inode_setxattr(struct dentry *dentry, const char *name, |
| 64 | const void *value, size_t size, int flags); |
| 65 | extern int cap_inode_removexattr(struct dentry *dentry, const char *name); |
Serge E. Hallyn | b537677 | 2007-10-16 23:31:36 -0700 | [diff] [blame] | 66 | extern int cap_inode_need_killpriv(struct dentry *dentry); |
| 67 | extern int cap_inode_killpriv(struct dentry *dentry); |
David Howells | d84f4f9 | 2008-11-14 10:39:23 +1100 | [diff] [blame^] | 68 | extern int cap_task_fix_setuid(struct cred *new, const struct cred *old, int flags); |
Andrew G. Morgan | 3898b1b | 2008-04-28 02:13:40 -0700 | [diff] [blame] | 69 | extern int cap_task_prctl(int option, unsigned long arg2, unsigned long arg3, |
David Howells | d84f4f9 | 2008-11-14 10:39:23 +1100 | [diff] [blame^] | 70 | unsigned long arg4, unsigned long arg5); |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 71 | extern int cap_task_setscheduler(struct task_struct *p, int policy, struct sched_param *lp); |
| 72 | extern int cap_task_setioprio(struct task_struct *p, int ioprio); |
| 73 | extern int cap_task_setnice(struct task_struct *p, int nice); |
| 74 | extern int cap_syslog(int type); |
James Morris | 20510f2 | 2007-10-16 23:31:32 -0700 | [diff] [blame] | 75 | extern int cap_vm_enough_memory(struct mm_struct *mm, long pages); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 76 | |
| 77 | struct msghdr; |
| 78 | struct sk_buff; |
| 79 | struct sock; |
| 80 | struct sockaddr; |
| 81 | struct socket; |
Trent Jaeger | df71837 | 2005-12-13 23:12:27 -0800 | [diff] [blame] | 82 | struct flowi; |
| 83 | struct dst_entry; |
| 84 | struct xfrm_selector; |
| 85 | struct xfrm_policy; |
| 86 | struct xfrm_state; |
| 87 | struct xfrm_user_sec_ctx; |
Eric Paris | 2069f45 | 2008-07-04 09:47:13 +1000 | [diff] [blame] | 88 | struct seq_file; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 89 | |
| 90 | extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb); |
Darrel Goeddel | c7bdb54 | 2006-06-27 13:26:11 -0700 | [diff] [blame] | 91 | extern int cap_netlink_recv(struct sk_buff *skb, int cap); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 92 | |
Eric Paris | ed03218 | 2007-06-28 15:55:21 -0400 | [diff] [blame] | 93 | extern unsigned long mmap_min_addr; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 94 | /* |
| 95 | * Values used in the task_security_ops calls |
| 96 | */ |
| 97 | /* setuid or setgid, id0 == uid or gid */ |
| 98 | #define LSM_SETID_ID 1 |
| 99 | |
| 100 | /* setreuid or setregid, id0 == real, id1 == eff */ |
| 101 | #define LSM_SETID_RE 2 |
| 102 | |
| 103 | /* setresuid or setresgid, id0 == real, id1 == eff, uid2 == saved */ |
| 104 | #define LSM_SETID_RES 4 |
| 105 | |
| 106 | /* setfsuid or setfsgid, id0 == fsuid or fsgid */ |
| 107 | #define LSM_SETID_FS 8 |
| 108 | |
| 109 | /* forward declares to avoid warnings */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 110 | struct sched_param; |
Venkat Yekkirala | 4237c75 | 2006-07-24 23:32:50 -0700 | [diff] [blame] | 111 | struct request_sock; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 112 | |
| 113 | /* bprm_apply_creds unsafe reasons */ |
| 114 | #define LSM_UNSAFE_SHARE 1 |
| 115 | #define LSM_UNSAFE_PTRACE 2 |
| 116 | #define LSM_UNSAFE_PTRACE_CAP 4 |
| 117 | |
| 118 | #ifdef CONFIG_SECURITY |
| 119 | |
Eric Paris | e000752 | 2008-03-05 10:31:54 -0500 | [diff] [blame] | 120 | struct security_mnt_opts { |
| 121 | char **mnt_opts; |
| 122 | int *mnt_opts_flags; |
| 123 | int num_mnt_opts; |
| 124 | }; |
| 125 | |
| 126 | static inline void security_init_mnt_opts(struct security_mnt_opts *opts) |
| 127 | { |
| 128 | opts->mnt_opts = NULL; |
| 129 | opts->mnt_opts_flags = NULL; |
| 130 | opts->num_mnt_opts = 0; |
| 131 | } |
| 132 | |
| 133 | static inline void security_free_mnt_opts(struct security_mnt_opts *opts) |
| 134 | { |
| 135 | int i; |
| 136 | if (opts->mnt_opts) |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 137 | for (i = 0; i < opts->num_mnt_opts; i++) |
Eric Paris | e000752 | 2008-03-05 10:31:54 -0500 | [diff] [blame] | 138 | kfree(opts->mnt_opts[i]); |
| 139 | kfree(opts->mnt_opts); |
| 140 | opts->mnt_opts = NULL; |
| 141 | kfree(opts->mnt_opts_flags); |
| 142 | opts->mnt_opts_flags = NULL; |
| 143 | opts->num_mnt_opts = 0; |
| 144 | } |
| 145 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 146 | /** |
| 147 | * struct security_operations - main security structure |
| 148 | * |
Ahmed S. Darwish | 076c54c | 2008-03-06 18:09:10 +0200 | [diff] [blame] | 149 | * Security module identifier. |
| 150 | * |
| 151 | * @name: |
| 152 | * A string that acts as a unique identifeir for the LSM with max number |
| 153 | * of characters = SECURITY_NAME_MAX. |
| 154 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 155 | * Security hooks for program execution operations. |
| 156 | * |
| 157 | * @bprm_alloc_security: |
| 158 | * Allocate and attach a security structure to the @bprm->security field. |
| 159 | * The security field is initialized to NULL when the bprm structure is |
| 160 | * allocated. |
| 161 | * @bprm contains the linux_binprm structure to be modified. |
| 162 | * Return 0 if operation was successful. |
| 163 | * @bprm_free_security: |
| 164 | * @bprm contains the linux_binprm structure to be modified. |
| 165 | * Deallocate and clear the @bprm->security field. |
| 166 | * @bprm_apply_creds: |
| 167 | * Compute and set the security attributes of a process being transformed |
| 168 | * by an execve operation based on the old attributes (current->security) |
| 169 | * and the information saved in @bprm->security by the set_security hook. |
David Howells | d84f4f9 | 2008-11-14 10:39:23 +1100 | [diff] [blame^] | 170 | * Since this function may return an error, in which case the process will |
| 171 | * be killed. However, it can leave the security attributes of the |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 172 | * process unchanged if an access failure occurs at this point. |
| 173 | * bprm_apply_creds is called under task_lock. @unsafe indicates various |
| 174 | * reasons why it may be unsafe to change security state. |
| 175 | * @bprm contains the linux_binprm structure. |
| 176 | * @bprm_post_apply_creds: |
| 177 | * Runs after bprm_apply_creds with the task_lock dropped, so that |
| 178 | * functions which cannot be called safely under the task_lock can |
| 179 | * be used. This hook is a good place to perform state changes on |
| 180 | * the process such as closing open file descriptors to which access |
| 181 | * is no longer granted if the attributes were changed. |
| 182 | * Note that a security module might need to save state between |
| 183 | * bprm_apply_creds and bprm_post_apply_creds to store the decision |
| 184 | * on whether the process may proceed. |
| 185 | * @bprm contains the linux_binprm structure. |
| 186 | * @bprm_set_security: |
| 187 | * Save security information in the bprm->security field, typically based |
| 188 | * on information about the bprm->file, for later use by the apply_creds |
| 189 | * hook. This hook may also optionally check permissions (e.g. for |
| 190 | * transitions between security domains). |
| 191 | * This hook may be called multiple times during a single execve, e.g. for |
| 192 | * interpreters. The hook can tell whether it has already been called by |
| 193 | * checking to see if @bprm->security is non-NULL. If so, then the hook |
| 194 | * may decide either to retain the security information saved earlier or |
| 195 | * to replace it. |
| 196 | * @bprm contains the linux_binprm structure. |
| 197 | * Return 0 if the hook is successful and permission is granted. |
| 198 | * @bprm_check_security: |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 199 | * This hook mediates the point when a search for a binary handler will |
| 200 | * begin. It allows a check the @bprm->security value which is set in |
| 201 | * the preceding set_security call. The primary difference from |
| 202 | * set_security is that the argv list and envp list are reliably |
| 203 | * available in @bprm. This hook may be called multiple times |
| 204 | * during a single execve; and in each pass set_security is called |
| 205 | * first. |
| 206 | * @bprm contains the linux_binprm structure. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 207 | * Return 0 if the hook is successful and permission is granted. |
| 208 | * @bprm_secureexec: |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 209 | * Return a boolean value (0 or 1) indicating whether a "secure exec" |
| 210 | * is required. The flag is passed in the auxiliary table |
| 211 | * on the initial stack to the ELF interpreter to indicate whether libc |
| 212 | * should enable secure mode. |
| 213 | * @bprm contains the linux_binprm structure. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 214 | * |
| 215 | * Security hooks for filesystem operations. |
| 216 | * |
| 217 | * @sb_alloc_security: |
| 218 | * Allocate and attach a security structure to the sb->s_security field. |
| 219 | * The s_security field is initialized to NULL when the structure is |
| 220 | * allocated. |
| 221 | * @sb contains the super_block structure to be modified. |
| 222 | * Return 0 if operation was successful. |
| 223 | * @sb_free_security: |
| 224 | * Deallocate and clear the sb->s_security field. |
| 225 | * @sb contains the super_block structure to be modified. |
| 226 | * @sb_statfs: |
David Howells | 726c334 | 2006-06-23 02:02:58 -0700 | [diff] [blame] | 227 | * Check permission before obtaining filesystem statistics for the @mnt |
| 228 | * mountpoint. |
| 229 | * @dentry is a handle on the superblock for the filesystem. |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 230 | * Return 0 if permission is granted. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 231 | * @sb_mount: |
| 232 | * Check permission before an object specified by @dev_name is mounted on |
| 233 | * the mount point named by @nd. For an ordinary mount, @dev_name |
| 234 | * identifies a device if the file system type requires a device. For a |
| 235 | * remount (@flags & MS_REMOUNT), @dev_name is irrelevant. For a |
| 236 | * loopback/bind mount (@flags & MS_BIND), @dev_name identifies the |
| 237 | * pathname of the object being mounted. |
| 238 | * @dev_name contains the name for object being mounted. |
Al Viro | b5266eb | 2008-03-22 17:48:24 -0400 | [diff] [blame] | 239 | * @path contains the path for mount point object. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 240 | * @type contains the filesystem type. |
| 241 | * @flags contains the mount flags. |
| 242 | * @data contains the filesystem-specific data. |
| 243 | * Return 0 if permission is granted. |
| 244 | * @sb_copy_data: |
| 245 | * Allow mount option data to be copied prior to parsing by the filesystem, |
| 246 | * so that the security module can extract security-specific mount |
| 247 | * options cleanly (a filesystem may modify the data e.g. with strsep()). |
| 248 | * This also allows the original mount data to be stripped of security- |
| 249 | * specific options to avoid having to make filesystems aware of them. |
| 250 | * @type the type of filesystem being mounted. |
| 251 | * @orig the original mount data copied from userspace. |
| 252 | * @copy copied data which will be passed to the security module. |
| 253 | * Returns 0 if the copy was successful. |
| 254 | * @sb_check_sb: |
| 255 | * Check permission before the device with superblock @mnt->sb is mounted |
| 256 | * on the mount point named by @nd. |
| 257 | * @mnt contains the vfsmount for device being mounted. |
Al Viro | b5266eb | 2008-03-22 17:48:24 -0400 | [diff] [blame] | 258 | * @path contains the path for the mount point. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 259 | * Return 0 if permission is granted. |
| 260 | * @sb_umount: |
| 261 | * Check permission before the @mnt file system is unmounted. |
| 262 | * @mnt contains the mounted file system. |
| 263 | * @flags contains the unmount flags, e.g. MNT_FORCE. |
| 264 | * Return 0 if permission is granted. |
| 265 | * @sb_umount_close: |
| 266 | * Close any files in the @mnt mounted filesystem that are held open by |
| 267 | * the security module. This hook is called during an umount operation |
| 268 | * prior to checking whether the filesystem is still busy. |
| 269 | * @mnt contains the mounted filesystem. |
| 270 | * @sb_umount_busy: |
| 271 | * Handle a failed umount of the @mnt mounted filesystem, e.g. re-opening |
| 272 | * any files that were closed by umount_close. This hook is called during |
| 273 | * an umount operation if the umount fails after a call to the |
| 274 | * umount_close hook. |
| 275 | * @mnt contains the mounted filesystem. |
| 276 | * @sb_post_remount: |
| 277 | * Update the security module's state when a filesystem is remounted. |
| 278 | * This hook is only called if the remount was successful. |
| 279 | * @mnt contains the mounted file system. |
| 280 | * @flags contains the new filesystem flags. |
| 281 | * @data contains the filesystem-specific data. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 282 | * @sb_post_addmount: |
| 283 | * Update the security module's state when a filesystem is mounted. |
| 284 | * This hook is called any time a mount is successfully grafetd to |
| 285 | * the tree. |
| 286 | * @mnt contains the mounted filesystem. |
Al Viro | b5266eb | 2008-03-22 17:48:24 -0400 | [diff] [blame] | 287 | * @mountpoint contains the path for the mount point. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 288 | * @sb_pivotroot: |
| 289 | * Check permission before pivoting the root filesystem. |
Al Viro | b5266eb | 2008-03-22 17:48:24 -0400 | [diff] [blame] | 290 | * @old_path contains the path for the new location of the current root (put_old). |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 291 | * @new_path contains the path for the new root (new_root). |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 292 | * Return 0 if permission is granted. |
| 293 | * @sb_post_pivotroot: |
| 294 | * Update module state after a successful pivot. |
Al Viro | b5266eb | 2008-03-22 17:48:24 -0400 | [diff] [blame] | 295 | * @old_path contains the path for the old root. |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 296 | * @new_path contains the path for the new root. |
Eric Paris | c9180a5 | 2007-11-30 13:00:35 -0500 | [diff] [blame] | 297 | * @sb_set_mnt_opts: |
| 298 | * Set the security relevant mount options used for a superblock |
| 299 | * @sb the superblock to set security mount options for |
Eric Paris | e000752 | 2008-03-05 10:31:54 -0500 | [diff] [blame] | 300 | * @opts binary data structure containing all lsm mount data |
Eric Paris | c9180a5 | 2007-11-30 13:00:35 -0500 | [diff] [blame] | 301 | * @sb_clone_mnt_opts: |
| 302 | * Copy all security options from a given superblock to another |
| 303 | * @oldsb old superblock which contain information to clone |
| 304 | * @newsb new superblock which needs filled in |
Eric Paris | e000752 | 2008-03-05 10:31:54 -0500 | [diff] [blame] | 305 | * @sb_parse_opts_str: |
| 306 | * Parse a string of security data filling in the opts structure |
| 307 | * @options string containing all mount options known by the LSM |
| 308 | * @opts binary data structure usable by the LSM |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 309 | * |
| 310 | * Security hooks for inode operations. |
| 311 | * |
| 312 | * @inode_alloc_security: |
| 313 | * Allocate and attach a security structure to @inode->i_security. The |
| 314 | * i_security field is initialized to NULL when the inode structure is |
| 315 | * allocated. |
| 316 | * @inode contains the inode structure. |
| 317 | * Return 0 if operation was successful. |
| 318 | * @inode_free_security: |
| 319 | * @inode contains the inode structure. |
| 320 | * Deallocate the inode security structure and set @inode->i_security to |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 321 | * NULL. |
Stephen Smalley | 5e41ff9 | 2005-09-09 13:01:35 -0700 | [diff] [blame] | 322 | * @inode_init_security: |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 323 | * Obtain the security attribute name suffix and value to set on a newly |
Stephen Smalley | 5e41ff9 | 2005-09-09 13:01:35 -0700 | [diff] [blame] | 324 | * created inode and set up the incore security field for the new inode. |
| 325 | * This hook is called by the fs code as part of the inode creation |
| 326 | * transaction and provides for atomic labeling of the inode, unlike |
| 327 | * the post_create/mkdir/... hooks called by the VFS. The hook function |
| 328 | * is expected to allocate the name and value via kmalloc, with the caller |
| 329 | * being responsible for calling kfree after using them. |
| 330 | * If the security module does not use security attributes or does |
| 331 | * not wish to put a security attribute on this particular inode, |
| 332 | * then it should return -EOPNOTSUPP to skip this processing. |
| 333 | * @inode contains the inode structure of the newly created inode. |
| 334 | * @dir contains the inode structure of the parent directory. |
| 335 | * @name will be set to the allocated name suffix (e.g. selinux). |
| 336 | * @value will be set to the allocated attribute value. |
| 337 | * @len will be set to the length of the value. |
| 338 | * Returns 0 if @name and @value have been successfully set, |
| 339 | * -EOPNOTSUPP if no security attribute is needed, or |
| 340 | * -ENOMEM on memory allocation failure. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 341 | * @inode_create: |
| 342 | * Check permission to create a regular file. |
| 343 | * @dir contains inode structure of the parent of the new file. |
| 344 | * @dentry contains the dentry structure for the file to be created. |
| 345 | * @mode contains the file mode of the file to be created. |
| 346 | * Return 0 if permission is granted. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 347 | * @inode_link: |
| 348 | * Check permission before creating a new hard link to a file. |
| 349 | * @old_dentry contains the dentry structure for an existing link to the file. |
| 350 | * @dir contains the inode structure of the parent directory of the new link. |
| 351 | * @new_dentry contains the dentry structure for the new link. |
| 352 | * Return 0 if permission is granted. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 353 | * @inode_unlink: |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 354 | * Check the permission to remove a hard link to a file. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 355 | * @dir contains the inode structure of parent directory of the file. |
| 356 | * @dentry contains the dentry structure for file to be unlinked. |
| 357 | * Return 0 if permission is granted. |
| 358 | * @inode_symlink: |
| 359 | * Check the permission to create a symbolic link to a file. |
| 360 | * @dir contains the inode structure of parent directory of the symbolic link. |
| 361 | * @dentry contains the dentry structure of the symbolic link. |
| 362 | * @old_name contains the pathname of file. |
| 363 | * Return 0 if permission is granted. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 364 | * @inode_mkdir: |
| 365 | * Check permissions to create a new directory in the existing directory |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 366 | * associated with inode strcture @dir. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 367 | * @dir containst the inode structure of parent of the directory to be created. |
| 368 | * @dentry contains the dentry structure of new directory. |
| 369 | * @mode contains the mode of new directory. |
| 370 | * Return 0 if permission is granted. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 371 | * @inode_rmdir: |
| 372 | * Check the permission to remove a directory. |
| 373 | * @dir contains the inode structure of parent of the directory to be removed. |
| 374 | * @dentry contains the dentry structure of directory to be removed. |
| 375 | * Return 0 if permission is granted. |
| 376 | * @inode_mknod: |
| 377 | * Check permissions when creating a special file (or a socket or a fifo |
| 378 | * file created via the mknod system call). Note that if mknod operation |
| 379 | * is being done for a regular file, then the create hook will be called |
| 380 | * and not this hook. |
| 381 | * @dir contains the inode structure of parent of the new file. |
| 382 | * @dentry contains the dentry structure of the new file. |
| 383 | * @mode contains the mode of the new file. |
Michael Opdenacker | 59c5159 | 2007-05-09 08:57:56 +0200 | [diff] [blame] | 384 | * @dev contains the device number. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 385 | * Return 0 if permission is granted. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 386 | * @inode_rename: |
| 387 | * Check for permission to rename a file or directory. |
| 388 | * @old_dir contains the inode structure for parent of the old link. |
| 389 | * @old_dentry contains the dentry structure of the old link. |
| 390 | * @new_dir contains the inode structure for parent of the new link. |
| 391 | * @new_dentry contains the dentry structure of the new link. |
| 392 | * Return 0 if permission is granted. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 393 | * @inode_readlink: |
| 394 | * Check the permission to read the symbolic link. |
| 395 | * @dentry contains the dentry structure for the file link. |
| 396 | * Return 0 if permission is granted. |
| 397 | * @inode_follow_link: |
| 398 | * Check permission to follow a symbolic link when looking up a pathname. |
| 399 | * @dentry contains the dentry structure for the link. |
| 400 | * @nd contains the nameidata structure for the parent directory. |
| 401 | * Return 0 if permission is granted. |
| 402 | * @inode_permission: |
| 403 | * Check permission before accessing an inode. This hook is called by the |
| 404 | * existing Linux permission function, so a security module can use it to |
| 405 | * provide additional checking for existing Linux permission checks. |
| 406 | * Notice that this hook is called when a file is opened (as well as many |
| 407 | * other operations), whereas the file_security_ops permission hook is |
| 408 | * called when the actual read/write operations are performed. |
| 409 | * @inode contains the inode structure to check. |
| 410 | * @mask contains the permission mask. |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 411 | * @nd contains the nameidata (may be NULL). |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 412 | * Return 0 if permission is granted. |
| 413 | * @inode_setattr: |
| 414 | * Check permission before setting file attributes. Note that the kernel |
| 415 | * call to notify_change is performed from several locations, whenever |
| 416 | * file attributes change (such as when a file is truncated, chown/chmod |
| 417 | * operations, transferring disk quotas, etc). |
| 418 | * @dentry contains the dentry structure for the file. |
| 419 | * @attr is the iattr structure containing the new file attributes. |
| 420 | * Return 0 if permission is granted. |
| 421 | * @inode_getattr: |
| 422 | * Check permission before obtaining file attributes. |
| 423 | * @mnt is the vfsmount where the dentry was looked up |
| 424 | * @dentry contains the dentry structure for the file. |
| 425 | * Return 0 if permission is granted. |
| 426 | * @inode_delete: |
| 427 | * @inode contains the inode structure for deleted inode. |
| 428 | * This hook is called when a deleted inode is released (i.e. an inode |
| 429 | * with no hard links has its use count drop to zero). A security module |
| 430 | * can use this hook to release any persistent label associated with the |
| 431 | * inode. |
| 432 | * @inode_setxattr: |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 433 | * Check permission before setting the extended attributes |
| 434 | * @value identified by @name for @dentry. |
| 435 | * Return 0 if permission is granted. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 436 | * @inode_post_setxattr: |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 437 | * Update inode security field after successful setxattr operation. |
| 438 | * @value identified by @name for @dentry. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 439 | * @inode_getxattr: |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 440 | * Check permission before obtaining the extended attributes |
| 441 | * identified by @name for @dentry. |
| 442 | * Return 0 if permission is granted. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 443 | * @inode_listxattr: |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 444 | * Check permission before obtaining the list of extended attribute |
| 445 | * names for @dentry. |
| 446 | * Return 0 if permission is granted. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 447 | * @inode_removexattr: |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 448 | * Check permission before removing the extended attribute |
| 449 | * identified by @name for @dentry. |
| 450 | * Return 0 if permission is granted. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 451 | * @inode_getsecurity: |
David P. Quigley | 4249259 | 2008-02-04 22:29:39 -0800 | [diff] [blame] | 452 | * Retrieve a copy of the extended attribute representation of the |
| 453 | * security label associated with @name for @inode via @buffer. Note that |
| 454 | * @name is the remainder of the attribute name after the security prefix |
| 455 | * has been removed. @alloc is used to specify of the call should return a |
| 456 | * value via the buffer or just the value length Return size of buffer on |
| 457 | * success. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 458 | * @inode_setsecurity: |
| 459 | * Set the security label associated with @name for @inode from the |
| 460 | * extended attribute value @value. @size indicates the size of the |
| 461 | * @value in bytes. @flags may be XATTR_CREATE, XATTR_REPLACE, or 0. |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 462 | * Note that @name is the remainder of the attribute name after the |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 463 | * security. prefix has been removed. |
| 464 | * Return 0 on success. |
| 465 | * @inode_listsecurity: |
| 466 | * Copy the extended attribute names for the security labels |
| 467 | * associated with @inode into @buffer. The maximum size of @buffer |
| 468 | * is specified by @buffer_size. @buffer may be NULL to request |
| 469 | * the size of the buffer required. |
| 470 | * Returns number of bytes used/required on success. |
Serge E. Hallyn | b537677 | 2007-10-16 23:31:36 -0700 | [diff] [blame] | 471 | * @inode_need_killpriv: |
| 472 | * Called when an inode has been changed. |
| 473 | * @dentry is the dentry being changed. |
| 474 | * Return <0 on error to abort the inode change operation. |
| 475 | * Return 0 if inode_killpriv does not need to be called. |
| 476 | * Return >0 if inode_killpriv does need to be called. |
| 477 | * @inode_killpriv: |
| 478 | * The setuid bit is being removed. Remove similar security labels. |
| 479 | * Called with the dentry->d_inode->i_mutex held. |
| 480 | * @dentry is the dentry being changed. |
| 481 | * Return 0 on success. If error is returned, then the operation |
| 482 | * causing setuid bit removal is failed. |
Ahmed S. Darwish | 8a07619 | 2008-03-01 21:51:09 +0200 | [diff] [blame] | 483 | * @inode_getsecid: |
| 484 | * Get the secid associated with the node. |
| 485 | * @inode contains a pointer to the inode. |
| 486 | * @secid contains a pointer to the location where result will be saved. |
| 487 | * In case of failure, @secid will be set to zero. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 488 | * |
| 489 | * Security hooks for file operations |
| 490 | * |
| 491 | * @file_permission: |
| 492 | * Check file permissions before accessing an open file. This hook is |
| 493 | * called by various operations that read or write files. A security |
| 494 | * module can use this hook to perform additional checking on these |
| 495 | * operations, e.g. to revalidate permissions on use to support privilege |
| 496 | * bracketing or policy changes. Notice that this hook is used when the |
| 497 | * actual read/write operations are performed, whereas the |
| 498 | * inode_security_ops hook is called when a file is opened (as well as |
| 499 | * many other operations). |
| 500 | * Caveat: Although this hook can be used to revalidate permissions for |
| 501 | * various system call operations that read or write files, it does not |
| 502 | * address the revalidation of permissions for memory-mapped files. |
| 503 | * Security modules must handle this separately if they need such |
| 504 | * revalidation. |
| 505 | * @file contains the file structure being accessed. |
| 506 | * @mask contains the requested permissions. |
| 507 | * Return 0 if permission is granted. |
| 508 | * @file_alloc_security: |
| 509 | * Allocate and attach a security structure to the file->f_security field. |
| 510 | * The security field is initialized to NULL when the structure is first |
| 511 | * created. |
| 512 | * @file contains the file structure to secure. |
| 513 | * Return 0 if the hook is successful and permission is granted. |
| 514 | * @file_free_security: |
| 515 | * Deallocate and free any security structures stored in file->f_security. |
| 516 | * @file contains the file structure being modified. |
| 517 | * @file_ioctl: |
| 518 | * @file contains the file structure. |
| 519 | * @cmd contains the operation to perform. |
| 520 | * @arg contains the operational arguments. |
| 521 | * Check permission for an ioctl operation on @file. Note that @arg can |
| 522 | * sometimes represents a user space pointer; in other cases, it may be a |
| 523 | * simple integer value. When @arg represents a user space pointer, it |
| 524 | * should never be used by the security module. |
| 525 | * Return 0 if permission is granted. |
| 526 | * @file_mmap : |
| 527 | * Check permissions for a mmap operation. The @file may be NULL, e.g. |
| 528 | * if mapping anonymous memory. |
| 529 | * @file contains the file structure for file to map (may be NULL). |
| 530 | * @reqprot contains the protection requested by the application. |
| 531 | * @prot contains the protection that will be applied by the kernel. |
| 532 | * @flags contains the operational flags. |
| 533 | * Return 0 if permission is granted. |
| 534 | * @file_mprotect: |
| 535 | * Check permissions before changing memory access permissions. |
| 536 | * @vma contains the memory region to modify. |
| 537 | * @reqprot contains the protection requested by the application. |
| 538 | * @prot contains the protection that will be applied by the kernel. |
| 539 | * Return 0 if permission is granted. |
| 540 | * @file_lock: |
| 541 | * Check permission before performing file locking operations. |
| 542 | * Note: this hook mediates both flock and fcntl style locks. |
| 543 | * @file contains the file structure. |
| 544 | * @cmd contains the posix-translated lock operation to perform |
| 545 | * (e.g. F_RDLCK, F_WRLCK). |
| 546 | * Return 0 if permission is granted. |
| 547 | * @file_fcntl: |
| 548 | * Check permission before allowing the file operation specified by @cmd |
| 549 | * from being performed on the file @file. Note that @arg can sometimes |
| 550 | * represents a user space pointer; in other cases, it may be a simple |
| 551 | * integer value. When @arg represents a user space pointer, it should |
| 552 | * never be used by the security module. |
| 553 | * @file contains the file structure. |
| 554 | * @cmd contains the operation to be performed. |
| 555 | * @arg contains the operational arguments. |
| 556 | * Return 0 if permission is granted. |
| 557 | * @file_set_fowner: |
| 558 | * Save owner security information (typically from current->security) in |
| 559 | * file->f_security for later use by the send_sigiotask hook. |
| 560 | * @file contains the file structure to update. |
| 561 | * Return 0 on success. |
| 562 | * @file_send_sigiotask: |
| 563 | * Check permission for the file owner @fown to send SIGIO or SIGURG to the |
| 564 | * process @tsk. Note that this hook is sometimes called from interrupt. |
| 565 | * Note that the fown_struct, @fown, is never outside the context of a |
| 566 | * struct file, so the file structure (and associated security information) |
| 567 | * can always be obtained: |
Robert P. J. Day | b385a14 | 2007-02-10 01:46:25 -0800 | [diff] [blame] | 568 | * container_of(fown, struct file, f_owner) |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 569 | * @tsk contains the structure of task receiving signal. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 570 | * @fown contains the file owner information. |
| 571 | * @sig is the signal that will be sent. When 0, kernel sends SIGIO. |
| 572 | * Return 0 if permission is granted. |
| 573 | * @file_receive: |
| 574 | * This hook allows security modules to control the ability of a process |
| 575 | * to receive an open file descriptor via socket IPC. |
| 576 | * @file contains the file structure being received. |
| 577 | * Return 0 if permission is granted. |
| 578 | * |
Yuichi Nakamura | 788e7dd | 2007-09-14 09:27:07 +0900 | [diff] [blame] | 579 | * Security hook for dentry |
| 580 | * |
| 581 | * @dentry_open |
| 582 | * Save open-time permission checking state for later use upon |
| 583 | * file_permission, and recheck access if anything has changed |
| 584 | * since inode_permission. |
| 585 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 586 | * Security hooks for task operations. |
| 587 | * |
| 588 | * @task_create: |
| 589 | * Check permission before creating a child process. See the clone(2) |
| 590 | * manual page for definitions of the @clone_flags. |
| 591 | * @clone_flags contains the flags indicating what should be shared. |
| 592 | * Return 0 if permission is granted. |
David Howells | f1752ee | 2008-11-14 10:39:17 +1100 | [diff] [blame] | 593 | * @cred_free: |
| 594 | * @cred points to the credentials. |
| 595 | * Deallocate and clear the cred->security field in a set of credentials. |
David Howells | d84f4f9 | 2008-11-14 10:39:23 +1100 | [diff] [blame^] | 596 | * @cred_prepare: |
| 597 | * @new points to the new credentials. |
| 598 | * @old points to the original credentials. |
| 599 | * @gfp indicates the atomicity of any memory allocations. |
| 600 | * Prepare a new set of credentials by copying the data from the old set. |
| 601 | * @cred_commit: |
| 602 | * @new points to the new credentials. |
| 603 | * @old points to the original credentials. |
| 604 | * Install a new set of credentials. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 605 | * @task_setuid: |
| 606 | * Check permission before setting one or more of the user identity |
| 607 | * attributes of the current process. The @flags parameter indicates |
| 608 | * which of the set*uid system calls invoked this hook and how to |
| 609 | * interpret the @id0, @id1, and @id2 parameters. See the LSM_SETID |
| 610 | * definitions at the beginning of this file for the @flags values and |
| 611 | * their meanings. |
| 612 | * @id0 contains a uid. |
| 613 | * @id1 contains a uid. |
| 614 | * @id2 contains a uid. |
| 615 | * @flags contains one of the LSM_SETID_* values. |
| 616 | * Return 0 if permission is granted. |
David Howells | d84f4f9 | 2008-11-14 10:39:23 +1100 | [diff] [blame^] | 617 | * @task_fix_setuid: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 618 | * Update the module's state after setting one or more of the user |
| 619 | * identity attributes of the current process. The @flags parameter |
| 620 | * indicates which of the set*uid system calls invoked this hook. If |
David Howells | d84f4f9 | 2008-11-14 10:39:23 +1100 | [diff] [blame^] | 621 | * @new is the set of credentials that will be installed. Modifications |
| 622 | * should be made to this rather than to @current->cred. |
| 623 | * @old is the set of credentials that are being replaces |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 624 | * @flags contains one of the LSM_SETID_* values. |
| 625 | * Return 0 on success. |
| 626 | * @task_setgid: |
| 627 | * Check permission before setting one or more of the group identity |
| 628 | * attributes of the current process. The @flags parameter indicates |
| 629 | * which of the set*gid system calls invoked this hook and how to |
| 630 | * interpret the @id0, @id1, and @id2 parameters. See the LSM_SETID |
| 631 | * definitions at the beginning of this file for the @flags values and |
| 632 | * their meanings. |
| 633 | * @id0 contains a gid. |
| 634 | * @id1 contains a gid. |
| 635 | * @id2 contains a gid. |
| 636 | * @flags contains one of the LSM_SETID_* values. |
| 637 | * Return 0 if permission is granted. |
| 638 | * @task_setpgid: |
| 639 | * Check permission before setting the process group identifier of the |
| 640 | * process @p to @pgid. |
| 641 | * @p contains the task_struct for process being modified. |
| 642 | * @pgid contains the new pgid. |
| 643 | * Return 0 if permission is granted. |
| 644 | * @task_getpgid: |
| 645 | * Check permission before getting the process group identifier of the |
| 646 | * process @p. |
| 647 | * @p contains the task_struct for the process. |
| 648 | * Return 0 if permission is granted. |
| 649 | * @task_getsid: |
| 650 | * Check permission before getting the session identifier of the process |
| 651 | * @p. |
| 652 | * @p contains the task_struct for the process. |
| 653 | * Return 0 if permission is granted. |
David Quigley | f9008e4 | 2006-06-30 01:55:46 -0700 | [diff] [blame] | 654 | * @task_getsecid: |
| 655 | * Retrieve the security identifier of the process @p. |
| 656 | * @p contains the task_struct for the process and place is into @secid. |
Ahmed S. Darwish | 8a07619 | 2008-03-01 21:51:09 +0200 | [diff] [blame] | 657 | * In case of failure, @secid will be set to zero. |
| 658 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 659 | * @task_setgroups: |
| 660 | * Check permission before setting the supplementary group set of the |
| 661 | * current process. |
| 662 | * @group_info contains the new group information. |
| 663 | * Return 0 if permission is granted. |
| 664 | * @task_setnice: |
| 665 | * Check permission before setting the nice value of @p to @nice. |
| 666 | * @p contains the task_struct of process. |
| 667 | * @nice contains the new nice value. |
| 668 | * Return 0 if permission is granted. |
James Morris | 03e6806 | 2006-06-23 02:03:58 -0700 | [diff] [blame] | 669 | * @task_setioprio |
| 670 | * Check permission before setting the ioprio value of @p to @ioprio. |
| 671 | * @p contains the task_struct of process. |
| 672 | * @ioprio contains the new ioprio value |
| 673 | * Return 0 if permission is granted. |
David Quigley | a1836a4 | 2006-06-30 01:55:49 -0700 | [diff] [blame] | 674 | * @task_getioprio |
| 675 | * Check permission before getting the ioprio value of @p. |
| 676 | * @p contains the task_struct of process. |
| 677 | * Return 0 if permission is granted. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 678 | * @task_setrlimit: |
| 679 | * Check permission before setting the resource limits of the current |
| 680 | * process for @resource to @new_rlim. The old resource limit values can |
| 681 | * be examined by dereferencing (current->signal->rlim + resource). |
| 682 | * @resource contains the resource whose limit is being set. |
| 683 | * @new_rlim contains the new limits for @resource. |
| 684 | * Return 0 if permission is granted. |
| 685 | * @task_setscheduler: |
| 686 | * Check permission before setting scheduling policy and/or parameters of |
| 687 | * process @p based on @policy and @lp. |
| 688 | * @p contains the task_struct for process. |
| 689 | * @policy contains the scheduling policy. |
| 690 | * @lp contains the scheduling parameters. |
| 691 | * Return 0 if permission is granted. |
| 692 | * @task_getscheduler: |
| 693 | * Check permission before obtaining scheduling information for process |
| 694 | * @p. |
| 695 | * @p contains the task_struct for process. |
| 696 | * Return 0 if permission is granted. |
David Quigley | 3560154 | 2006-06-23 02:04:01 -0700 | [diff] [blame] | 697 | * @task_movememory |
| 698 | * Check permission before moving memory owned by process @p. |
| 699 | * @p contains the task_struct for process. |
| 700 | * Return 0 if permission is granted. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 701 | * @task_kill: |
| 702 | * Check permission before sending signal @sig to @p. @info can be NULL, |
| 703 | * the constant 1, or a pointer to a siginfo structure. If @info is 1 or |
| 704 | * SI_FROMKERNEL(info) is true, then the signal should be viewed as coming |
| 705 | * from the kernel and should typically be permitted. |
| 706 | * SIGIO signals are handled separately by the send_sigiotask hook in |
| 707 | * file_security_ops. |
| 708 | * @p contains the task_struct for process. |
| 709 | * @info contains the signal information. |
| 710 | * @sig contains the signal value. |
David Quigley | f9008e4 | 2006-06-30 01:55:46 -0700 | [diff] [blame] | 711 | * @secid contains the sid of the process where the signal originated |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 712 | * Return 0 if permission is granted. |
| 713 | * @task_wait: |
| 714 | * Check permission before allowing a process to reap a child process @p |
| 715 | * and collect its status information. |
| 716 | * @p contains the task_struct for process. |
| 717 | * Return 0 if permission is granted. |
| 718 | * @task_prctl: |
| 719 | * Check permission before performing a process control operation on the |
| 720 | * current process. |
| 721 | * @option contains the operation. |
| 722 | * @arg2 contains a argument. |
| 723 | * @arg3 contains a argument. |
| 724 | * @arg4 contains a argument. |
| 725 | * @arg5 contains a argument. |
David Howells | d84f4f9 | 2008-11-14 10:39:23 +1100 | [diff] [blame^] | 726 | * Return -ENOSYS if no-one wanted to handle this op, any other value to |
| 727 | * cause prctl() to return immediately with that value. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 728 | * @task_to_inode: |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 729 | * Set the security attributes for an inode based on an associated task's |
| 730 | * security attributes, e.g. for /proc/pid inodes. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 731 | * @p contains the task_struct for the task. |
| 732 | * @inode contains the inode structure for the inode. |
| 733 | * |
| 734 | * Security hooks for Netlink messaging. |
| 735 | * |
| 736 | * @netlink_send: |
| 737 | * Save security information for a netlink message so that permission |
| 738 | * checking can be performed when the message is processed. The security |
| 739 | * information can be saved using the eff_cap field of the |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 740 | * netlink_skb_parms structure. Also may be used to provide fine |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 741 | * grained control over message transmission. |
| 742 | * @sk associated sock of task sending the message., |
| 743 | * @skb contains the sk_buff structure for the netlink message. |
| 744 | * Return 0 if the information was successfully saved and message |
| 745 | * is allowed to be transmitted. |
| 746 | * @netlink_recv: |
| 747 | * Check permission before processing the received netlink message in |
| 748 | * @skb. |
| 749 | * @skb contains the sk_buff structure for the netlink message. |
Darrel Goeddel | c7bdb54 | 2006-06-27 13:26:11 -0700 | [diff] [blame] | 750 | * @cap indicates the capability required |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 751 | * Return 0 if permission is granted. |
| 752 | * |
| 753 | * Security hooks for Unix domain networking. |
| 754 | * |
| 755 | * @unix_stream_connect: |
| 756 | * Check permissions before establishing a Unix domain stream connection |
| 757 | * between @sock and @other. |
| 758 | * @sock contains the socket structure. |
| 759 | * @other contains the peer socket structure. |
| 760 | * Return 0 if permission is granted. |
| 761 | * @unix_may_send: |
| 762 | * Check permissions before connecting or sending datagrams from @sock to |
| 763 | * @other. |
| 764 | * @sock contains the socket structure. |
| 765 | * @sock contains the peer socket structure. |
| 766 | * Return 0 if permission is granted. |
| 767 | * |
| 768 | * The @unix_stream_connect and @unix_may_send hooks were necessary because |
| 769 | * Linux provides an alternative to the conventional file name space for Unix |
| 770 | * domain sockets. Whereas binding and connecting to sockets in the file name |
| 771 | * space is mediated by the typical file permissions (and caught by the mknod |
| 772 | * and permission hooks in inode_security_ops), binding and connecting to |
| 773 | * sockets in the abstract name space is completely unmediated. Sufficient |
| 774 | * control of Unix domain sockets in the abstract name space isn't possible |
| 775 | * using only the socket layer hooks, since we need to know the actual target |
| 776 | * socket, which is not looked up until we are inside the af_unix code. |
| 777 | * |
| 778 | * Security hooks for socket operations. |
| 779 | * |
| 780 | * @socket_create: |
| 781 | * Check permissions prior to creating a new socket. |
| 782 | * @family contains the requested protocol family. |
| 783 | * @type contains the requested communications type. |
| 784 | * @protocol contains the requested protocol. |
| 785 | * @kern set to 1 if a kernel socket. |
| 786 | * Return 0 if permission is granted. |
| 787 | * @socket_post_create: |
| 788 | * This hook allows a module to update or allocate a per-socket security |
| 789 | * structure. Note that the security field was not added directly to the |
| 790 | * socket structure, but rather, the socket security information is stored |
| 791 | * in the associated inode. Typically, the inode alloc_security hook will |
| 792 | * allocate and and attach security information to |
| 793 | * sock->inode->i_security. This hook may be used to update the |
| 794 | * sock->inode->i_security field with additional information that wasn't |
| 795 | * available when the inode was allocated. |
| 796 | * @sock contains the newly created socket structure. |
| 797 | * @family contains the requested protocol family. |
| 798 | * @type contains the requested communications type. |
| 799 | * @protocol contains the requested protocol. |
| 800 | * @kern set to 1 if a kernel socket. |
| 801 | * @socket_bind: |
| 802 | * Check permission before socket protocol layer bind operation is |
| 803 | * performed and the socket @sock is bound to the address specified in the |
| 804 | * @address parameter. |
| 805 | * @sock contains the socket structure. |
| 806 | * @address contains the address to bind to. |
| 807 | * @addrlen contains the length of address. |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 808 | * Return 0 if permission is granted. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 809 | * @socket_connect: |
| 810 | * Check permission before socket protocol layer connect operation |
| 811 | * attempts to connect socket @sock to a remote address, @address. |
| 812 | * @sock contains the socket structure. |
| 813 | * @address contains the address of remote endpoint. |
| 814 | * @addrlen contains the length of address. |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 815 | * Return 0 if permission is granted. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 816 | * @socket_listen: |
| 817 | * Check permission before socket protocol layer listen operation. |
| 818 | * @sock contains the socket structure. |
| 819 | * @backlog contains the maximum length for the pending connection queue. |
| 820 | * Return 0 if permission is granted. |
| 821 | * @socket_accept: |
| 822 | * Check permission before accepting a new connection. Note that the new |
| 823 | * socket, @newsock, has been created and some information copied to it, |
| 824 | * but the accept operation has not actually been performed. |
| 825 | * @sock contains the listening socket structure. |
| 826 | * @newsock contains the newly created server socket for connection. |
| 827 | * Return 0 if permission is granted. |
| 828 | * @socket_post_accept: |
| 829 | * This hook allows a security module to copy security |
| 830 | * information into the newly created socket's inode. |
| 831 | * @sock contains the listening socket structure. |
| 832 | * @newsock contains the newly created server socket for connection. |
| 833 | * @socket_sendmsg: |
| 834 | * Check permission before transmitting a message to another socket. |
| 835 | * @sock contains the socket structure. |
| 836 | * @msg contains the message to be transmitted. |
| 837 | * @size contains the size of message. |
| 838 | * Return 0 if permission is granted. |
| 839 | * @socket_recvmsg: |
| 840 | * Check permission before receiving a message from a socket. |
| 841 | * @sock contains the socket structure. |
| 842 | * @msg contains the message structure. |
| 843 | * @size contains the size of message structure. |
| 844 | * @flags contains the operational flags. |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 845 | * Return 0 if permission is granted. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 846 | * @socket_getsockname: |
| 847 | * Check permission before the local address (name) of the socket object |
| 848 | * @sock is retrieved. |
| 849 | * @sock contains the socket structure. |
| 850 | * Return 0 if permission is granted. |
| 851 | * @socket_getpeername: |
| 852 | * Check permission before the remote address (name) of a socket object |
| 853 | * @sock is retrieved. |
| 854 | * @sock contains the socket structure. |
| 855 | * Return 0 if permission is granted. |
| 856 | * @socket_getsockopt: |
| 857 | * Check permissions before retrieving the options associated with socket |
| 858 | * @sock. |
| 859 | * @sock contains the socket structure. |
| 860 | * @level contains the protocol level to retrieve option from. |
| 861 | * @optname contains the name of option to retrieve. |
| 862 | * Return 0 if permission is granted. |
| 863 | * @socket_setsockopt: |
| 864 | * Check permissions before setting the options associated with socket |
| 865 | * @sock. |
| 866 | * @sock contains the socket structure. |
| 867 | * @level contains the protocol level to set options for. |
| 868 | * @optname contains the name of the option to set. |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 869 | * Return 0 if permission is granted. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 870 | * @socket_shutdown: |
| 871 | * Checks permission before all or part of a connection on the socket |
| 872 | * @sock is shut down. |
| 873 | * @sock contains the socket structure. |
| 874 | * @how contains the flag indicating how future sends and receives are handled. |
| 875 | * Return 0 if permission is granted. |
| 876 | * @socket_sock_rcv_skb: |
| 877 | * Check permissions on incoming network packets. This hook is distinct |
| 878 | * from Netfilter's IP input hooks since it is the first time that the |
| 879 | * incoming sk_buff @skb has been associated with a particular socket, @sk. |
| 880 | * @sk contains the sock (not socket) associated with the incoming sk_buff. |
| 881 | * @skb contains the incoming network data. |
Serge Hallyn | 6da34ba | 2007-10-20 00:53:30 +0200 | [diff] [blame] | 882 | * @socket_getpeersec_stream: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 883 | * This hook allows the security module to provide peer socket security |
Serge Hallyn | 6da34ba | 2007-10-20 00:53:30 +0200 | [diff] [blame] | 884 | * state for unix or connected tcp sockets to userspace via getsockopt |
| 885 | * SO_GETPEERSEC. For tcp sockets this can be meaningful if the |
| 886 | * socket is associated with an ipsec SA. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 887 | * @sock is the local socket. |
| 888 | * @optval userspace memory where the security state is to be copied. |
| 889 | * @optlen userspace int where the module should copy the actual length |
| 890 | * of the security state. |
| 891 | * @len as input is the maximum length to copy to userspace provided |
| 892 | * by the caller. |
| 893 | * Return 0 if all is well, otherwise, typical getsockopt return |
| 894 | * values. |
Serge Hallyn | 6da34ba | 2007-10-20 00:53:30 +0200 | [diff] [blame] | 895 | * @socket_getpeersec_dgram: |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 896 | * This hook allows the security module to provide peer socket security |
| 897 | * state for udp sockets on a per-packet basis to userspace via |
| 898 | * getsockopt SO_GETPEERSEC. The application must first have indicated |
| 899 | * the IP_PASSSEC option via getsockopt. It can then retrieve the |
| 900 | * security state returned by this hook for a packet via the SCM_SECURITY |
| 901 | * ancillary message type. |
| 902 | * @skb is the skbuff for the packet being queried |
| 903 | * @secdata is a pointer to a buffer in which to copy the security data |
| 904 | * @seclen is the maximum length for @secdata |
| 905 | * Return 0 on success, error on failure. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 906 | * @sk_alloc_security: |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 907 | * Allocate and attach a security structure to the sk->sk_security field, |
| 908 | * which is used to copy security attributes between local stream sockets. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 909 | * @sk_free_security: |
| 910 | * Deallocate security structure. |
Venkat Yekkirala | 892c141 | 2006-08-04 23:08:56 -0700 | [diff] [blame] | 911 | * @sk_clone_security: |
| 912 | * Clone/copy security structure. |
Venkat Yekkirala | beb8d13 | 2006-08-04 23:12:42 -0700 | [diff] [blame] | 913 | * @sk_getsecid: |
| 914 | * Retrieve the LSM-specific secid for the sock to enable caching of network |
Trent Jaeger | df71837 | 2005-12-13 23:12:27 -0800 | [diff] [blame] | 915 | * authorizations. |
Venkat Yekkirala | 4237c75 | 2006-07-24 23:32:50 -0700 | [diff] [blame] | 916 | * @sock_graft: |
| 917 | * Sets the socket's isec sid to the sock's sid. |
| 918 | * @inet_conn_request: |
| 919 | * Sets the openreq's sid to socket's sid with MLS portion taken from peer sid. |
| 920 | * @inet_csk_clone: |
| 921 | * Sets the new child socket's sid to the openreq sid. |
Venkat Yekkirala | 6b87769 | 2006-11-08 17:04:09 -0600 | [diff] [blame] | 922 | * @inet_conn_established: |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 923 | * Sets the connection's peersid to the secmark on skb. |
Venkat Yekkirala | 4237c75 | 2006-07-24 23:32:50 -0700 | [diff] [blame] | 924 | * @req_classify_flow: |
| 925 | * Sets the flow's sid to the openreq sid. |
Trent Jaeger | df71837 | 2005-12-13 23:12:27 -0800 | [diff] [blame] | 926 | * |
| 927 | * Security hooks for XFRM operations. |
| 928 | * |
| 929 | * @xfrm_policy_alloc_security: |
Paul Moore | 03e1ad7 | 2008-04-12 19:07:52 -0700 | [diff] [blame] | 930 | * @ctxp is a pointer to the xfrm_sec_ctx being added to Security Policy |
| 931 | * Database used by the XFRM system. |
Trent Jaeger | df71837 | 2005-12-13 23:12:27 -0800 | [diff] [blame] | 932 | * @sec_ctx contains the security context information being provided by |
| 933 | * the user-level policy update program (e.g., setkey). |
Venkat Yekkirala | e0d1caa | 2006-07-24 23:29:07 -0700 | [diff] [blame] | 934 | * Allocate a security structure to the xp->security field; the security |
Venkat Yekkirala | c1a856c | 2006-11-08 17:03:44 -0600 | [diff] [blame] | 935 | * field is initialized to NULL when the xfrm_policy is allocated. |
Trent Jaeger | df71837 | 2005-12-13 23:12:27 -0800 | [diff] [blame] | 936 | * Return 0 if operation was successful (memory to allocate, legal context) |
| 937 | * @xfrm_policy_clone_security: |
Paul Moore | 03e1ad7 | 2008-04-12 19:07:52 -0700 | [diff] [blame] | 938 | * @old_ctx contains an existing xfrm_sec_ctx. |
| 939 | * @new_ctxp contains a new xfrm_sec_ctx being cloned from old. |
| 940 | * Allocate a security structure in new_ctxp that contains the |
| 941 | * information from the old_ctx structure. |
Trent Jaeger | df71837 | 2005-12-13 23:12:27 -0800 | [diff] [blame] | 942 | * Return 0 if operation was successful (memory to allocate). |
| 943 | * @xfrm_policy_free_security: |
Paul Moore | 03e1ad7 | 2008-04-12 19:07:52 -0700 | [diff] [blame] | 944 | * @ctx contains the xfrm_sec_ctx |
Catherine Zhang | c8c05a8 | 2006-06-08 23:39:49 -0700 | [diff] [blame] | 945 | * Deallocate xp->security. |
| 946 | * @xfrm_policy_delete_security: |
Paul Moore | 03e1ad7 | 2008-04-12 19:07:52 -0700 | [diff] [blame] | 947 | * @ctx contains the xfrm_sec_ctx. |
Catherine Zhang | c8c05a8 | 2006-06-08 23:39:49 -0700 | [diff] [blame] | 948 | * Authorize deletion of xp->security. |
Trent Jaeger | df71837 | 2005-12-13 23:12:27 -0800 | [diff] [blame] | 949 | * @xfrm_state_alloc_security: |
| 950 | * @x contains the xfrm_state being added to the Security Association |
| 951 | * Database by the XFRM system. |
| 952 | * @sec_ctx contains the security context information being provided by |
| 953 | * the user-level SA generation program (e.g., setkey or racoon). |
Venkat Yekkirala | e0d1caa | 2006-07-24 23:29:07 -0700 | [diff] [blame] | 954 | * @secid contains the secid from which to take the mls portion of the context. |
| 955 | * Allocate a security structure to the x->security field; the security |
| 956 | * field is initialized to NULL when the xfrm_state is allocated. Set the |
| 957 | * context to correspond to either sec_ctx or polsec, with the mls portion |
| 958 | * taken from secid in the latter case. |
Trent Jaeger | df71837 | 2005-12-13 23:12:27 -0800 | [diff] [blame] | 959 | * Return 0 if operation was successful (memory to allocate, legal context). |
| 960 | * @xfrm_state_free_security: |
| 961 | * @x contains the xfrm_state. |
Catherine Zhang | c8c05a8 | 2006-06-08 23:39:49 -0700 | [diff] [blame] | 962 | * Deallocate x->security. |
| 963 | * @xfrm_state_delete_security: |
| 964 | * @x contains the xfrm_state. |
| 965 | * Authorize deletion of x->security. |
Trent Jaeger | df71837 | 2005-12-13 23:12:27 -0800 | [diff] [blame] | 966 | * @xfrm_policy_lookup: |
Paul Moore | 03e1ad7 | 2008-04-12 19:07:52 -0700 | [diff] [blame] | 967 | * @ctx contains the xfrm_sec_ctx for which the access control is being |
Trent Jaeger | df71837 | 2005-12-13 23:12:27 -0800 | [diff] [blame] | 968 | * checked. |
Venkat Yekkirala | e0d1caa | 2006-07-24 23:29:07 -0700 | [diff] [blame] | 969 | * @fl_secid contains the flow security label that is used to authorize |
Trent Jaeger | df71837 | 2005-12-13 23:12:27 -0800 | [diff] [blame] | 970 | * access to the policy xp. |
| 971 | * @dir contains the direction of the flow (input or output). |
Venkat Yekkirala | e0d1caa | 2006-07-24 23:29:07 -0700 | [diff] [blame] | 972 | * Check permission when a flow selects a xfrm_policy for processing |
Trent Jaeger | df71837 | 2005-12-13 23:12:27 -0800 | [diff] [blame] | 973 | * XFRMs on a packet. The hook is called when selecting either a |
| 974 | * per-socket policy or a generic xfrm policy. |
Venkat Yekkirala | 5b368e6 | 2006-10-05 15:42:18 -0500 | [diff] [blame] | 975 | * Return 0 if permission is granted, -ESRCH otherwise, or -errno |
| 976 | * on other errors. |
Venkat Yekkirala | e0d1caa | 2006-07-24 23:29:07 -0700 | [diff] [blame] | 977 | * @xfrm_state_pol_flow_match: |
| 978 | * @x contains the state to match. |
| 979 | * @xp contains the policy to check for a match. |
| 980 | * @fl contains the flow to check for a match. |
| 981 | * Return 1 if there is a match. |
Venkat Yekkirala | e0d1caa | 2006-07-24 23:29:07 -0700 | [diff] [blame] | 982 | * @xfrm_decode_session: |
| 983 | * @skb points to skb to decode. |
Venkat Yekkirala | beb8d13 | 2006-08-04 23:12:42 -0700 | [diff] [blame] | 984 | * @secid points to the flow key secid to set. |
| 985 | * @ckall says if all xfrms used should be checked for same secid. |
| 986 | * Return 0 if ckall is zero or all xfrms used have the same secid. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 987 | * |
David Howells | 29db919 | 2005-10-30 15:02:44 -0800 | [diff] [blame] | 988 | * Security hooks affecting all Key Management operations |
| 989 | * |
| 990 | * @key_alloc: |
| 991 | * Permit allocation of a key and assign security data. Note that key does |
| 992 | * not have a serial number assigned at this point. |
| 993 | * @key points to the key. |
David Howells | 7e047ef | 2006-06-26 00:24:50 -0700 | [diff] [blame] | 994 | * @flags is the allocation flags |
David Howells | 29db919 | 2005-10-30 15:02:44 -0800 | [diff] [blame] | 995 | * Return 0 if permission is granted, -ve error otherwise. |
| 996 | * @key_free: |
| 997 | * Notification of destruction; free security data. |
| 998 | * @key points to the key. |
| 999 | * No return value. |
| 1000 | * @key_permission: |
| 1001 | * See whether a specific operational right is granted to a process on a |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1002 | * key. |
David Howells | 29db919 | 2005-10-30 15:02:44 -0800 | [diff] [blame] | 1003 | * @key_ref refers to the key (key pointer + possession attribute bit). |
David Howells | d84f4f9 | 2008-11-14 10:39:23 +1100 | [diff] [blame^] | 1004 | * @cred points to the credentials to provide the context against which to |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1005 | * evaluate the security data on the key. |
David Howells | 29db919 | 2005-10-30 15:02:44 -0800 | [diff] [blame] | 1006 | * @perm describes the combination of permissions required of this key. |
| 1007 | * Return 1 if permission granted, 0 if permission denied and -ve it the |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1008 | * normal permissions model should be effected. |
David Howells | 70a5bb7 | 2008-04-29 01:01:26 -0700 | [diff] [blame] | 1009 | * @key_getsecurity: |
| 1010 | * Get a textual representation of the security context attached to a key |
| 1011 | * for the purposes of honouring KEYCTL_GETSECURITY. This function |
| 1012 | * allocates the storage for the NUL-terminated string and the caller |
| 1013 | * should free it. |
| 1014 | * @key points to the key to be queried. |
| 1015 | * @_buffer points to a pointer that should be set to point to the |
| 1016 | * resulting string (if no label or an error occurs). |
| 1017 | * Return the length of the string (including terminating NUL) or -ve if |
| 1018 | * an error. |
| 1019 | * May also return 0 (and a NULL buffer pointer) if there is no label. |
David Howells | 29db919 | 2005-10-30 15:02:44 -0800 | [diff] [blame] | 1020 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1021 | * Security hooks affecting all System V IPC operations. |
| 1022 | * |
| 1023 | * @ipc_permission: |
| 1024 | * Check permissions for access to IPC |
| 1025 | * @ipcp contains the kernel IPC permission structure |
| 1026 | * @flag contains the desired (requested) permission set |
| 1027 | * Return 0 if permission is granted. |
Ahmed S. Darwish | 8a07619 | 2008-03-01 21:51:09 +0200 | [diff] [blame] | 1028 | * @ipc_getsecid: |
| 1029 | * Get the secid associated with the ipc object. |
| 1030 | * @ipcp contains the kernel IPC permission structure. |
| 1031 | * @secid contains a pointer to the location where result will be saved. |
| 1032 | * In case of failure, @secid will be set to zero. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1033 | * |
| 1034 | * Security hooks for individual messages held in System V IPC message queues |
| 1035 | * @msg_msg_alloc_security: |
| 1036 | * Allocate and attach a security structure to the msg->security field. |
| 1037 | * The security field is initialized to NULL when the structure is first |
| 1038 | * created. |
| 1039 | * @msg contains the message structure to be modified. |
| 1040 | * Return 0 if operation was successful and permission is granted. |
| 1041 | * @msg_msg_free_security: |
| 1042 | * Deallocate the security structure for this message. |
| 1043 | * @msg contains the message structure to be modified. |
| 1044 | * |
| 1045 | * Security hooks for System V IPC Message Queues |
| 1046 | * |
| 1047 | * @msg_queue_alloc_security: |
| 1048 | * Allocate and attach a security structure to the |
| 1049 | * msq->q_perm.security field. The security field is initialized to |
| 1050 | * NULL when the structure is first created. |
| 1051 | * @msq contains the message queue structure to be modified. |
| 1052 | * Return 0 if operation was successful and permission is granted. |
| 1053 | * @msg_queue_free_security: |
| 1054 | * Deallocate security structure for this message queue. |
| 1055 | * @msq contains the message queue structure to be modified. |
| 1056 | * @msg_queue_associate: |
| 1057 | * Check permission when a message queue is requested through the |
| 1058 | * msgget system call. This hook is only called when returning the |
| 1059 | * message queue identifier for an existing message queue, not when a |
| 1060 | * new message queue is created. |
| 1061 | * @msq contains the message queue to act upon. |
| 1062 | * @msqflg contains the operation control flags. |
| 1063 | * Return 0 if permission is granted. |
| 1064 | * @msg_queue_msgctl: |
| 1065 | * Check permission when a message control operation specified by @cmd |
| 1066 | * is to be performed on the message queue @msq. |
| 1067 | * The @msq may be NULL, e.g. for IPC_INFO or MSG_INFO. |
| 1068 | * @msq contains the message queue to act upon. May be NULL. |
| 1069 | * @cmd contains the operation to be performed. |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1070 | * Return 0 if permission is granted. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1071 | * @msg_queue_msgsnd: |
| 1072 | * Check permission before a message, @msg, is enqueued on the message |
| 1073 | * queue, @msq. |
| 1074 | * @msq contains the message queue to send message to. |
| 1075 | * @msg contains the message to be enqueued. |
| 1076 | * @msqflg contains operational flags. |
| 1077 | * Return 0 if permission is granted. |
| 1078 | * @msg_queue_msgrcv: |
| 1079 | * Check permission before a message, @msg, is removed from the message |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1080 | * queue, @msq. The @target task structure contains a pointer to the |
| 1081 | * process that will be receiving the message (not equal to the current |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1082 | * process when inline receives are being performed). |
| 1083 | * @msq contains the message queue to retrieve message from. |
| 1084 | * @msg contains the message destination. |
| 1085 | * @target contains the task structure for recipient process. |
| 1086 | * @type contains the type of message requested. |
| 1087 | * @mode contains the operational flags. |
| 1088 | * Return 0 if permission is granted. |
| 1089 | * |
| 1090 | * Security hooks for System V Shared Memory Segments |
| 1091 | * |
| 1092 | * @shm_alloc_security: |
| 1093 | * Allocate and attach a security structure to the shp->shm_perm.security |
| 1094 | * field. The security field is initialized to NULL when the structure is |
| 1095 | * first created. |
| 1096 | * @shp contains the shared memory structure to be modified. |
| 1097 | * Return 0 if operation was successful and permission is granted. |
| 1098 | * @shm_free_security: |
| 1099 | * Deallocate the security struct for this memory segment. |
| 1100 | * @shp contains the shared memory structure to be modified. |
| 1101 | * @shm_associate: |
| 1102 | * Check permission when a shared memory region is requested through the |
| 1103 | * shmget system call. This hook is only called when returning the shared |
| 1104 | * memory region identifier for an existing region, not when a new shared |
| 1105 | * memory region is created. |
| 1106 | * @shp contains the shared memory structure to be modified. |
| 1107 | * @shmflg contains the operation control flags. |
| 1108 | * Return 0 if permission is granted. |
| 1109 | * @shm_shmctl: |
| 1110 | * Check permission when a shared memory control operation specified by |
| 1111 | * @cmd is to be performed on the shared memory region @shp. |
| 1112 | * The @shp may be NULL, e.g. for IPC_INFO or SHM_INFO. |
| 1113 | * @shp contains shared memory structure to be modified. |
| 1114 | * @cmd contains the operation to be performed. |
| 1115 | * Return 0 if permission is granted. |
| 1116 | * @shm_shmat: |
| 1117 | * Check permissions prior to allowing the shmat system call to attach the |
| 1118 | * shared memory segment @shp to the data segment of the calling process. |
| 1119 | * The attaching address is specified by @shmaddr. |
| 1120 | * @shp contains the shared memory structure to be modified. |
| 1121 | * @shmaddr contains the address to attach memory region to. |
| 1122 | * @shmflg contains the operational flags. |
| 1123 | * Return 0 if permission is granted. |
| 1124 | * |
| 1125 | * Security hooks for System V Semaphores |
| 1126 | * |
| 1127 | * @sem_alloc_security: |
| 1128 | * Allocate and attach a security structure to the sma->sem_perm.security |
| 1129 | * field. The security field is initialized to NULL when the structure is |
| 1130 | * first created. |
| 1131 | * @sma contains the semaphore structure |
| 1132 | * Return 0 if operation was successful and permission is granted. |
| 1133 | * @sem_free_security: |
| 1134 | * deallocate security struct for this semaphore |
| 1135 | * @sma contains the semaphore structure. |
| 1136 | * @sem_associate: |
| 1137 | * Check permission when a semaphore is requested through the semget |
| 1138 | * system call. This hook is only called when returning the semaphore |
| 1139 | * identifier for an existing semaphore, not when a new one must be |
| 1140 | * created. |
| 1141 | * @sma contains the semaphore structure. |
| 1142 | * @semflg contains the operation control flags. |
| 1143 | * Return 0 if permission is granted. |
| 1144 | * @sem_semctl: |
| 1145 | * Check permission when a semaphore operation specified by @cmd is to be |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1146 | * performed on the semaphore @sma. The @sma may be NULL, e.g. for |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1147 | * IPC_INFO or SEM_INFO. |
| 1148 | * @sma contains the semaphore structure. May be NULL. |
| 1149 | * @cmd contains the operation to be performed. |
| 1150 | * Return 0 if permission is granted. |
| 1151 | * @sem_semop |
| 1152 | * Check permissions before performing operations on members of the |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1153 | * semaphore set @sma. If the @alter flag is nonzero, the semaphore set |
| 1154 | * may be modified. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1155 | * @sma contains the semaphore structure. |
| 1156 | * @sops contains the operations to perform. |
| 1157 | * @nsops contains the number of operations to perform. |
| 1158 | * @alter contains the flag indicating whether changes are to be made. |
| 1159 | * Return 0 if permission is granted. |
| 1160 | * |
David Howells | 5cd9c58 | 2008-08-14 11:37:28 +0100 | [diff] [blame] | 1161 | * @ptrace_may_access: |
| 1162 | * Check permission before allowing the current process to trace the |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1163 | * @child process. |
| 1164 | * Security modules may also want to perform a process tracing check |
| 1165 | * during an execve in the set_security or apply_creds hooks of |
David Howells | d84f4f9 | 2008-11-14 10:39:23 +1100 | [diff] [blame^] | 1166 | * tracing check during an execve in the bprm_set_creds hook of |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1167 | * binprm_security_ops if the process is being traced and its security |
| 1168 | * attributes would be changed by the execve. |
David Howells | 5cd9c58 | 2008-08-14 11:37:28 +0100 | [diff] [blame] | 1169 | * @child contains the task_struct structure for the target process. |
Stephen Smalley | 006ebb4 | 2008-05-19 08:32:49 -0400 | [diff] [blame] | 1170 | * @mode contains the PTRACE_MODE flags indicating the form of access. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1171 | * Return 0 if permission is granted. |
David Howells | 5cd9c58 | 2008-08-14 11:37:28 +0100 | [diff] [blame] | 1172 | * @ptrace_traceme: |
| 1173 | * Check that the @parent process has sufficient permission to trace the |
| 1174 | * current process before allowing the current process to present itself |
| 1175 | * to the @parent process for tracing. |
| 1176 | * The parent process will still have to undergo the ptrace_may_access |
| 1177 | * checks before it is allowed to trace this one. |
| 1178 | * @parent contains the task_struct structure for debugger process. |
| 1179 | * Return 0 if permission is granted. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1180 | * @capget: |
| 1181 | * Get the @effective, @inheritable, and @permitted capability sets for |
| 1182 | * the @target process. The hook may also perform permission checking to |
| 1183 | * determine if the current process is allowed to see the capability sets |
| 1184 | * of the @target process. |
| 1185 | * @target contains the task_struct structure for target process. |
| 1186 | * @effective contains the effective capability set. |
| 1187 | * @inheritable contains the inheritable capability set. |
| 1188 | * @permitted contains the permitted capability set. |
| 1189 | * Return 0 if the capability sets were successfully obtained. |
David Howells | d84f4f9 | 2008-11-14 10:39:23 +1100 | [diff] [blame^] | 1190 | * @capset: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1191 | * Set the @effective, @inheritable, and @permitted capability sets for |
David Howells | 1cdcbec | 2008-11-14 10:39:14 +1100 | [diff] [blame] | 1192 | * the current process. |
David Howells | d84f4f9 | 2008-11-14 10:39:23 +1100 | [diff] [blame^] | 1193 | * @new contains the new credentials structure for target process. |
| 1194 | * @old contains the current credentials structure for target process. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1195 | * @effective contains the effective capability set. |
| 1196 | * @inheritable contains the inheritable capability set. |
| 1197 | * @permitted contains the permitted capability set. |
David Howells | d84f4f9 | 2008-11-14 10:39:23 +1100 | [diff] [blame^] | 1198 | * Return 0 and update @new if permission is granted. |
Chris Wright | 12b5989 | 2006-03-25 03:07:41 -0800 | [diff] [blame] | 1199 | * @capable: |
| 1200 | * Check whether the @tsk process has the @cap capability. |
| 1201 | * @tsk contains the task_struct for the process. |
| 1202 | * @cap contains the capability <include/linux/capability.h>. |
| 1203 | * Return 0 if the capability is granted for @tsk. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1204 | * @acct: |
| 1205 | * Check permission before enabling or disabling process accounting. If |
| 1206 | * accounting is being enabled, then @file refers to the open file used to |
| 1207 | * store accounting records. If accounting is being disabled, then @file |
| 1208 | * is NULL. |
| 1209 | * @file contains the file structure for the accounting file (may be NULL). |
| 1210 | * Return 0 if permission is granted. |
| 1211 | * @sysctl: |
| 1212 | * Check permission before accessing the @table sysctl variable in the |
| 1213 | * manner specified by @op. |
| 1214 | * @table contains the ctl_table structure for the sysctl variable. |
| 1215 | * @op contains the operation (001 = search, 002 = write, 004 = read). |
| 1216 | * Return 0 if permission is granted. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1217 | * @syslog: |
| 1218 | * Check permission before accessing the kernel message ring or changing |
| 1219 | * logging to the console. |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1220 | * See the syslog(2) manual page for an explanation of the @type values. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1221 | * @type contains the type of action. |
| 1222 | * Return 0 if permission is granted. |
| 1223 | * @settime: |
| 1224 | * Check permission to change the system time. |
| 1225 | * struct timespec and timezone are defined in include/linux/time.h |
| 1226 | * @ts contains new time |
| 1227 | * @tz contains new timezone |
| 1228 | * Return 0 if permission is granted. |
| 1229 | * @vm_enough_memory: |
| 1230 | * Check permissions for allocating a new virtual mapping. |
Alan Cox | 34b4e4a | 2007-08-22 14:01:28 -0700 | [diff] [blame] | 1231 | * @mm contains the mm struct it is being added to. |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1232 | * @pages contains the number of pages. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1233 | * Return 0 if permission is granted. |
| 1234 | * |
Catherine Zhang | dc49c1f | 2006-08-02 14:12:06 -0700 | [diff] [blame] | 1235 | * @secid_to_secctx: |
| 1236 | * Convert secid to security context. |
| 1237 | * @secid contains the security ID. |
| 1238 | * @secdata contains the pointer that stores the converted security context. |
David Howells | 63cb344 | 2008-01-15 23:47:35 +0000 | [diff] [blame] | 1239 | * @secctx_to_secid: |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1240 | * Convert security context to secid. |
| 1241 | * @secid contains the pointer to the generated security ID. |
| 1242 | * @secdata contains the security context. |
Catherine Zhang | dc49c1f | 2006-08-02 14:12:06 -0700 | [diff] [blame] | 1243 | * |
| 1244 | * @release_secctx: |
| 1245 | * Release the security context. |
| 1246 | * @secdata contains the security context. |
| 1247 | * @seclen contains the length of the security context. |
| 1248 | * |
Ahmed S. Darwish | 03d37d2 | 2008-03-01 22:00:05 +0200 | [diff] [blame] | 1249 | * Security hooks for Audit |
| 1250 | * |
| 1251 | * @audit_rule_init: |
| 1252 | * Allocate and initialize an LSM audit rule structure. |
| 1253 | * @field contains the required Audit action. Fields flags are defined in include/linux/audit.h |
| 1254 | * @op contains the operator the rule uses. |
| 1255 | * @rulestr contains the context where the rule will be applied to. |
| 1256 | * @lsmrule contains a pointer to receive the result. |
| 1257 | * Return 0 if @lsmrule has been successfully set, |
| 1258 | * -EINVAL in case of an invalid rule. |
| 1259 | * |
| 1260 | * @audit_rule_known: |
| 1261 | * Specifies whether given @rule contains any fields related to current LSM. |
| 1262 | * @rule contains the audit rule of interest. |
| 1263 | * Return 1 in case of relation found, 0 otherwise. |
| 1264 | * |
| 1265 | * @audit_rule_match: |
| 1266 | * Determine if given @secid matches a rule previously approved |
| 1267 | * by @audit_rule_known. |
| 1268 | * @secid contains the security id in question. |
| 1269 | * @field contains the field which relates to current LSM. |
| 1270 | * @op contains the operator that will be used for matching. |
| 1271 | * @rule points to the audit rule that will be checked against. |
| 1272 | * @actx points to the audit context associated with the check. |
| 1273 | * Return 1 if secid matches the rule, 0 if it does not, -ERRNO on failure. |
| 1274 | * |
| 1275 | * @audit_rule_free: |
| 1276 | * Deallocate the LSM audit rule structure previously allocated by |
| 1277 | * audit_rule_init. |
| 1278 | * @rule contains the allocated rule |
| 1279 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1280 | * This is the main security structure. |
| 1281 | */ |
| 1282 | struct security_operations { |
Ahmed S. Darwish | 076c54c | 2008-03-06 18:09:10 +0200 | [diff] [blame] | 1283 | char name[SECURITY_NAME_MAX + 1]; |
| 1284 | |
David Howells | 5cd9c58 | 2008-08-14 11:37:28 +0100 | [diff] [blame] | 1285 | int (*ptrace_may_access) (struct task_struct *child, unsigned int mode); |
| 1286 | int (*ptrace_traceme) (struct task_struct *parent); |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1287 | int (*capget) (struct task_struct *target, |
| 1288 | kernel_cap_t *effective, |
| 1289 | kernel_cap_t *inheritable, kernel_cap_t *permitted); |
David Howells | d84f4f9 | 2008-11-14 10:39:23 +1100 | [diff] [blame^] | 1290 | int (*capset) (struct cred *new, |
| 1291 | const struct cred *old, |
| 1292 | const kernel_cap_t *effective, |
| 1293 | const kernel_cap_t *inheritable, |
| 1294 | const kernel_cap_t *permitted); |
Eric Paris | 0611216 | 2008-11-11 22:02:50 +1100 | [diff] [blame] | 1295 | int (*capable) (struct task_struct *tsk, int cap, int audit); |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1296 | int (*acct) (struct file *file); |
| 1297 | int (*sysctl) (struct ctl_table *table, int op); |
| 1298 | int (*quotactl) (int cmds, int type, int id, struct super_block *sb); |
| 1299 | int (*quota_on) (struct dentry *dentry); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1300 | int (*syslog) (int type); |
| 1301 | int (*settime) (struct timespec *ts, struct timezone *tz); |
Alan Cox | 34b4e4a | 2007-08-22 14:01:28 -0700 | [diff] [blame] | 1302 | int (*vm_enough_memory) (struct mm_struct *mm, long pages); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1303 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1304 | int (*bprm_alloc_security) (struct linux_binprm *bprm); |
| 1305 | void (*bprm_free_security) (struct linux_binprm *bprm); |
David Howells | d84f4f9 | 2008-11-14 10:39:23 +1100 | [diff] [blame^] | 1306 | int (*bprm_apply_creds) (struct linux_binprm *bprm, int unsafe); |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1307 | void (*bprm_post_apply_creds) (struct linux_binprm *bprm); |
| 1308 | int (*bprm_set_security) (struct linux_binprm *bprm); |
| 1309 | int (*bprm_check_security) (struct linux_binprm *bprm); |
| 1310 | int (*bprm_secureexec) (struct linux_binprm *bprm); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1311 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1312 | int (*sb_alloc_security) (struct super_block *sb); |
| 1313 | void (*sb_free_security) (struct super_block *sb); |
| 1314 | int (*sb_copy_data) (char *orig, char *copy); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1315 | int (*sb_kern_mount) (struct super_block *sb, void *data); |
Eric Paris | 2069f45 | 2008-07-04 09:47:13 +1000 | [diff] [blame] | 1316 | int (*sb_show_options) (struct seq_file *m, struct super_block *sb); |
David Howells | 726c334 | 2006-06-23 02:02:58 -0700 | [diff] [blame] | 1317 | int (*sb_statfs) (struct dentry *dentry); |
Al Viro | b5266eb | 2008-03-22 17:48:24 -0400 | [diff] [blame] | 1318 | int (*sb_mount) (char *dev_name, struct path *path, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1319 | char *type, unsigned long flags, void *data); |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1320 | int (*sb_check_sb) (struct vfsmount *mnt, struct path *path); |
| 1321 | int (*sb_umount) (struct vfsmount *mnt, int flags); |
| 1322 | void (*sb_umount_close) (struct vfsmount *mnt); |
| 1323 | void (*sb_umount_busy) (struct vfsmount *mnt); |
| 1324 | void (*sb_post_remount) (struct vfsmount *mnt, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1325 | unsigned long flags, void *data); |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1326 | void (*sb_post_addmount) (struct vfsmount *mnt, |
Al Viro | b5266eb | 2008-03-22 17:48:24 -0400 | [diff] [blame] | 1327 | struct path *mountpoint); |
| 1328 | int (*sb_pivotroot) (struct path *old_path, |
| 1329 | struct path *new_path); |
| 1330 | void (*sb_post_pivotroot) (struct path *old_path, |
| 1331 | struct path *new_path); |
Eric Paris | e000752 | 2008-03-05 10:31:54 -0500 | [diff] [blame] | 1332 | int (*sb_set_mnt_opts) (struct super_block *sb, |
| 1333 | struct security_mnt_opts *opts); |
Eric Paris | c9180a5 | 2007-11-30 13:00:35 -0500 | [diff] [blame] | 1334 | void (*sb_clone_mnt_opts) (const struct super_block *oldsb, |
| 1335 | struct super_block *newsb); |
Eric Paris | e000752 | 2008-03-05 10:31:54 -0500 | [diff] [blame] | 1336 | int (*sb_parse_opts_str) (char *options, struct security_mnt_opts *opts); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1337 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1338 | int (*inode_alloc_security) (struct inode *inode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1339 | void (*inode_free_security) (struct inode *inode); |
Stephen Smalley | 5e41ff9 | 2005-09-09 13:01:35 -0700 | [diff] [blame] | 1340 | int (*inode_init_security) (struct inode *inode, struct inode *dir, |
| 1341 | char **name, void **value, size_t *len); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1342 | int (*inode_create) (struct inode *dir, |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1343 | struct dentry *dentry, int mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1344 | int (*inode_link) (struct dentry *old_dentry, |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1345 | struct inode *dir, struct dentry *new_dentry); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1346 | int (*inode_unlink) (struct inode *dir, struct dentry *dentry); |
| 1347 | int (*inode_symlink) (struct inode *dir, |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1348 | struct dentry *dentry, const char *old_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1349 | int (*inode_mkdir) (struct inode *dir, struct dentry *dentry, int mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1350 | int (*inode_rmdir) (struct inode *dir, struct dentry *dentry); |
| 1351 | int (*inode_mknod) (struct inode *dir, struct dentry *dentry, |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1352 | int mode, dev_t dev); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1353 | int (*inode_rename) (struct inode *old_dir, struct dentry *old_dentry, |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1354 | struct inode *new_dir, struct dentry *new_dentry); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1355 | int (*inode_readlink) (struct dentry *dentry); |
| 1356 | int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd); |
Al Viro | b77b064 | 2008-07-17 09:37:02 -0400 | [diff] [blame] | 1357 | int (*inode_permission) (struct inode *inode, int mask); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1358 | int (*inode_setattr) (struct dentry *dentry, struct iattr *attr); |
| 1359 | int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry); |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1360 | void (*inode_delete) (struct inode *inode); |
David Howells | 8f0cfa5 | 2008-04-29 00:59:41 -0700 | [diff] [blame] | 1361 | int (*inode_setxattr) (struct dentry *dentry, const char *name, |
| 1362 | const void *value, size_t size, int flags); |
| 1363 | void (*inode_post_setxattr) (struct dentry *dentry, const char *name, |
| 1364 | const void *value, size_t size, int flags); |
| 1365 | int (*inode_getxattr) (struct dentry *dentry, const char *name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1366 | int (*inode_listxattr) (struct dentry *dentry); |
David Howells | 8f0cfa5 | 2008-04-29 00:59:41 -0700 | [diff] [blame] | 1367 | int (*inode_removexattr) (struct dentry *dentry, const char *name); |
Serge E. Hallyn | b537677 | 2007-10-16 23:31:36 -0700 | [diff] [blame] | 1368 | int (*inode_need_killpriv) (struct dentry *dentry); |
| 1369 | int (*inode_killpriv) (struct dentry *dentry); |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1370 | int (*inode_getsecurity) (const struct inode *inode, const char *name, void **buffer, bool alloc); |
| 1371 | int (*inode_setsecurity) (struct inode *inode, const char *name, const void *value, size_t size, int flags); |
| 1372 | int (*inode_listsecurity) (struct inode *inode, char *buffer, size_t buffer_size); |
| 1373 | void (*inode_getsecid) (const struct inode *inode, u32 *secid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1374 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1375 | int (*file_permission) (struct file *file, int mask); |
| 1376 | int (*file_alloc_security) (struct file *file); |
| 1377 | void (*file_free_security) (struct file *file); |
| 1378 | int (*file_ioctl) (struct file *file, unsigned int cmd, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1379 | unsigned long arg); |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1380 | int (*file_mmap) (struct file *file, |
Eric Paris | ed03218 | 2007-06-28 15:55:21 -0400 | [diff] [blame] | 1381 | unsigned long reqprot, unsigned long prot, |
| 1382 | unsigned long flags, unsigned long addr, |
| 1383 | unsigned long addr_only); |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1384 | int (*file_mprotect) (struct vm_area_struct *vma, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1385 | unsigned long reqprot, |
| 1386 | unsigned long prot); |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1387 | int (*file_lock) (struct file *file, unsigned int cmd); |
| 1388 | int (*file_fcntl) (struct file *file, unsigned int cmd, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1389 | unsigned long arg); |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1390 | int (*file_set_fowner) (struct file *file); |
| 1391 | int (*file_send_sigiotask) (struct task_struct *tsk, |
| 1392 | struct fown_struct *fown, int sig); |
| 1393 | int (*file_receive) (struct file *file); |
David Howells | 745ca24 | 2008-11-14 10:39:22 +1100 | [diff] [blame] | 1394 | int (*dentry_open) (struct file *file, const struct cred *cred); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1395 | |
| 1396 | int (*task_create) (unsigned long clone_flags); |
David Howells | f1752ee | 2008-11-14 10:39:17 +1100 | [diff] [blame] | 1397 | void (*cred_free) (struct cred *cred); |
David Howells | d84f4f9 | 2008-11-14 10:39:23 +1100 | [diff] [blame^] | 1398 | int (*cred_prepare)(struct cred *new, const struct cred *old, |
| 1399 | gfp_t gfp); |
| 1400 | void (*cred_commit)(struct cred *new, const struct cred *old); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1401 | int (*task_setuid) (uid_t id0, uid_t id1, uid_t id2, int flags); |
David Howells | d84f4f9 | 2008-11-14 10:39:23 +1100 | [diff] [blame^] | 1402 | int (*task_fix_setuid) (struct cred *new, const struct cred *old, |
| 1403 | int flags); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1404 | int (*task_setgid) (gid_t id0, gid_t id1, gid_t id2, int flags); |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1405 | int (*task_setpgid) (struct task_struct *p, pid_t pgid); |
| 1406 | int (*task_getpgid) (struct task_struct *p); |
| 1407 | int (*task_getsid) (struct task_struct *p); |
| 1408 | void (*task_getsecid) (struct task_struct *p, u32 *secid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1409 | int (*task_setgroups) (struct group_info *group_info); |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1410 | int (*task_setnice) (struct task_struct *p, int nice); |
| 1411 | int (*task_setioprio) (struct task_struct *p, int ioprio); |
| 1412 | int (*task_getioprio) (struct task_struct *p); |
| 1413 | int (*task_setrlimit) (unsigned int resource, struct rlimit *new_rlim); |
| 1414 | int (*task_setscheduler) (struct task_struct *p, int policy, |
| 1415 | struct sched_param *lp); |
| 1416 | int (*task_getscheduler) (struct task_struct *p); |
| 1417 | int (*task_movememory) (struct task_struct *p); |
| 1418 | int (*task_kill) (struct task_struct *p, |
| 1419 | struct siginfo *info, int sig, u32 secid); |
| 1420 | int (*task_wait) (struct task_struct *p); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1421 | int (*task_prctl) (int option, unsigned long arg2, |
| 1422 | unsigned long arg3, unsigned long arg4, |
David Howells | d84f4f9 | 2008-11-14 10:39:23 +1100 | [diff] [blame^] | 1423 | unsigned long arg5); |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1424 | void (*task_to_inode) (struct task_struct *p, struct inode *inode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1425 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1426 | int (*ipc_permission) (struct kern_ipc_perm *ipcp, short flag); |
Ahmed S. Darwish | 8a07619 | 2008-03-01 21:51:09 +0200 | [diff] [blame] | 1427 | void (*ipc_getsecid) (struct kern_ipc_perm *ipcp, u32 *secid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1428 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1429 | int (*msg_msg_alloc_security) (struct msg_msg *msg); |
| 1430 | void (*msg_msg_free_security) (struct msg_msg *msg); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1431 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1432 | int (*msg_queue_alloc_security) (struct msg_queue *msq); |
| 1433 | void (*msg_queue_free_security) (struct msg_queue *msq); |
| 1434 | int (*msg_queue_associate) (struct msg_queue *msq, int msqflg); |
| 1435 | int (*msg_queue_msgctl) (struct msg_queue *msq, int cmd); |
| 1436 | int (*msg_queue_msgsnd) (struct msg_queue *msq, |
| 1437 | struct msg_msg *msg, int msqflg); |
| 1438 | int (*msg_queue_msgrcv) (struct msg_queue *msq, |
| 1439 | struct msg_msg *msg, |
| 1440 | struct task_struct *target, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1441 | long type, int mode); |
| 1442 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1443 | int (*shm_alloc_security) (struct shmid_kernel *shp); |
| 1444 | void (*shm_free_security) (struct shmid_kernel *shp); |
| 1445 | int (*shm_associate) (struct shmid_kernel *shp, int shmflg); |
| 1446 | int (*shm_shmctl) (struct shmid_kernel *shp, int cmd); |
| 1447 | int (*shm_shmat) (struct shmid_kernel *shp, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1448 | char __user *shmaddr, int shmflg); |
| 1449 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1450 | int (*sem_alloc_security) (struct sem_array *sma); |
| 1451 | void (*sem_free_security) (struct sem_array *sma); |
| 1452 | int (*sem_associate) (struct sem_array *sma, int semflg); |
| 1453 | int (*sem_semctl) (struct sem_array *sma, int cmd); |
| 1454 | int (*sem_semop) (struct sem_array *sma, |
| 1455 | struct sembuf *sops, unsigned nsops, int alter); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1456 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1457 | int (*netlink_send) (struct sock *sk, struct sk_buff *skb); |
| 1458 | int (*netlink_recv) (struct sk_buff *skb, int cap); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1459 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1460 | void (*d_instantiate) (struct dentry *dentry, struct inode *inode); |
| 1461 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1462 | int (*getprocattr) (struct task_struct *p, char *name, char **value); |
| 1463 | int (*setprocattr) (struct task_struct *p, char *name, void *value, size_t size); |
| 1464 | int (*secid_to_secctx) (u32 secid, char **secdata, u32 *seclen); |
David Howells | 7bf570d | 2008-04-29 20:52:51 +0100 | [diff] [blame] | 1465 | int (*secctx_to_secid) (const char *secdata, u32 seclen, u32 *secid); |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1466 | void (*release_secctx) (char *secdata, u32 seclen); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1467 | |
| 1468 | #ifdef CONFIG_SECURITY_NETWORK |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1469 | int (*unix_stream_connect) (struct socket *sock, |
| 1470 | struct socket *other, struct sock *newsk); |
| 1471 | int (*unix_may_send) (struct socket *sock, struct socket *other); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1472 | |
| 1473 | int (*socket_create) (int family, int type, int protocol, int kern); |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1474 | int (*socket_post_create) (struct socket *sock, int family, |
Venkat Yekkirala | 7420ed2 | 2006-08-04 23:17:57 -0700 | [diff] [blame] | 1475 | int type, int protocol, int kern); |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1476 | int (*socket_bind) (struct socket *sock, |
| 1477 | struct sockaddr *address, int addrlen); |
| 1478 | int (*socket_connect) (struct socket *sock, |
| 1479 | struct sockaddr *address, int addrlen); |
| 1480 | int (*socket_listen) (struct socket *sock, int backlog); |
| 1481 | int (*socket_accept) (struct socket *sock, struct socket *newsock); |
| 1482 | void (*socket_post_accept) (struct socket *sock, |
| 1483 | struct socket *newsock); |
| 1484 | int (*socket_sendmsg) (struct socket *sock, |
| 1485 | struct msghdr *msg, int size); |
| 1486 | int (*socket_recvmsg) (struct socket *sock, |
| 1487 | struct msghdr *msg, int size, int flags); |
| 1488 | int (*socket_getsockname) (struct socket *sock); |
| 1489 | int (*socket_getpeername) (struct socket *sock); |
| 1490 | int (*socket_getsockopt) (struct socket *sock, int level, int optname); |
| 1491 | int (*socket_setsockopt) (struct socket *sock, int level, int optname); |
| 1492 | int (*socket_shutdown) (struct socket *sock, int how); |
| 1493 | int (*socket_sock_rcv_skb) (struct sock *sk, struct sk_buff *skb); |
Catherine Zhang | 2c7946a | 2006-03-20 22:41:23 -0800 | [diff] [blame] | 1494 | int (*socket_getpeersec_stream) (struct socket *sock, char __user *optval, int __user *optlen, unsigned len); |
Catherine Zhang | dc49c1f | 2006-08-02 14:12:06 -0700 | [diff] [blame] | 1495 | int (*socket_getpeersec_dgram) (struct socket *sock, struct sk_buff *skb, u32 *secid); |
Al Viro | 7d877f3 | 2005-10-21 03:20:43 -0400 | [diff] [blame] | 1496 | int (*sk_alloc_security) (struct sock *sk, int family, gfp_t priority); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1497 | void (*sk_free_security) (struct sock *sk); |
Venkat Yekkirala | 892c141 | 2006-08-04 23:08:56 -0700 | [diff] [blame] | 1498 | void (*sk_clone_security) (const struct sock *sk, struct sock *newsk); |
Venkat Yekkirala | beb8d13 | 2006-08-04 23:12:42 -0700 | [diff] [blame] | 1499 | void (*sk_getsecid) (struct sock *sk, u32 *secid); |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1500 | void (*sock_graft) (struct sock *sk, struct socket *parent); |
| 1501 | int (*inet_conn_request) (struct sock *sk, struct sk_buff *skb, |
| 1502 | struct request_sock *req); |
| 1503 | void (*inet_csk_clone) (struct sock *newsk, const struct request_sock *req); |
| 1504 | void (*inet_conn_established) (struct sock *sk, struct sk_buff *skb); |
| 1505 | void (*req_classify_flow) (const struct request_sock *req, struct flowi *fl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1506 | #endif /* CONFIG_SECURITY_NETWORK */ |
David Howells | 29db919 | 2005-10-30 15:02:44 -0800 | [diff] [blame] | 1507 | |
Trent Jaeger | df71837 | 2005-12-13 23:12:27 -0800 | [diff] [blame] | 1508 | #ifdef CONFIG_SECURITY_NETWORK_XFRM |
Paul Moore | 03e1ad7 | 2008-04-12 19:07:52 -0700 | [diff] [blame] | 1509 | int (*xfrm_policy_alloc_security) (struct xfrm_sec_ctx **ctxp, |
Venkat Yekkirala | c1a856c | 2006-11-08 17:03:44 -0600 | [diff] [blame] | 1510 | struct xfrm_user_sec_ctx *sec_ctx); |
Paul Moore | 03e1ad7 | 2008-04-12 19:07:52 -0700 | [diff] [blame] | 1511 | int (*xfrm_policy_clone_security) (struct xfrm_sec_ctx *old_ctx, struct xfrm_sec_ctx **new_ctx); |
| 1512 | void (*xfrm_policy_free_security) (struct xfrm_sec_ctx *ctx); |
| 1513 | int (*xfrm_policy_delete_security) (struct xfrm_sec_ctx *ctx); |
Venkat Yekkirala | e0d1caa | 2006-07-24 23:29:07 -0700 | [diff] [blame] | 1514 | int (*xfrm_state_alloc_security) (struct xfrm_state *x, |
Venkat Yekkirala | c1a856c | 2006-11-08 17:03:44 -0600 | [diff] [blame] | 1515 | struct xfrm_user_sec_ctx *sec_ctx, |
Venkat Yekkirala | e0d1caa | 2006-07-24 23:29:07 -0700 | [diff] [blame] | 1516 | u32 secid); |
Trent Jaeger | df71837 | 2005-12-13 23:12:27 -0800 | [diff] [blame] | 1517 | void (*xfrm_state_free_security) (struct xfrm_state *x); |
Catherine Zhang | c8c05a8 | 2006-06-08 23:39:49 -0700 | [diff] [blame] | 1518 | int (*xfrm_state_delete_security) (struct xfrm_state *x); |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1519 | int (*xfrm_policy_lookup) (struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir); |
| 1520 | int (*xfrm_state_pol_flow_match) (struct xfrm_state *x, |
| 1521 | struct xfrm_policy *xp, |
| 1522 | struct flowi *fl); |
| 1523 | int (*xfrm_decode_session) (struct sk_buff *skb, u32 *secid, int ckall); |
Trent Jaeger | df71837 | 2005-12-13 23:12:27 -0800 | [diff] [blame] | 1524 | #endif /* CONFIG_SECURITY_NETWORK_XFRM */ |
| 1525 | |
David Howells | 29db919 | 2005-10-30 15:02:44 -0800 | [diff] [blame] | 1526 | /* key management security hooks */ |
| 1527 | #ifdef CONFIG_KEYS |
David Howells | d84f4f9 | 2008-11-14 10:39:23 +1100 | [diff] [blame^] | 1528 | int (*key_alloc) (struct key *key, const struct cred *cred, unsigned long flags); |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1529 | void (*key_free) (struct key *key); |
| 1530 | int (*key_permission) (key_ref_t key_ref, |
David Howells | d84f4f9 | 2008-11-14 10:39:23 +1100 | [diff] [blame^] | 1531 | const struct cred *cred, |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1532 | key_perm_t perm); |
David Howells | 70a5bb7 | 2008-04-29 01:01:26 -0700 | [diff] [blame] | 1533 | int (*key_getsecurity)(struct key *key, char **_buffer); |
David Howells | 29db919 | 2005-10-30 15:02:44 -0800 | [diff] [blame] | 1534 | #endif /* CONFIG_KEYS */ |
| 1535 | |
Ahmed S. Darwish | 03d37d2 | 2008-03-01 22:00:05 +0200 | [diff] [blame] | 1536 | #ifdef CONFIG_AUDIT |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1537 | int (*audit_rule_init) (u32 field, u32 op, char *rulestr, void **lsmrule); |
| 1538 | int (*audit_rule_known) (struct audit_krule *krule); |
| 1539 | int (*audit_rule_match) (u32 secid, u32 field, u32 op, void *lsmrule, |
| 1540 | struct audit_context *actx); |
| 1541 | void (*audit_rule_free) (void *lsmrule); |
Ahmed S. Darwish | 03d37d2 | 2008-03-01 22:00:05 +0200 | [diff] [blame] | 1542 | #endif /* CONFIG_AUDIT */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1543 | }; |
| 1544 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1545 | /* prototypes */ |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1546 | extern int security_init(void); |
Ahmed S. Darwish | 076c54c | 2008-03-06 18:09:10 +0200 | [diff] [blame] | 1547 | extern int security_module_enable(struct security_operations *ops); |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1548 | extern int register_security(struct security_operations *ops); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1549 | |
James Morris | 20510f2 | 2007-10-16 23:31:32 -0700 | [diff] [blame] | 1550 | /* Security operations */ |
David Howells | 5cd9c58 | 2008-08-14 11:37:28 +0100 | [diff] [blame] | 1551 | int security_ptrace_may_access(struct task_struct *child, unsigned int mode); |
| 1552 | int security_ptrace_traceme(struct task_struct *parent); |
James Morris | 20510f2 | 2007-10-16 23:31:32 -0700 | [diff] [blame] | 1553 | int security_capget(struct task_struct *target, |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1554 | kernel_cap_t *effective, |
| 1555 | kernel_cap_t *inheritable, |
| 1556 | kernel_cap_t *permitted); |
David Howells | d84f4f9 | 2008-11-14 10:39:23 +1100 | [diff] [blame^] | 1557 | int security_capset(struct cred *new, const struct cred *old, |
| 1558 | const kernel_cap_t *effective, |
| 1559 | const kernel_cap_t *inheritable, |
| 1560 | const kernel_cap_t *permitted); |
James Morris | 20510f2 | 2007-10-16 23:31:32 -0700 | [diff] [blame] | 1561 | int security_capable(struct task_struct *tsk, int cap); |
Eric Paris | 0611216 | 2008-11-11 22:02:50 +1100 | [diff] [blame] | 1562 | int security_capable_noaudit(struct task_struct *tsk, int cap); |
James Morris | 20510f2 | 2007-10-16 23:31:32 -0700 | [diff] [blame] | 1563 | int security_acct(struct file *file); |
| 1564 | int security_sysctl(struct ctl_table *table, int op); |
| 1565 | int security_quotactl(int cmds, int type, int id, struct super_block *sb); |
| 1566 | int security_quota_on(struct dentry *dentry); |
| 1567 | int security_syslog(int type); |
| 1568 | int security_settime(struct timespec *ts, struct timezone *tz); |
| 1569 | int security_vm_enough_memory(long pages); |
| 1570 | int security_vm_enough_memory_mm(struct mm_struct *mm, long pages); |
Alan Cox | 731572d | 2008-10-29 14:01:20 -0700 | [diff] [blame] | 1571 | int security_vm_enough_memory_kern(long pages); |
James Morris | 20510f2 | 2007-10-16 23:31:32 -0700 | [diff] [blame] | 1572 | int security_bprm_alloc(struct linux_binprm *bprm); |
| 1573 | void security_bprm_free(struct linux_binprm *bprm); |
David Howells | d84f4f9 | 2008-11-14 10:39:23 +1100 | [diff] [blame^] | 1574 | int security_bprm_apply_creds(struct linux_binprm *bprm, int unsafe); |
James Morris | 20510f2 | 2007-10-16 23:31:32 -0700 | [diff] [blame] | 1575 | void security_bprm_post_apply_creds(struct linux_binprm *bprm); |
| 1576 | int security_bprm_set(struct linux_binprm *bprm); |
| 1577 | int security_bprm_check(struct linux_binprm *bprm); |
| 1578 | int security_bprm_secureexec(struct linux_binprm *bprm); |
| 1579 | int security_sb_alloc(struct super_block *sb); |
| 1580 | void security_sb_free(struct super_block *sb); |
Eric Paris | e000752 | 2008-03-05 10:31:54 -0500 | [diff] [blame] | 1581 | int security_sb_copy_data(char *orig, char *copy); |
James Morris | 20510f2 | 2007-10-16 23:31:32 -0700 | [diff] [blame] | 1582 | int security_sb_kern_mount(struct super_block *sb, void *data); |
Eric Paris | 2069f45 | 2008-07-04 09:47:13 +1000 | [diff] [blame] | 1583 | int security_sb_show_options(struct seq_file *m, struct super_block *sb); |
James Morris | 20510f2 | 2007-10-16 23:31:32 -0700 | [diff] [blame] | 1584 | int security_sb_statfs(struct dentry *dentry); |
Al Viro | b5266eb | 2008-03-22 17:48:24 -0400 | [diff] [blame] | 1585 | int security_sb_mount(char *dev_name, struct path *path, |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1586 | char *type, unsigned long flags, void *data); |
Al Viro | b5266eb | 2008-03-22 17:48:24 -0400 | [diff] [blame] | 1587 | int security_sb_check_sb(struct vfsmount *mnt, struct path *path); |
James Morris | 20510f2 | 2007-10-16 23:31:32 -0700 | [diff] [blame] | 1588 | int security_sb_umount(struct vfsmount *mnt, int flags); |
| 1589 | void security_sb_umount_close(struct vfsmount *mnt); |
| 1590 | void security_sb_umount_busy(struct vfsmount *mnt); |
| 1591 | void security_sb_post_remount(struct vfsmount *mnt, unsigned long flags, void *data); |
Al Viro | b5266eb | 2008-03-22 17:48:24 -0400 | [diff] [blame] | 1592 | void security_sb_post_addmount(struct vfsmount *mnt, struct path *mountpoint); |
| 1593 | int security_sb_pivotroot(struct path *old_path, struct path *new_path); |
| 1594 | void security_sb_post_pivotroot(struct path *old_path, struct path *new_path); |
Eric Paris | e000752 | 2008-03-05 10:31:54 -0500 | [diff] [blame] | 1595 | int security_sb_set_mnt_opts(struct super_block *sb, struct security_mnt_opts *opts); |
Eric Paris | c9180a5 | 2007-11-30 13:00:35 -0500 | [diff] [blame] | 1596 | void security_sb_clone_mnt_opts(const struct super_block *oldsb, |
| 1597 | struct super_block *newsb); |
Eric Paris | e000752 | 2008-03-05 10:31:54 -0500 | [diff] [blame] | 1598 | int security_sb_parse_opts_str(char *options, struct security_mnt_opts *opts); |
Eric Paris | c9180a5 | 2007-11-30 13:00:35 -0500 | [diff] [blame] | 1599 | |
James Morris | 20510f2 | 2007-10-16 23:31:32 -0700 | [diff] [blame] | 1600 | int security_inode_alloc(struct inode *inode); |
| 1601 | void security_inode_free(struct inode *inode); |
| 1602 | int security_inode_init_security(struct inode *inode, struct inode *dir, |
| 1603 | char **name, void **value, size_t *len); |
| 1604 | int security_inode_create(struct inode *dir, struct dentry *dentry, int mode); |
| 1605 | int security_inode_link(struct dentry *old_dentry, struct inode *dir, |
| 1606 | struct dentry *new_dentry); |
| 1607 | int security_inode_unlink(struct inode *dir, struct dentry *dentry); |
| 1608 | int security_inode_symlink(struct inode *dir, struct dentry *dentry, |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1609 | const char *old_name); |
James Morris | 20510f2 | 2007-10-16 23:31:32 -0700 | [diff] [blame] | 1610 | int security_inode_mkdir(struct inode *dir, struct dentry *dentry, int mode); |
| 1611 | int security_inode_rmdir(struct inode *dir, struct dentry *dentry); |
| 1612 | int security_inode_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev); |
| 1613 | int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry, |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1614 | struct inode *new_dir, struct dentry *new_dentry); |
James Morris | 20510f2 | 2007-10-16 23:31:32 -0700 | [diff] [blame] | 1615 | int security_inode_readlink(struct dentry *dentry); |
| 1616 | int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd); |
Al Viro | b77b064 | 2008-07-17 09:37:02 -0400 | [diff] [blame] | 1617 | int security_inode_permission(struct inode *inode, int mask); |
James Morris | 20510f2 | 2007-10-16 23:31:32 -0700 | [diff] [blame] | 1618 | int security_inode_setattr(struct dentry *dentry, struct iattr *attr); |
| 1619 | int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry); |
| 1620 | void security_inode_delete(struct inode *inode); |
David Howells | 8f0cfa5 | 2008-04-29 00:59:41 -0700 | [diff] [blame] | 1621 | int security_inode_setxattr(struct dentry *dentry, const char *name, |
| 1622 | const void *value, size_t size, int flags); |
| 1623 | void security_inode_post_setxattr(struct dentry *dentry, const char *name, |
| 1624 | const void *value, size_t size, int flags); |
| 1625 | int security_inode_getxattr(struct dentry *dentry, const char *name); |
James Morris | 20510f2 | 2007-10-16 23:31:32 -0700 | [diff] [blame] | 1626 | int security_inode_listxattr(struct dentry *dentry); |
David Howells | 8f0cfa5 | 2008-04-29 00:59:41 -0700 | [diff] [blame] | 1627 | int security_inode_removexattr(struct dentry *dentry, const char *name); |
Serge E. Hallyn | b537677 | 2007-10-16 23:31:36 -0700 | [diff] [blame] | 1628 | int security_inode_need_killpriv(struct dentry *dentry); |
| 1629 | int security_inode_killpriv(struct dentry *dentry); |
David P. Quigley | 4249259 | 2008-02-04 22:29:39 -0800 | [diff] [blame] | 1630 | int security_inode_getsecurity(const struct inode *inode, const char *name, void **buffer, bool alloc); |
James Morris | 20510f2 | 2007-10-16 23:31:32 -0700 | [diff] [blame] | 1631 | int security_inode_setsecurity(struct inode *inode, const char *name, const void *value, size_t size, int flags); |
| 1632 | int security_inode_listsecurity(struct inode *inode, char *buffer, size_t buffer_size); |
Ahmed S. Darwish | 8a07619 | 2008-03-01 21:51:09 +0200 | [diff] [blame] | 1633 | void security_inode_getsecid(const struct inode *inode, u32 *secid); |
James Morris | 20510f2 | 2007-10-16 23:31:32 -0700 | [diff] [blame] | 1634 | int security_file_permission(struct file *file, int mask); |
| 1635 | int security_file_alloc(struct file *file); |
| 1636 | void security_file_free(struct file *file); |
| 1637 | int security_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg); |
| 1638 | int security_file_mmap(struct file *file, unsigned long reqprot, |
| 1639 | unsigned long prot, unsigned long flags, |
| 1640 | unsigned long addr, unsigned long addr_only); |
| 1641 | int security_file_mprotect(struct vm_area_struct *vma, unsigned long reqprot, |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1642 | unsigned long prot); |
James Morris | 20510f2 | 2007-10-16 23:31:32 -0700 | [diff] [blame] | 1643 | int security_file_lock(struct file *file, unsigned int cmd); |
| 1644 | int security_file_fcntl(struct file *file, unsigned int cmd, unsigned long arg); |
| 1645 | int security_file_set_fowner(struct file *file); |
| 1646 | int security_file_send_sigiotask(struct task_struct *tsk, |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1647 | struct fown_struct *fown, int sig); |
James Morris | 20510f2 | 2007-10-16 23:31:32 -0700 | [diff] [blame] | 1648 | int security_file_receive(struct file *file); |
David Howells | 745ca24 | 2008-11-14 10:39:22 +1100 | [diff] [blame] | 1649 | int security_dentry_open(struct file *file, const struct cred *cred); |
James Morris | 20510f2 | 2007-10-16 23:31:32 -0700 | [diff] [blame] | 1650 | int security_task_create(unsigned long clone_flags); |
David Howells | f1752ee | 2008-11-14 10:39:17 +1100 | [diff] [blame] | 1651 | void security_cred_free(struct cred *cred); |
David Howells | d84f4f9 | 2008-11-14 10:39:23 +1100 | [diff] [blame^] | 1652 | int security_prepare_creds(struct cred *new, const struct cred *old, gfp_t gfp); |
| 1653 | void security_commit_creds(struct cred *new, const struct cred *old); |
James Morris | 20510f2 | 2007-10-16 23:31:32 -0700 | [diff] [blame] | 1654 | int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, int flags); |
David Howells | d84f4f9 | 2008-11-14 10:39:23 +1100 | [diff] [blame^] | 1655 | int security_task_fix_setuid(struct cred *new, const struct cred *old, |
| 1656 | int flags); |
James Morris | 20510f2 | 2007-10-16 23:31:32 -0700 | [diff] [blame] | 1657 | int security_task_setgid(gid_t id0, gid_t id1, gid_t id2, int flags); |
| 1658 | int security_task_setpgid(struct task_struct *p, pid_t pgid); |
| 1659 | int security_task_getpgid(struct task_struct *p); |
| 1660 | int security_task_getsid(struct task_struct *p); |
| 1661 | void security_task_getsecid(struct task_struct *p, u32 *secid); |
| 1662 | int security_task_setgroups(struct group_info *group_info); |
| 1663 | int security_task_setnice(struct task_struct *p, int nice); |
| 1664 | int security_task_setioprio(struct task_struct *p, int ioprio); |
| 1665 | int security_task_getioprio(struct task_struct *p); |
| 1666 | int security_task_setrlimit(unsigned int resource, struct rlimit *new_rlim); |
| 1667 | int security_task_setscheduler(struct task_struct *p, |
| 1668 | int policy, struct sched_param *lp); |
| 1669 | int security_task_getscheduler(struct task_struct *p); |
| 1670 | int security_task_movememory(struct task_struct *p); |
| 1671 | int security_task_kill(struct task_struct *p, struct siginfo *info, |
| 1672 | int sig, u32 secid); |
| 1673 | int security_task_wait(struct task_struct *p); |
| 1674 | int security_task_prctl(int option, unsigned long arg2, unsigned long arg3, |
David Howells | d84f4f9 | 2008-11-14 10:39:23 +1100 | [diff] [blame^] | 1675 | unsigned long arg4, unsigned long arg5); |
James Morris | 20510f2 | 2007-10-16 23:31:32 -0700 | [diff] [blame] | 1676 | void security_task_to_inode(struct task_struct *p, struct inode *inode); |
| 1677 | int security_ipc_permission(struct kern_ipc_perm *ipcp, short flag); |
Ahmed S. Darwish | 8a07619 | 2008-03-01 21:51:09 +0200 | [diff] [blame] | 1678 | void security_ipc_getsecid(struct kern_ipc_perm *ipcp, u32 *secid); |
James Morris | 20510f2 | 2007-10-16 23:31:32 -0700 | [diff] [blame] | 1679 | int security_msg_msg_alloc(struct msg_msg *msg); |
| 1680 | void security_msg_msg_free(struct msg_msg *msg); |
| 1681 | int security_msg_queue_alloc(struct msg_queue *msq); |
| 1682 | void security_msg_queue_free(struct msg_queue *msq); |
| 1683 | int security_msg_queue_associate(struct msg_queue *msq, int msqflg); |
| 1684 | int security_msg_queue_msgctl(struct msg_queue *msq, int cmd); |
| 1685 | int security_msg_queue_msgsnd(struct msg_queue *msq, |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1686 | struct msg_msg *msg, int msqflg); |
James Morris | 20510f2 | 2007-10-16 23:31:32 -0700 | [diff] [blame] | 1687 | int security_msg_queue_msgrcv(struct msg_queue *msq, struct msg_msg *msg, |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1688 | struct task_struct *target, long type, int mode); |
James Morris | 20510f2 | 2007-10-16 23:31:32 -0700 | [diff] [blame] | 1689 | int security_shm_alloc(struct shmid_kernel *shp); |
| 1690 | void security_shm_free(struct shmid_kernel *shp); |
| 1691 | int security_shm_associate(struct shmid_kernel *shp, int shmflg); |
| 1692 | int security_shm_shmctl(struct shmid_kernel *shp, int cmd); |
| 1693 | int security_shm_shmat(struct shmid_kernel *shp, char __user *shmaddr, int shmflg); |
| 1694 | int security_sem_alloc(struct sem_array *sma); |
| 1695 | void security_sem_free(struct sem_array *sma); |
| 1696 | int security_sem_associate(struct sem_array *sma, int semflg); |
| 1697 | int security_sem_semctl(struct sem_array *sma, int cmd); |
| 1698 | int security_sem_semop(struct sem_array *sma, struct sembuf *sops, |
| 1699 | unsigned nsops, int alter); |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1700 | void security_d_instantiate(struct dentry *dentry, struct inode *inode); |
James Morris | 20510f2 | 2007-10-16 23:31:32 -0700 | [diff] [blame] | 1701 | int security_getprocattr(struct task_struct *p, char *name, char **value); |
| 1702 | int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size); |
| 1703 | int security_netlink_send(struct sock *sk, struct sk_buff *skb); |
| 1704 | int security_netlink_recv(struct sk_buff *skb, int cap); |
| 1705 | int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen); |
David Howells | 7bf570d | 2008-04-29 20:52:51 +0100 | [diff] [blame] | 1706 | int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid); |
James Morris | 20510f2 | 2007-10-16 23:31:32 -0700 | [diff] [blame] | 1707 | void security_release_secctx(char *secdata, u32 seclen); |
| 1708 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1709 | #else /* CONFIG_SECURITY */ |
Eric Paris | e000752 | 2008-03-05 10:31:54 -0500 | [diff] [blame] | 1710 | struct security_mnt_opts { |
| 1711 | }; |
| 1712 | |
| 1713 | static inline void security_init_mnt_opts(struct security_mnt_opts *opts) |
| 1714 | { |
| 1715 | } |
| 1716 | |
| 1717 | static inline void security_free_mnt_opts(struct security_mnt_opts *opts) |
| 1718 | { |
| 1719 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1720 | |
| 1721 | /* |
| 1722 | * This is the default capabilities functionality. Most of these functions |
| 1723 | * are just stubbed out, but a few must call the proper capable code. |
| 1724 | */ |
| 1725 | |
| 1726 | static inline int security_init(void) |
| 1727 | { |
| 1728 | return 0; |
| 1729 | } |
| 1730 | |
David Howells | 5cd9c58 | 2008-08-14 11:37:28 +0100 | [diff] [blame] | 1731 | static inline int security_ptrace_may_access(struct task_struct *child, |
| 1732 | unsigned int mode) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1733 | { |
David Howells | 5cd9c58 | 2008-08-14 11:37:28 +0100 | [diff] [blame] | 1734 | return cap_ptrace_may_access(child, mode); |
| 1735 | } |
| 1736 | |
Alexander Beregalov | 5e186b5 | 2008-08-17 05:34:20 +0400 | [diff] [blame] | 1737 | static inline int security_ptrace_traceme(struct task_struct *parent) |
David Howells | 5cd9c58 | 2008-08-14 11:37:28 +0100 | [diff] [blame] | 1738 | { |
| 1739 | return cap_ptrace_traceme(parent); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1740 | } |
| 1741 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1742 | static inline int security_capget(struct task_struct *target, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1743 | kernel_cap_t *effective, |
| 1744 | kernel_cap_t *inheritable, |
| 1745 | kernel_cap_t *permitted) |
| 1746 | { |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1747 | return cap_capget(target, effective, inheritable, permitted); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1748 | } |
| 1749 | |
David Howells | d84f4f9 | 2008-11-14 10:39:23 +1100 | [diff] [blame^] | 1750 | static inline int security_capset(struct cred *new, |
| 1751 | const struct cred *old, |
| 1752 | const kernel_cap_t *effective, |
| 1753 | const kernel_cap_t *inheritable, |
| 1754 | const kernel_cap_t *permitted) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1755 | { |
David Howells | d84f4f9 | 2008-11-14 10:39:23 +1100 | [diff] [blame^] | 1756 | return cap_capset(new, old, effective, inheritable, permitted); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1757 | } |
| 1758 | |
Chris Wright | 12b5989 | 2006-03-25 03:07:41 -0800 | [diff] [blame] | 1759 | static inline int security_capable(struct task_struct *tsk, int cap) |
| 1760 | { |
Eric Paris | 0611216 | 2008-11-11 22:02:50 +1100 | [diff] [blame] | 1761 | return cap_capable(tsk, cap, SECURITY_CAP_AUDIT); |
| 1762 | } |
| 1763 | |
| 1764 | static inline int security_capable_noaudit(struct task_struct *tsk, int cap) |
| 1765 | { |
| 1766 | return cap_capable(tsk, cap, SECURITY_CAP_NOAUDIT); |
Chris Wright | 12b5989 | 2006-03-25 03:07:41 -0800 | [diff] [blame] | 1767 | } |
| 1768 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1769 | static inline int security_acct(struct file *file) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1770 | { |
| 1771 | return 0; |
| 1772 | } |
| 1773 | |
| 1774 | static inline int security_sysctl(struct ctl_table *table, int op) |
| 1775 | { |
| 1776 | return 0; |
| 1777 | } |
| 1778 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1779 | static inline int security_quotactl(int cmds, int type, int id, |
| 1780 | struct super_block *sb) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1781 | { |
| 1782 | return 0; |
| 1783 | } |
| 1784 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1785 | static inline int security_quota_on(struct dentry *dentry) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1786 | { |
| 1787 | return 0; |
| 1788 | } |
| 1789 | |
| 1790 | static inline int security_syslog(int type) |
| 1791 | { |
| 1792 | return cap_syslog(type); |
| 1793 | } |
| 1794 | |
| 1795 | static inline int security_settime(struct timespec *ts, struct timezone *tz) |
| 1796 | { |
| 1797 | return cap_settime(ts, tz); |
| 1798 | } |
| 1799 | |
| 1800 | static inline int security_vm_enough_memory(long pages) |
| 1801 | { |
Alan Cox | 34b4e4a | 2007-08-22 14:01:28 -0700 | [diff] [blame] | 1802 | return cap_vm_enough_memory(current->mm, pages); |
| 1803 | } |
| 1804 | |
Alan Cox | 731572d | 2008-10-29 14:01:20 -0700 | [diff] [blame] | 1805 | static inline int security_vm_enough_memory_kern(long pages) |
| 1806 | { |
| 1807 | return cap_vm_enough_memory(current->mm, pages); |
| 1808 | } |
| 1809 | |
Alan Cox | 34b4e4a | 2007-08-22 14:01:28 -0700 | [diff] [blame] | 1810 | static inline int security_vm_enough_memory_mm(struct mm_struct *mm, long pages) |
| 1811 | { |
| 1812 | return cap_vm_enough_memory(mm, pages); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1813 | } |
| 1814 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1815 | static inline int security_bprm_alloc(struct linux_binprm *bprm) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1816 | { |
| 1817 | return 0; |
| 1818 | } |
| 1819 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1820 | static inline void security_bprm_free(struct linux_binprm *bprm) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1821 | { } |
| 1822 | |
David Howells | d84f4f9 | 2008-11-14 10:39:23 +1100 | [diff] [blame^] | 1823 | static inline int security_bprm_apply_creds(struct linux_binprm *bprm, int unsafe) |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1824 | { |
David Howells | d84f4f9 | 2008-11-14 10:39:23 +1100 | [diff] [blame^] | 1825 | return cap_bprm_apply_creds(bprm, unsafe); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1826 | } |
| 1827 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1828 | static inline void security_bprm_post_apply_creds(struct linux_binprm *bprm) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1829 | { |
| 1830 | return; |
| 1831 | } |
| 1832 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1833 | static inline int security_bprm_set(struct linux_binprm *bprm) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1834 | { |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1835 | return cap_bprm_set_security(bprm); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1836 | } |
| 1837 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1838 | static inline int security_bprm_check(struct linux_binprm *bprm) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1839 | { |
| 1840 | return 0; |
| 1841 | } |
| 1842 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1843 | static inline int security_bprm_secureexec(struct linux_binprm *bprm) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1844 | { |
| 1845 | return cap_bprm_secureexec(bprm); |
| 1846 | } |
| 1847 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1848 | static inline int security_sb_alloc(struct super_block *sb) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1849 | { |
| 1850 | return 0; |
| 1851 | } |
| 1852 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1853 | static inline void security_sb_free(struct super_block *sb) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1854 | { } |
| 1855 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1856 | static inline int security_sb_copy_data(char *orig, char *copy) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1857 | { |
| 1858 | return 0; |
| 1859 | } |
| 1860 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1861 | static inline int security_sb_kern_mount(struct super_block *sb, void *data) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1862 | { |
| 1863 | return 0; |
| 1864 | } |
| 1865 | |
Eric Paris | 2069f45 | 2008-07-04 09:47:13 +1000 | [diff] [blame] | 1866 | static inline int security_sb_show_options(struct seq_file *m, |
| 1867 | struct super_block *sb) |
| 1868 | { |
| 1869 | return 0; |
| 1870 | } |
| 1871 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1872 | static inline int security_sb_statfs(struct dentry *dentry) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1873 | { |
| 1874 | return 0; |
| 1875 | } |
| 1876 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1877 | static inline int security_sb_mount(char *dev_name, struct path *path, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1878 | char *type, unsigned long flags, |
| 1879 | void *data) |
| 1880 | { |
| 1881 | return 0; |
| 1882 | } |
| 1883 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1884 | static inline int security_sb_check_sb(struct vfsmount *mnt, |
| 1885 | struct path *path) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1886 | { |
| 1887 | return 0; |
| 1888 | } |
| 1889 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1890 | static inline int security_sb_umount(struct vfsmount *mnt, int flags) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1891 | { |
| 1892 | return 0; |
| 1893 | } |
| 1894 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1895 | static inline void security_sb_umount_close(struct vfsmount *mnt) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1896 | { } |
| 1897 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1898 | static inline void security_sb_umount_busy(struct vfsmount *mnt) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1899 | { } |
| 1900 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1901 | static inline void security_sb_post_remount(struct vfsmount *mnt, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1902 | unsigned long flags, void *data) |
| 1903 | { } |
| 1904 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1905 | static inline void security_sb_post_addmount(struct vfsmount *mnt, |
| 1906 | struct path *mountpoint) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1907 | { } |
| 1908 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1909 | static inline int security_sb_pivotroot(struct path *old_path, |
| 1910 | struct path *new_path) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1911 | { |
| 1912 | return 0; |
| 1913 | } |
| 1914 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1915 | static inline void security_sb_post_pivotroot(struct path *old_path, |
| 1916 | struct path *new_path) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1917 | { } |
Eric Paris | e000752 | 2008-03-05 10:31:54 -0500 | [diff] [blame] | 1918 | |
| 1919 | static inline int security_sb_set_mnt_opts(struct super_block *sb, |
| 1920 | struct security_mnt_opts *opts) |
| 1921 | { |
| 1922 | return 0; |
| 1923 | } |
| 1924 | |
| 1925 | static inline void security_sb_clone_mnt_opts(const struct super_block *oldsb, |
| 1926 | struct super_block *newsb) |
| 1927 | { } |
| 1928 | |
| 1929 | static inline int security_sb_parse_opts_str(char *options, struct security_mnt_opts *opts) |
| 1930 | { |
| 1931 | return 0; |
| 1932 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1933 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1934 | static inline int security_inode_alloc(struct inode *inode) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1935 | { |
| 1936 | return 0; |
| 1937 | } |
| 1938 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1939 | static inline void security_inode_free(struct inode *inode) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1940 | { } |
Stephen Smalley | 5e41ff9 | 2005-09-09 13:01:35 -0700 | [diff] [blame] | 1941 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1942 | static inline int security_inode_init_security(struct inode *inode, |
Stephen Smalley | 5e41ff9 | 2005-09-09 13:01:35 -0700 | [diff] [blame] | 1943 | struct inode *dir, |
| 1944 | char **name, |
| 1945 | void **value, |
| 1946 | size_t *len) |
| 1947 | { |
| 1948 | return -EOPNOTSUPP; |
| 1949 | } |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1950 | |
| 1951 | static inline int security_inode_create(struct inode *dir, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1952 | struct dentry *dentry, |
| 1953 | int mode) |
| 1954 | { |
| 1955 | return 0; |
| 1956 | } |
| 1957 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1958 | static inline int security_inode_link(struct dentry *old_dentry, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1959 | struct inode *dir, |
| 1960 | struct dentry *new_dentry) |
| 1961 | { |
| 1962 | return 0; |
| 1963 | } |
| 1964 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1965 | static inline int security_inode_unlink(struct inode *dir, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1966 | struct dentry *dentry) |
| 1967 | { |
| 1968 | return 0; |
| 1969 | } |
| 1970 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1971 | static inline int security_inode_symlink(struct inode *dir, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1972 | struct dentry *dentry, |
| 1973 | const char *old_name) |
| 1974 | { |
| 1975 | return 0; |
| 1976 | } |
| 1977 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1978 | static inline int security_inode_mkdir(struct inode *dir, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1979 | struct dentry *dentry, |
| 1980 | int mode) |
| 1981 | { |
| 1982 | return 0; |
| 1983 | } |
| 1984 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1985 | static inline int security_inode_rmdir(struct inode *dir, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1986 | struct dentry *dentry) |
| 1987 | { |
| 1988 | return 0; |
| 1989 | } |
| 1990 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1991 | static inline int security_inode_mknod(struct inode *dir, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1992 | struct dentry *dentry, |
| 1993 | int mode, dev_t dev) |
| 1994 | { |
| 1995 | return 0; |
| 1996 | } |
| 1997 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 1998 | static inline int security_inode_rename(struct inode *old_dir, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1999 | struct dentry *old_dentry, |
| 2000 | struct inode *new_dir, |
| 2001 | struct dentry *new_dentry) |
| 2002 | { |
| 2003 | return 0; |
| 2004 | } |
| 2005 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2006 | static inline int security_inode_readlink(struct dentry *dentry) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2007 | { |
| 2008 | return 0; |
| 2009 | } |
| 2010 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2011 | static inline int security_inode_follow_link(struct dentry *dentry, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2012 | struct nameidata *nd) |
| 2013 | { |
| 2014 | return 0; |
| 2015 | } |
| 2016 | |
Al Viro | b77b064 | 2008-07-17 09:37:02 -0400 | [diff] [blame] | 2017 | static inline int security_inode_permission(struct inode *inode, int mask) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2018 | { |
| 2019 | return 0; |
| 2020 | } |
| 2021 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2022 | static inline int security_inode_setattr(struct dentry *dentry, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2023 | struct iattr *attr) |
| 2024 | { |
| 2025 | return 0; |
| 2026 | } |
| 2027 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2028 | static inline int security_inode_getattr(struct vfsmount *mnt, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2029 | struct dentry *dentry) |
| 2030 | { |
| 2031 | return 0; |
| 2032 | } |
| 2033 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2034 | static inline void security_inode_delete(struct inode *inode) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2035 | { } |
| 2036 | |
David Howells | 8f0cfa5 | 2008-04-29 00:59:41 -0700 | [diff] [blame] | 2037 | static inline int security_inode_setxattr(struct dentry *dentry, |
| 2038 | const char *name, const void *value, size_t size, int flags) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2039 | { |
| 2040 | return cap_inode_setxattr(dentry, name, value, size, flags); |
| 2041 | } |
| 2042 | |
David Howells | 8f0cfa5 | 2008-04-29 00:59:41 -0700 | [diff] [blame] | 2043 | static inline void security_inode_post_setxattr(struct dentry *dentry, |
| 2044 | const char *name, const void *value, size_t size, int flags) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2045 | { } |
| 2046 | |
David Howells | 8f0cfa5 | 2008-04-29 00:59:41 -0700 | [diff] [blame] | 2047 | static inline int security_inode_getxattr(struct dentry *dentry, |
| 2048 | const char *name) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2049 | { |
| 2050 | return 0; |
| 2051 | } |
| 2052 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2053 | static inline int security_inode_listxattr(struct dentry *dentry) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2054 | { |
| 2055 | return 0; |
| 2056 | } |
| 2057 | |
David Howells | 8f0cfa5 | 2008-04-29 00:59:41 -0700 | [diff] [blame] | 2058 | static inline int security_inode_removexattr(struct dentry *dentry, |
| 2059 | const char *name) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2060 | { |
| 2061 | return cap_inode_removexattr(dentry, name); |
| 2062 | } |
| 2063 | |
Serge E. Hallyn | b537677 | 2007-10-16 23:31:36 -0700 | [diff] [blame] | 2064 | static inline int security_inode_need_killpriv(struct dentry *dentry) |
| 2065 | { |
| 2066 | return cap_inode_need_killpriv(dentry); |
| 2067 | } |
| 2068 | |
| 2069 | static inline int security_inode_killpriv(struct dentry *dentry) |
| 2070 | { |
| 2071 | return cap_inode_killpriv(dentry); |
| 2072 | } |
| 2073 | |
David P. Quigley | 4249259 | 2008-02-04 22:29:39 -0800 | [diff] [blame] | 2074 | static inline int security_inode_getsecurity(const struct inode *inode, const char *name, void **buffer, bool alloc) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2075 | { |
| 2076 | return -EOPNOTSUPP; |
| 2077 | } |
| 2078 | |
| 2079 | static inline int security_inode_setsecurity(struct inode *inode, const char *name, const void *value, size_t size, int flags) |
| 2080 | { |
| 2081 | return -EOPNOTSUPP; |
| 2082 | } |
| 2083 | |
| 2084 | static inline int security_inode_listsecurity(struct inode *inode, char *buffer, size_t buffer_size) |
| 2085 | { |
| 2086 | return 0; |
| 2087 | } |
| 2088 | |
Ahmed S. Darwish | 8a07619 | 2008-03-01 21:51:09 +0200 | [diff] [blame] | 2089 | static inline void security_inode_getsecid(const struct inode *inode, u32 *secid) |
| 2090 | { |
| 2091 | *secid = 0; |
| 2092 | } |
| 2093 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2094 | static inline int security_file_permission(struct file *file, int mask) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2095 | { |
| 2096 | return 0; |
| 2097 | } |
| 2098 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2099 | static inline int security_file_alloc(struct file *file) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2100 | { |
| 2101 | return 0; |
| 2102 | } |
| 2103 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2104 | static inline void security_file_free(struct file *file) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2105 | { } |
| 2106 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2107 | static inline int security_file_ioctl(struct file *file, unsigned int cmd, |
| 2108 | unsigned long arg) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2109 | { |
| 2110 | return 0; |
| 2111 | } |
| 2112 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2113 | static inline int security_file_mmap(struct file *file, unsigned long reqprot, |
| 2114 | unsigned long prot, |
| 2115 | unsigned long flags, |
| 2116 | unsigned long addr, |
| 2117 | unsigned long addr_only) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2118 | { |
| 2119 | return 0; |
| 2120 | } |
| 2121 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2122 | static inline int security_file_mprotect(struct vm_area_struct *vma, |
| 2123 | unsigned long reqprot, |
| 2124 | unsigned long prot) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2125 | { |
| 2126 | return 0; |
| 2127 | } |
| 2128 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2129 | static inline int security_file_lock(struct file *file, unsigned int cmd) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2130 | { |
| 2131 | return 0; |
| 2132 | } |
| 2133 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2134 | static inline int security_file_fcntl(struct file *file, unsigned int cmd, |
| 2135 | unsigned long arg) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2136 | { |
| 2137 | return 0; |
| 2138 | } |
| 2139 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2140 | static inline int security_file_set_fowner(struct file *file) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2141 | { |
| 2142 | return 0; |
| 2143 | } |
| 2144 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2145 | static inline int security_file_send_sigiotask(struct task_struct *tsk, |
| 2146 | struct fown_struct *fown, |
| 2147 | int sig) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2148 | { |
| 2149 | return 0; |
| 2150 | } |
| 2151 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2152 | static inline int security_file_receive(struct file *file) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2153 | { |
| 2154 | return 0; |
| 2155 | } |
| 2156 | |
David Howells | 745ca24 | 2008-11-14 10:39:22 +1100 | [diff] [blame] | 2157 | static inline int security_dentry_open(struct file *file, |
| 2158 | const struct cred *cred) |
Yuichi Nakamura | 788e7dd | 2007-09-14 09:27:07 +0900 | [diff] [blame] | 2159 | { |
| 2160 | return 0; |
| 2161 | } |
| 2162 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2163 | static inline int security_task_create(unsigned long clone_flags) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2164 | { |
| 2165 | return 0; |
| 2166 | } |
| 2167 | |
David Howells | d84f4f9 | 2008-11-14 10:39:23 +1100 | [diff] [blame^] | 2168 | static inline void security_cred_free(struct cred *cred) |
| 2169 | { } |
| 2170 | |
| 2171 | static inline int security_prepare_creds(struct cred *new, |
| 2172 | const struct cred *old, |
| 2173 | gfp_t gfp) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2174 | { |
| 2175 | return 0; |
| 2176 | } |
| 2177 | |
David Howells | d84f4f9 | 2008-11-14 10:39:23 +1100 | [diff] [blame^] | 2178 | static inline void security_commit_creds(struct cred *new, |
| 2179 | const struct cred *old) |
| 2180 | { |
| 2181 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2182 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2183 | static inline int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, |
| 2184 | int flags) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2185 | { |
| 2186 | return 0; |
| 2187 | } |
| 2188 | |
David Howells | d84f4f9 | 2008-11-14 10:39:23 +1100 | [diff] [blame^] | 2189 | static inline int security_task_fix_setuid(struct cred *new, |
| 2190 | const struct cred *old, |
| 2191 | int flags) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2192 | { |
David Howells | d84f4f9 | 2008-11-14 10:39:23 +1100 | [diff] [blame^] | 2193 | return cap_task_fix_setuid(new, old, flags); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2194 | } |
| 2195 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2196 | static inline int security_task_setgid(gid_t id0, gid_t id1, gid_t id2, |
| 2197 | int flags) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2198 | { |
| 2199 | return 0; |
| 2200 | } |
| 2201 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2202 | static inline int security_task_setpgid(struct task_struct *p, pid_t pgid) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2203 | { |
| 2204 | return 0; |
| 2205 | } |
| 2206 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2207 | static inline int security_task_getpgid(struct task_struct *p) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2208 | { |
| 2209 | return 0; |
| 2210 | } |
| 2211 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2212 | static inline int security_task_getsid(struct task_struct *p) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2213 | { |
| 2214 | return 0; |
| 2215 | } |
| 2216 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2217 | static inline void security_task_getsecid(struct task_struct *p, u32 *secid) |
Ahmed S. Darwish | 8a07619 | 2008-03-01 21:51:09 +0200 | [diff] [blame] | 2218 | { |
| 2219 | *secid = 0; |
| 2220 | } |
David Quigley | f9008e4 | 2006-06-30 01:55:46 -0700 | [diff] [blame] | 2221 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2222 | static inline int security_task_setgroups(struct group_info *group_info) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2223 | { |
| 2224 | return 0; |
| 2225 | } |
| 2226 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2227 | static inline int security_task_setnice(struct task_struct *p, int nice) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2228 | { |
Serge E. Hallyn | b537677 | 2007-10-16 23:31:36 -0700 | [diff] [blame] | 2229 | return cap_task_setnice(p, nice); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2230 | } |
| 2231 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2232 | static inline int security_task_setioprio(struct task_struct *p, int ioprio) |
James Morris | 03e6806 | 2006-06-23 02:03:58 -0700 | [diff] [blame] | 2233 | { |
Serge E. Hallyn | b537677 | 2007-10-16 23:31:36 -0700 | [diff] [blame] | 2234 | return cap_task_setioprio(p, ioprio); |
James Morris | 03e6806 | 2006-06-23 02:03:58 -0700 | [diff] [blame] | 2235 | } |
| 2236 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2237 | static inline int security_task_getioprio(struct task_struct *p) |
David Quigley | a1836a4 | 2006-06-30 01:55:49 -0700 | [diff] [blame] | 2238 | { |
| 2239 | return 0; |
| 2240 | } |
| 2241 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2242 | static inline int security_task_setrlimit(unsigned int resource, |
| 2243 | struct rlimit *new_rlim) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2244 | { |
| 2245 | return 0; |
| 2246 | } |
| 2247 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2248 | static inline int security_task_setscheduler(struct task_struct *p, |
| 2249 | int policy, |
| 2250 | struct sched_param *lp) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2251 | { |
Serge E. Hallyn | b537677 | 2007-10-16 23:31:36 -0700 | [diff] [blame] | 2252 | return cap_task_setscheduler(p, policy, lp); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2253 | } |
| 2254 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2255 | static inline int security_task_getscheduler(struct task_struct *p) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2256 | { |
| 2257 | return 0; |
| 2258 | } |
| 2259 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2260 | static inline int security_task_movememory(struct task_struct *p) |
David Quigley | 3560154 | 2006-06-23 02:04:01 -0700 | [diff] [blame] | 2261 | { |
| 2262 | return 0; |
| 2263 | } |
| 2264 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2265 | static inline int security_task_kill(struct task_struct *p, |
| 2266 | struct siginfo *info, int sig, |
| 2267 | u32 secid) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2268 | { |
Serge Hallyn | aedb60a | 2008-02-29 15:14:57 +0000 | [diff] [blame] | 2269 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2270 | } |
| 2271 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2272 | static inline int security_task_wait(struct task_struct *p) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2273 | { |
| 2274 | return 0; |
| 2275 | } |
| 2276 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2277 | static inline int security_task_prctl(int option, unsigned long arg2, |
| 2278 | unsigned long arg3, |
| 2279 | unsigned long arg4, |
David Howells | d84f4f9 | 2008-11-14 10:39:23 +1100 | [diff] [blame^] | 2280 | unsigned long arg5) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2281 | { |
David Howells | d84f4f9 | 2008-11-14 10:39:23 +1100 | [diff] [blame^] | 2282 | return cap_task_prctl(option, arg2, arg3, arg3, arg5); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2283 | } |
| 2284 | |
| 2285 | static inline void security_task_to_inode(struct task_struct *p, struct inode *inode) |
| 2286 | { } |
| 2287 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2288 | static inline int security_ipc_permission(struct kern_ipc_perm *ipcp, |
| 2289 | short flag) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2290 | { |
| 2291 | return 0; |
| 2292 | } |
| 2293 | |
Ahmed S. Darwish | 8a07619 | 2008-03-01 21:51:09 +0200 | [diff] [blame] | 2294 | static inline void security_ipc_getsecid(struct kern_ipc_perm *ipcp, u32 *secid) |
| 2295 | { |
| 2296 | *secid = 0; |
| 2297 | } |
| 2298 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2299 | static inline int security_msg_msg_alloc(struct msg_msg *msg) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2300 | { |
| 2301 | return 0; |
| 2302 | } |
| 2303 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2304 | static inline void security_msg_msg_free(struct msg_msg *msg) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2305 | { } |
| 2306 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2307 | static inline int security_msg_queue_alloc(struct msg_queue *msq) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2308 | { |
| 2309 | return 0; |
| 2310 | } |
| 2311 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2312 | static inline void security_msg_queue_free(struct msg_queue *msq) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2313 | { } |
| 2314 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2315 | static inline int security_msg_queue_associate(struct msg_queue *msq, |
| 2316 | int msqflg) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2317 | { |
| 2318 | return 0; |
| 2319 | } |
| 2320 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2321 | static inline int security_msg_queue_msgctl(struct msg_queue *msq, int cmd) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2322 | { |
| 2323 | return 0; |
| 2324 | } |
| 2325 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2326 | static inline int security_msg_queue_msgsnd(struct msg_queue *msq, |
| 2327 | struct msg_msg *msg, int msqflg) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2328 | { |
| 2329 | return 0; |
| 2330 | } |
| 2331 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2332 | static inline int security_msg_queue_msgrcv(struct msg_queue *msq, |
| 2333 | struct msg_msg *msg, |
| 2334 | struct task_struct *target, |
| 2335 | long type, int mode) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2336 | { |
| 2337 | return 0; |
| 2338 | } |
| 2339 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2340 | static inline int security_shm_alloc(struct shmid_kernel *shp) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2341 | { |
| 2342 | return 0; |
| 2343 | } |
| 2344 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2345 | static inline void security_shm_free(struct shmid_kernel *shp) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2346 | { } |
| 2347 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2348 | static inline int security_shm_associate(struct shmid_kernel *shp, |
| 2349 | int shmflg) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2350 | { |
| 2351 | return 0; |
| 2352 | } |
| 2353 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2354 | static inline int security_shm_shmctl(struct shmid_kernel *shp, int cmd) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2355 | { |
| 2356 | return 0; |
| 2357 | } |
| 2358 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2359 | static inline int security_shm_shmat(struct shmid_kernel *shp, |
| 2360 | char __user *shmaddr, int shmflg) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2361 | { |
| 2362 | return 0; |
| 2363 | } |
| 2364 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2365 | static inline int security_sem_alloc(struct sem_array *sma) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2366 | { |
| 2367 | return 0; |
| 2368 | } |
| 2369 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2370 | static inline void security_sem_free(struct sem_array *sma) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2371 | { } |
| 2372 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2373 | static inline int security_sem_associate(struct sem_array *sma, int semflg) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2374 | { |
| 2375 | return 0; |
| 2376 | } |
| 2377 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2378 | static inline int security_sem_semctl(struct sem_array *sma, int cmd) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2379 | { |
| 2380 | return 0; |
| 2381 | } |
| 2382 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2383 | static inline int security_sem_semop(struct sem_array *sma, |
| 2384 | struct sembuf *sops, unsigned nsops, |
| 2385 | int alter) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2386 | { |
| 2387 | return 0; |
| 2388 | } |
| 2389 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2390 | static inline void security_d_instantiate(struct dentry *dentry, struct inode *inode) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2391 | { } |
| 2392 | |
Al Viro | 04ff970 | 2007-03-12 16:17:58 +0000 | [diff] [blame] | 2393 | static inline int security_getprocattr(struct task_struct *p, char *name, char **value) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2394 | { |
| 2395 | return -EINVAL; |
| 2396 | } |
| 2397 | |
| 2398 | static inline int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size) |
| 2399 | { |
| 2400 | return -EINVAL; |
| 2401 | } |
| 2402 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2403 | static inline int security_netlink_send(struct sock *sk, struct sk_buff *skb) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2404 | { |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2405 | return cap_netlink_send(sk, skb); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2406 | } |
| 2407 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2408 | static inline int security_netlink_recv(struct sk_buff *skb, int cap) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2409 | { |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2410 | return cap_netlink_recv(skb, cap); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2411 | } |
| 2412 | |
Catherine Zhang | dc49c1f | 2006-08-02 14:12:06 -0700 | [diff] [blame] | 2413 | static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) |
| 2414 | { |
| 2415 | return -EOPNOTSUPP; |
| 2416 | } |
| 2417 | |
David Howells | 7bf570d | 2008-04-29 20:52:51 +0100 | [diff] [blame] | 2418 | static inline int security_secctx_to_secid(const char *secdata, |
David Howells | 63cb344 | 2008-01-15 23:47:35 +0000 | [diff] [blame] | 2419 | u32 seclen, |
| 2420 | u32 *secid) |
| 2421 | { |
| 2422 | return -EOPNOTSUPP; |
| 2423 | } |
| 2424 | |
Catherine Zhang | dc49c1f | 2006-08-02 14:12:06 -0700 | [diff] [blame] | 2425 | static inline void security_release_secctx(char *secdata, u32 seclen) |
| 2426 | { |
Catherine Zhang | dc49c1f | 2006-08-02 14:12:06 -0700 | [diff] [blame] | 2427 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2428 | #endif /* CONFIG_SECURITY */ |
| 2429 | |
| 2430 | #ifdef CONFIG_SECURITY_NETWORK |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2431 | |
James Morris | 20510f2 | 2007-10-16 23:31:32 -0700 | [diff] [blame] | 2432 | int security_unix_stream_connect(struct socket *sock, struct socket *other, |
| 2433 | struct sock *newsk); |
| 2434 | int security_unix_may_send(struct socket *sock, struct socket *other); |
| 2435 | int security_socket_create(int family, int type, int protocol, int kern); |
| 2436 | int security_socket_post_create(struct socket *sock, int family, |
| 2437 | int type, int protocol, int kern); |
| 2438 | int security_socket_bind(struct socket *sock, struct sockaddr *address, int addrlen); |
| 2439 | int security_socket_connect(struct socket *sock, struct sockaddr *address, int addrlen); |
| 2440 | int security_socket_listen(struct socket *sock, int backlog); |
| 2441 | int security_socket_accept(struct socket *sock, struct socket *newsock); |
| 2442 | void security_socket_post_accept(struct socket *sock, struct socket *newsock); |
| 2443 | int security_socket_sendmsg(struct socket *sock, struct msghdr *msg, int size); |
| 2444 | int security_socket_recvmsg(struct socket *sock, struct msghdr *msg, |
| 2445 | int size, int flags); |
| 2446 | int security_socket_getsockname(struct socket *sock); |
| 2447 | int security_socket_getpeername(struct socket *sock); |
| 2448 | int security_socket_getsockopt(struct socket *sock, int level, int optname); |
| 2449 | int security_socket_setsockopt(struct socket *sock, int level, int optname); |
| 2450 | int security_socket_shutdown(struct socket *sock, int how); |
| 2451 | int security_sock_rcv_skb(struct sock *sk, struct sk_buff *skb); |
| 2452 | int security_socket_getpeersec_stream(struct socket *sock, char __user *optval, |
| 2453 | int __user *optlen, unsigned len); |
| 2454 | int security_socket_getpeersec_dgram(struct socket *sock, struct sk_buff *skb, u32 *secid); |
| 2455 | int security_sk_alloc(struct sock *sk, int family, gfp_t priority); |
| 2456 | void security_sk_free(struct sock *sk); |
| 2457 | void security_sk_clone(const struct sock *sk, struct sock *newsk); |
| 2458 | void security_sk_classify_flow(struct sock *sk, struct flowi *fl); |
| 2459 | void security_req_classify_flow(const struct request_sock *req, struct flowi *fl); |
| 2460 | void security_sock_graft(struct sock*sk, struct socket *parent); |
| 2461 | int security_inet_conn_request(struct sock *sk, |
| 2462 | struct sk_buff *skb, struct request_sock *req); |
| 2463 | void security_inet_csk_clone(struct sock *newsk, |
| 2464 | const struct request_sock *req); |
| 2465 | void security_inet_conn_established(struct sock *sk, |
| 2466 | struct sk_buff *skb); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2467 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2468 | #else /* CONFIG_SECURITY_NETWORK */ |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2469 | static inline int security_unix_stream_connect(struct socket *sock, |
| 2470 | struct socket *other, |
| 2471 | struct sock *newsk) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2472 | { |
| 2473 | return 0; |
| 2474 | } |
| 2475 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2476 | static inline int security_unix_may_send(struct socket *sock, |
| 2477 | struct socket *other) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2478 | { |
| 2479 | return 0; |
| 2480 | } |
| 2481 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2482 | static inline int security_socket_create(int family, int type, |
| 2483 | int protocol, int kern) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2484 | { |
| 2485 | return 0; |
| 2486 | } |
| 2487 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2488 | static inline int security_socket_post_create(struct socket *sock, |
Venkat Yekkirala | 7420ed2 | 2006-08-04 23:17:57 -0700 | [diff] [blame] | 2489 | int family, |
| 2490 | int type, |
| 2491 | int protocol, int kern) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2492 | { |
Venkat Yekkirala | 7420ed2 | 2006-08-04 23:17:57 -0700 | [diff] [blame] | 2493 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2494 | } |
| 2495 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2496 | static inline int security_socket_bind(struct socket *sock, |
| 2497 | struct sockaddr *address, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2498 | int addrlen) |
| 2499 | { |
| 2500 | return 0; |
| 2501 | } |
| 2502 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2503 | static inline int security_socket_connect(struct socket *sock, |
| 2504 | struct sockaddr *address, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2505 | int addrlen) |
| 2506 | { |
| 2507 | return 0; |
| 2508 | } |
| 2509 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2510 | static inline int security_socket_listen(struct socket *sock, int backlog) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2511 | { |
| 2512 | return 0; |
| 2513 | } |
| 2514 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2515 | static inline int security_socket_accept(struct socket *sock, |
| 2516 | struct socket *newsock) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2517 | { |
| 2518 | return 0; |
| 2519 | } |
| 2520 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2521 | static inline void security_socket_post_accept(struct socket *sock, |
| 2522 | struct socket *newsock) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2523 | { |
| 2524 | } |
| 2525 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2526 | static inline int security_socket_sendmsg(struct socket *sock, |
| 2527 | struct msghdr *msg, int size) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2528 | { |
| 2529 | return 0; |
| 2530 | } |
| 2531 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2532 | static inline int security_socket_recvmsg(struct socket *sock, |
| 2533 | struct msghdr *msg, int size, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2534 | int flags) |
| 2535 | { |
| 2536 | return 0; |
| 2537 | } |
| 2538 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2539 | static inline int security_socket_getsockname(struct socket *sock) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2540 | { |
| 2541 | return 0; |
| 2542 | } |
| 2543 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2544 | static inline int security_socket_getpeername(struct socket *sock) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2545 | { |
| 2546 | return 0; |
| 2547 | } |
| 2548 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2549 | static inline int security_socket_getsockopt(struct socket *sock, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2550 | int level, int optname) |
| 2551 | { |
| 2552 | return 0; |
| 2553 | } |
| 2554 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2555 | static inline int security_socket_setsockopt(struct socket *sock, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2556 | int level, int optname) |
| 2557 | { |
| 2558 | return 0; |
| 2559 | } |
| 2560 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2561 | static inline int security_socket_shutdown(struct socket *sock, int how) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2562 | { |
| 2563 | return 0; |
| 2564 | } |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2565 | static inline int security_sock_rcv_skb(struct sock *sk, |
| 2566 | struct sk_buff *skb) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2567 | { |
| 2568 | return 0; |
| 2569 | } |
| 2570 | |
Catherine Zhang | 2c7946a | 2006-03-20 22:41:23 -0800 | [diff] [blame] | 2571 | static inline int security_socket_getpeersec_stream(struct socket *sock, char __user *optval, |
| 2572 | int __user *optlen, unsigned len) |
| 2573 | { |
| 2574 | return -ENOPROTOOPT; |
| 2575 | } |
| 2576 | |
Catherine Zhang | dc49c1f | 2006-08-02 14:12:06 -0700 | [diff] [blame] | 2577 | static inline int security_socket_getpeersec_dgram(struct socket *sock, struct sk_buff *skb, u32 *secid) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2578 | { |
| 2579 | return -ENOPROTOOPT; |
| 2580 | } |
| 2581 | |
Al Viro | dd0fc66 | 2005-10-07 07:46:04 +0100 | [diff] [blame] | 2582 | static inline int security_sk_alloc(struct sock *sk, int family, gfp_t priority) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2583 | { |
| 2584 | return 0; |
| 2585 | } |
| 2586 | |
| 2587 | static inline void security_sk_free(struct sock *sk) |
| 2588 | { |
| 2589 | } |
Trent Jaeger | df71837 | 2005-12-13 23:12:27 -0800 | [diff] [blame] | 2590 | |
Venkat Yekkirala | 892c141 | 2006-08-04 23:08:56 -0700 | [diff] [blame] | 2591 | static inline void security_sk_clone(const struct sock *sk, struct sock *newsk) |
| 2592 | { |
| 2593 | } |
| 2594 | |
Venkat Yekkirala | beb8d13 | 2006-08-04 23:12:42 -0700 | [diff] [blame] | 2595 | static inline void security_sk_classify_flow(struct sock *sk, struct flowi *fl) |
Trent Jaeger | df71837 | 2005-12-13 23:12:27 -0800 | [diff] [blame] | 2596 | { |
Trent Jaeger | df71837 | 2005-12-13 23:12:27 -0800 | [diff] [blame] | 2597 | } |
Venkat Yekkirala | 4237c75 | 2006-07-24 23:32:50 -0700 | [diff] [blame] | 2598 | |
| 2599 | static inline void security_req_classify_flow(const struct request_sock *req, struct flowi *fl) |
| 2600 | { |
| 2601 | } |
| 2602 | |
Eric Paris | 7b41b17 | 2008-04-23 14:10:25 -0400 | [diff] [blame] | 2603 | static inline void security_sock_graft(struct sock *sk, struct socket *parent) |
Venkat Yekkirala | 4237c75 | 2006-07-24 23:32:50 -0700 | [diff] [blame] | 2604 | { |
| 2605 | } |
| 2606 | |
| 2607 | static inline int security_inet_conn_request(struct sock *sk, |
| 2608 | struct sk_buff *skb, struct request_sock *req) |
| 2609 | { |
| 2610 | return 0; |
| 2611 | } |
| 2612 | |
| 2613 | static inline void security_inet_csk_clone(struct sock *newsk, |
| 2614 | const struct request_sock *req) |
| 2615 | { |
| 2616 | } |
Venkat Yekkirala | 6b87769 | 2006-11-08 17:04:09 -0600 | [diff] [blame] | 2617 | |
| 2618 | static inline void security_inet_conn_established(struct sock *sk, |
| 2619 | struct sk_buff *skb) |
| 2620 | { |
| 2621 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2622 | #endif /* CONFIG_SECURITY_NETWORK */ |
| 2623 | |
Trent Jaeger | df71837 | 2005-12-13 23:12:27 -0800 | [diff] [blame] | 2624 | #ifdef CONFIG_SECURITY_NETWORK_XFRM |
Venkat Yekkirala | cb969f0 | 2006-07-24 23:32:20 -0700 | [diff] [blame] | 2625 | |
Paul Moore | 03e1ad7 | 2008-04-12 19:07:52 -0700 | [diff] [blame] | 2626 | int security_xfrm_policy_alloc(struct xfrm_sec_ctx **ctxp, struct xfrm_user_sec_ctx *sec_ctx); |
| 2627 | int security_xfrm_policy_clone(struct xfrm_sec_ctx *old_ctx, struct xfrm_sec_ctx **new_ctxp); |
| 2628 | void security_xfrm_policy_free(struct xfrm_sec_ctx *ctx); |
| 2629 | int security_xfrm_policy_delete(struct xfrm_sec_ctx *ctx); |
James Morris | 20510f2 | 2007-10-16 23:31:32 -0700 | [diff] [blame] | 2630 | int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx); |
| 2631 | int security_xfrm_state_alloc_acquire(struct xfrm_state *x, |
| 2632 | struct xfrm_sec_ctx *polsec, u32 secid); |
| 2633 | int security_xfrm_state_delete(struct xfrm_state *x); |
| 2634 | void security_xfrm_state_free(struct xfrm_state *x); |
Paul Moore | 03e1ad7 | 2008-04-12 19:07:52 -0700 | [diff] [blame] | 2635 | int security_xfrm_policy_lookup(struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir); |
James Morris | 20510f2 | 2007-10-16 23:31:32 -0700 | [diff] [blame] | 2636 | int security_xfrm_state_pol_flow_match(struct xfrm_state *x, |
| 2637 | struct xfrm_policy *xp, struct flowi *fl); |
| 2638 | int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid); |
| 2639 | void security_skb_classify_flow(struct sk_buff *skb, struct flowi *fl); |
Trent Jaeger | df71837 | 2005-12-13 23:12:27 -0800 | [diff] [blame] | 2640 | |
Trent Jaeger | df71837 | 2005-12-13 23:12:27 -0800 | [diff] [blame] | 2641 | #else /* CONFIG_SECURITY_NETWORK_XFRM */ |
James Morris | 20510f2 | 2007-10-16 23:31:32 -0700 | [diff] [blame] | 2642 | |
Paul Moore | 03e1ad7 | 2008-04-12 19:07:52 -0700 | [diff] [blame] | 2643 | static inline int security_xfrm_policy_alloc(struct xfrm_sec_ctx **ctxp, struct xfrm_user_sec_ctx *sec_ctx) |
Trent Jaeger | df71837 | 2005-12-13 23:12:27 -0800 | [diff] [blame] | 2644 | { |
| 2645 | return 0; |
| 2646 | } |
| 2647 | |
Paul Moore | 03e1ad7 | 2008-04-12 19:07:52 -0700 | [diff] [blame] | 2648 | static inline int security_xfrm_policy_clone(struct xfrm_sec_ctx *old, struct xfrm_sec_ctx **new_ctxp) |
Trent Jaeger | df71837 | 2005-12-13 23:12:27 -0800 | [diff] [blame] | 2649 | { |
| 2650 | return 0; |
| 2651 | } |
| 2652 | |
Paul Moore | 03e1ad7 | 2008-04-12 19:07:52 -0700 | [diff] [blame] | 2653 | static inline void security_xfrm_policy_free(struct xfrm_sec_ctx *ctx) |
Trent Jaeger | df71837 | 2005-12-13 23:12:27 -0800 | [diff] [blame] | 2654 | { |
| 2655 | } |
| 2656 | |
Paul Moore | 03e1ad7 | 2008-04-12 19:07:52 -0700 | [diff] [blame] | 2657 | static inline int security_xfrm_policy_delete(struct xfrm_sec_ctx *ctx) |
Catherine Zhang | c8c05a8 | 2006-06-08 23:39:49 -0700 | [diff] [blame] | 2658 | { |
| 2659 | return 0; |
| 2660 | } |
| 2661 | |
Venkat Yekkirala | e0d1caa | 2006-07-24 23:29:07 -0700 | [diff] [blame] | 2662 | static inline int security_xfrm_state_alloc(struct xfrm_state *x, |
| 2663 | struct xfrm_user_sec_ctx *sec_ctx) |
| 2664 | { |
| 2665 | return 0; |
| 2666 | } |
| 2667 | |
| 2668 | static inline int security_xfrm_state_alloc_acquire(struct xfrm_state *x, |
| 2669 | struct xfrm_sec_ctx *polsec, u32 secid) |
Trent Jaeger | df71837 | 2005-12-13 23:12:27 -0800 | [diff] [blame] | 2670 | { |
| 2671 | return 0; |
| 2672 | } |
| 2673 | |
| 2674 | static inline void security_xfrm_state_free(struct xfrm_state *x) |
| 2675 | { |
| 2676 | } |
| 2677 | |
David S. Miller | 6f68dc3 | 2006-06-08 23:58:52 -0700 | [diff] [blame] | 2678 | static inline int security_xfrm_state_delete(struct xfrm_state *x) |
Catherine Zhang | c8c05a8 | 2006-06-08 23:39:49 -0700 | [diff] [blame] | 2679 | { |
| 2680 | return 0; |
| 2681 | } |
| 2682 | |
Paul Moore | 03e1ad7 | 2008-04-12 19:07:52 -0700 | [diff] [blame] | 2683 | static inline int security_xfrm_policy_lookup(struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir) |
Trent Jaeger | df71837 | 2005-12-13 23:12:27 -0800 | [diff] [blame] | 2684 | { |
| 2685 | return 0; |
| 2686 | } |
Venkat Yekkirala | e0d1caa | 2006-07-24 23:29:07 -0700 | [diff] [blame] | 2687 | |
| 2688 | static inline int security_xfrm_state_pol_flow_match(struct xfrm_state *x, |
| 2689 | struct xfrm_policy *xp, struct flowi *fl) |
| 2690 | { |
| 2691 | return 1; |
| 2692 | } |
| 2693 | |
Venkat Yekkirala | beb8d13 | 2006-08-04 23:12:42 -0700 | [diff] [blame] | 2694 | static inline int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid) |
Venkat Yekkirala | e0d1caa | 2006-07-24 23:29:07 -0700 | [diff] [blame] | 2695 | { |
| 2696 | return 0; |
| 2697 | } |
| 2698 | |
Venkat Yekkirala | beb8d13 | 2006-08-04 23:12:42 -0700 | [diff] [blame] | 2699 | static inline void security_skb_classify_flow(struct sk_buff *skb, struct flowi *fl) |
| 2700 | { |
| 2701 | } |
| 2702 | |
Trent Jaeger | df71837 | 2005-12-13 23:12:27 -0800 | [diff] [blame] | 2703 | #endif /* CONFIG_SECURITY_NETWORK_XFRM */ |
| 2704 | |
David Howells | 29db919 | 2005-10-30 15:02:44 -0800 | [diff] [blame] | 2705 | #ifdef CONFIG_KEYS |
| 2706 | #ifdef CONFIG_SECURITY |
David Howells | 29db919 | 2005-10-30 15:02:44 -0800 | [diff] [blame] | 2707 | |
David Howells | d84f4f9 | 2008-11-14 10:39:23 +1100 | [diff] [blame^] | 2708 | int security_key_alloc(struct key *key, const struct cred *cred, unsigned long flags); |
James Morris | 20510f2 | 2007-10-16 23:31:32 -0700 | [diff] [blame] | 2709 | void security_key_free(struct key *key); |
| 2710 | int security_key_permission(key_ref_t key_ref, |
David Howells | d84f4f9 | 2008-11-14 10:39:23 +1100 | [diff] [blame^] | 2711 | const struct cred *cred, key_perm_t perm); |
David Howells | 70a5bb7 | 2008-04-29 01:01:26 -0700 | [diff] [blame] | 2712 | int security_key_getsecurity(struct key *key, char **_buffer); |
David Howells | 29db919 | 2005-10-30 15:02:44 -0800 | [diff] [blame] | 2713 | |
| 2714 | #else |
| 2715 | |
Michael LeMay | d720024 | 2006-06-22 14:47:17 -0700 | [diff] [blame] | 2716 | static inline int security_key_alloc(struct key *key, |
David Howells | d84f4f9 | 2008-11-14 10:39:23 +1100 | [diff] [blame^] | 2717 | const struct cred *cred, |
David Howells | 7e047ef | 2006-06-26 00:24:50 -0700 | [diff] [blame] | 2718 | unsigned long flags) |
David Howells | 29db919 | 2005-10-30 15:02:44 -0800 | [diff] [blame] | 2719 | { |
| 2720 | return 0; |
| 2721 | } |
| 2722 | |
| 2723 | static inline void security_key_free(struct key *key) |
| 2724 | { |
| 2725 | } |
| 2726 | |
| 2727 | static inline int security_key_permission(key_ref_t key_ref, |
David Howells | d84f4f9 | 2008-11-14 10:39:23 +1100 | [diff] [blame^] | 2728 | const struct cred *cred, |
David Howells | 29db919 | 2005-10-30 15:02:44 -0800 | [diff] [blame] | 2729 | key_perm_t perm) |
| 2730 | { |
| 2731 | return 0; |
| 2732 | } |
| 2733 | |
David Howells | 70a5bb7 | 2008-04-29 01:01:26 -0700 | [diff] [blame] | 2734 | static inline int security_key_getsecurity(struct key *key, char **_buffer) |
| 2735 | { |
| 2736 | *_buffer = NULL; |
| 2737 | return 0; |
| 2738 | } |
| 2739 | |
David Howells | 29db919 | 2005-10-30 15:02:44 -0800 | [diff] [blame] | 2740 | #endif |
| 2741 | #endif /* CONFIG_KEYS */ |
| 2742 | |
Ahmed S. Darwish | 03d37d2 | 2008-03-01 22:00:05 +0200 | [diff] [blame] | 2743 | #ifdef CONFIG_AUDIT |
| 2744 | #ifdef CONFIG_SECURITY |
| 2745 | int security_audit_rule_init(u32 field, u32 op, char *rulestr, void **lsmrule); |
| 2746 | int security_audit_rule_known(struct audit_krule *krule); |
| 2747 | int security_audit_rule_match(u32 secid, u32 field, u32 op, void *lsmrule, |
| 2748 | struct audit_context *actx); |
| 2749 | void security_audit_rule_free(void *lsmrule); |
| 2750 | |
| 2751 | #else |
| 2752 | |
| 2753 | static inline int security_audit_rule_init(u32 field, u32 op, char *rulestr, |
| 2754 | void **lsmrule) |
| 2755 | { |
| 2756 | return 0; |
| 2757 | } |
| 2758 | |
| 2759 | static inline int security_audit_rule_known(struct audit_krule *krule) |
| 2760 | { |
| 2761 | return 0; |
| 2762 | } |
| 2763 | |
| 2764 | static inline int security_audit_rule_match(u32 secid, u32 field, u32 op, |
| 2765 | void *lsmrule, struct audit_context *actx) |
| 2766 | { |
| 2767 | return 0; |
| 2768 | } |
| 2769 | |
| 2770 | static inline void security_audit_rule_free(void *lsmrule) |
| 2771 | { } |
| 2772 | |
| 2773 | #endif /* CONFIG_SECURITY */ |
| 2774 | #endif /* CONFIG_AUDIT */ |
| 2775 | |
Eric Paris | da31894 | 2008-08-22 11:35:57 -0400 | [diff] [blame] | 2776 | #ifdef CONFIG_SECURITYFS |
| 2777 | |
| 2778 | extern struct dentry *securityfs_create_file(const char *name, mode_t mode, |
| 2779 | struct dentry *parent, void *data, |
| 2780 | const struct file_operations *fops); |
| 2781 | extern struct dentry *securityfs_create_dir(const char *name, struct dentry *parent); |
| 2782 | extern void securityfs_remove(struct dentry *dentry); |
| 2783 | |
| 2784 | #else /* CONFIG_SECURITYFS */ |
| 2785 | |
| 2786 | static inline struct dentry *securityfs_create_dir(const char *name, |
| 2787 | struct dentry *parent) |
| 2788 | { |
| 2789 | return ERR_PTR(-ENODEV); |
| 2790 | } |
| 2791 | |
| 2792 | static inline struct dentry *securityfs_create_file(const char *name, |
| 2793 | mode_t mode, |
| 2794 | struct dentry *parent, |
| 2795 | void *data, |
| 2796 | const struct file_operations *fops) |
| 2797 | { |
| 2798 | return ERR_PTR(-ENODEV); |
| 2799 | } |
| 2800 | |
| 2801 | static inline void securityfs_remove(struct dentry *dentry) |
| 2802 | {} |
| 2803 | |
| 2804 | #endif |
| 2805 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2806 | #endif /* ! __LINUX_SECURITY_H */ |
| 2807 | |