aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/security.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/security.h')
-rw-r--r--include/linux/security.h281
1 files changed, 66 insertions, 215 deletions
diff --git a/include/linux/security.h b/include/linux/security.h
index 2c627d361c02..c642bb8b8f5a 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -23,6 +23,7 @@
23#define __LINUX_SECURITY_H 23#define __LINUX_SECURITY_H
24 24
25#include <linux/fs.h> 25#include <linux/fs.h>
26#include <linux/fsnotify.h>
26#include <linux/binfmts.h> 27#include <linux/binfmts.h>
27#include <linux/signal.h> 28#include <linux/signal.h>
28#include <linux/resource.h> 29#include <linux/resource.h>
@@ -33,7 +34,7 @@
33#include <linux/sched.h> 34#include <linux/sched.h>
34#include <linux/key.h> 35#include <linux/key.h>
35#include <linux/xfrm.h> 36#include <linux/xfrm.h>
36#include <linux/gfp.h> 37#include <linux/slab.h>
37#include <net/flow.h> 38#include <net/flow.h>
38 39
39/* Maximum number of letters for an LSM name string */ 40/* Maximum number of letters for an LSM name string */
@@ -73,10 +74,9 @@ extern int cap_file_mmap(struct file *file, unsigned long reqprot,
73extern int cap_task_fix_setuid(struct cred *new, const struct cred *old, int flags); 74extern int cap_task_fix_setuid(struct cred *new, const struct cred *old, int flags);
74extern int cap_task_prctl(int option, unsigned long arg2, unsigned long arg3, 75extern int cap_task_prctl(int option, unsigned long arg2, unsigned long arg3,
75 unsigned long arg4, unsigned long arg5); 76 unsigned long arg4, unsigned long arg5);
76extern int cap_task_setscheduler(struct task_struct *p, int policy, struct sched_param *lp); 77extern int cap_task_setscheduler(struct task_struct *p);
77extern int cap_task_setioprio(struct task_struct *p, int ioprio); 78extern int cap_task_setioprio(struct task_struct *p, int ioprio);
78extern int cap_task_setnice(struct task_struct *p, int nice); 79extern int cap_task_setnice(struct task_struct *p, int nice);
79extern int cap_syslog(int type);
80extern int cap_vm_enough_memory(struct mm_struct *mm, long pages); 80extern int cap_vm_enough_memory(struct mm_struct *mm, long pages);
81 81
82struct msghdr; 82struct msghdr;
@@ -95,6 +95,8 @@ struct seq_file;
95extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb); 95extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb);
96extern int cap_netlink_recv(struct sk_buff *skb, int cap); 96extern int cap_netlink_recv(struct sk_buff *skb, int cap);
97 97
98void reset_security_ops(void);
99
98#ifdef CONFIG_MMU 100#ifdef CONFIG_MMU
99extern unsigned long mmap_min_addr; 101extern unsigned long mmap_min_addr;
100extern unsigned long dac_mmap_min_addr; 102extern unsigned long dac_mmap_min_addr;
@@ -265,49 +267,16 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
265 * @orig the original mount data copied from userspace. 267 * @orig the original mount data copied from userspace.
266 * @copy copied data which will be passed to the security module. 268 * @copy copied data which will be passed to the security module.
267 * Returns 0 if the copy was successful. 269 * Returns 0 if the copy was successful.
268 * @sb_check_sb:
269 * Check permission before the device with superblock @mnt->sb is mounted
270 * on the mount point named by @nd.
271 * @mnt contains the vfsmount for device being mounted.
272 * @path contains the path for the mount point.
273 * Return 0 if permission is granted.
274 * @sb_umount: 270 * @sb_umount:
275 * Check permission before the @mnt file system is unmounted. 271 * Check permission before the @mnt file system is unmounted.
276 * @mnt contains the mounted file system. 272 * @mnt contains the mounted file system.
277 * @flags contains the unmount flags, e.g. MNT_FORCE. 273 * @flags contains the unmount flags, e.g. MNT_FORCE.
278 * Return 0 if permission is granted. 274 * Return 0 if permission is granted.
279 * @sb_umount_close:
280 * Close any files in the @mnt mounted filesystem that are held open by
281 * the security module. This hook is called during an umount operation
282 * prior to checking whether the filesystem is still busy.
283 * @mnt contains the mounted filesystem.
284 * @sb_umount_busy:
285 * Handle a failed umount of the @mnt mounted filesystem, e.g. re-opening
286 * any files that were closed by umount_close. This hook is called during
287 * an umount operation if the umount fails after a call to the
288 * umount_close hook.
289 * @mnt contains the mounted filesystem.
290 * @sb_post_remount:
291 * Update the security module's state when a filesystem is remounted.
292 * This hook is only called if the remount was successful.
293 * @mnt contains the mounted file system.
294 * @flags contains the new filesystem flags.
295 * @data contains the filesystem-specific data.
296 * @sb_post_addmount:
297 * Update the security module's state when a filesystem is mounted.
298 * This hook is called any time a mount is successfully grafetd to
299 * the tree.
300 * @mnt contains the mounted filesystem.
301 * @mountpoint contains the path for the mount point.
302 * @sb_pivotroot: 275 * @sb_pivotroot:
303 * Check permission before pivoting the root filesystem. 276 * Check permission before pivoting the root filesystem.
304 * @old_path contains the path for the new location of the current root (put_old). 277 * @old_path contains the path for the new location of the current root (put_old).
305 * @new_path contains the path for the new root (new_root). 278 * @new_path contains the path for the new root (new_root).
306 * Return 0 if permission is granted. 279 * Return 0 if permission is granted.
307 * @sb_post_pivotroot:
308 * Update module state after a successful pivot.
309 * @old_path contains the path for the old root.
310 * @new_path contains the path for the new root.
311 * @sb_set_mnt_opts: 280 * @sb_set_mnt_opts:
312 * Set the security relevant mount options used for a superblock 281 * Set the security relevant mount options used for a superblock
313 * @sb the superblock to set security mount options for 282 * @sb the superblock to set security mount options for
@@ -488,7 +457,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
488 * called when the actual read/write operations are performed. 457 * called when the actual read/write operations are performed.
489 * @inode contains the inode structure to check. 458 * @inode contains the inode structure to check.
490 * @mask contains the permission mask. 459 * @mask contains the permission mask.
491 * @nd contains the nameidata (may be NULL).
492 * Return 0 if permission is granted. 460 * Return 0 if permission is granted.
493 * @inode_setattr: 461 * @inode_setattr:
494 * Check permission before setting file attributes. Note that the kernel 462 * Check permission before setting file attributes. Note that the kernel
@@ -501,20 +469,12 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
501 * @path_truncate: 469 * @path_truncate:
502 * Check permission before truncating a file. 470 * Check permission before truncating a file.
503 * @path contains the path structure for the file. 471 * @path contains the path structure for the file.
504 * @length is the new length of the file.
505 * @time_attrs is the flags passed to do_truncate().
506 * Return 0 if permission is granted. 472 * Return 0 if permission is granted.
507 * @inode_getattr: 473 * @inode_getattr:
508 * Check permission before obtaining file attributes. 474 * Check permission before obtaining file attributes.
509 * @mnt is the vfsmount where the dentry was looked up 475 * @mnt is the vfsmount where the dentry was looked up
510 * @dentry contains the dentry structure for the file. 476 * @dentry contains the dentry structure for the file.
511 * Return 0 if permission is granted. 477 * Return 0 if permission is granted.
512 * @inode_delete:
513 * @inode contains the inode structure for deleted inode.
514 * This hook is called when a deleted inode is released (i.e. an inode
515 * with no hard links has its use count drop to zero). A security module
516 * can use this hook to release any persistent label associated with the
517 * inode.
518 * @inode_setxattr: 478 * @inode_setxattr:
519 * Check permission before setting the extended attributes 479 * Check permission before setting the extended attributes
520 * @value identified by @name for @dentry. 480 * @value identified by @name for @dentry.
@@ -689,10 +649,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
689 * @old points to the original credentials. 649 * @old points to the original credentials.
690 * @gfp indicates the atomicity of any memory allocations. 650 * @gfp indicates the atomicity of any memory allocations.
691 * Prepare a new set of credentials by copying the data from the old set. 651 * Prepare a new set of credentials by copying the data from the old set.
692 * @cred_commit:
693 * @new points to the new credentials.
694 * @old points to the original credentials.
695 * Install a new set of credentials.
696 * @cred_transfer: 652 * @cred_transfer:
697 * @new points to the new credentials. 653 * @new points to the new credentials.
698 * @old points to the original credentials. 654 * @old points to the original credentials.
@@ -715,18 +671,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
715 * userspace to load a kernel module with the given name. 671 * userspace to load a kernel module with the given name.
716 * @kmod_name name of the module requested by the kernel 672 * @kmod_name name of the module requested by the kernel
717 * Return 0 if successful. 673 * Return 0 if successful.
718 * @task_setuid:
719 * Check permission before setting one or more of the user identity
720 * attributes of the current process. The @flags parameter indicates
721 * which of the set*uid system calls invoked this hook and how to
722 * interpret the @id0, @id1, and @id2 parameters. See the LSM_SETID
723 * definitions at the beginning of this file for the @flags values and
724 * their meanings.
725 * @id0 contains a uid.
726 * @id1 contains a uid.
727 * @id2 contains a uid.
728 * @flags contains one of the LSM_SETID_* values.
729 * Return 0 if permission is granted.
730 * @task_fix_setuid: 674 * @task_fix_setuid:
731 * Update the module's state after setting one or more of the user 675 * Update the module's state after setting one or more of the user
732 * identity attributes of the current process. The @flags parameter 676 * identity attributes of the current process. The @flags parameter
@@ -736,18 +680,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
736 * @old is the set of credentials that are being replaces 680 * @old is the set of credentials that are being replaces
737 * @flags contains one of the LSM_SETID_* values. 681 * @flags contains one of the LSM_SETID_* values.
738 * Return 0 on success. 682 * Return 0 on success.
739 * @task_setgid:
740 * Check permission before setting one or more of the group identity
741 * attributes of the current process. The @flags parameter indicates
742 * which of the set*gid system calls invoked this hook and how to
743 * interpret the @id0, @id1, and @id2 parameters. See the LSM_SETID
744 * definitions at the beginning of this file for the @flags values and
745 * their meanings.
746 * @id0 contains a gid.
747 * @id1 contains a gid.
748 * @id2 contains a gid.
749 * @flags contains one of the LSM_SETID_* values.
750 * Return 0 if permission is granted.
751 * @task_setpgid: 683 * @task_setpgid:
752 * Check permission before setting the process group identifier of the 684 * Check permission before setting the process group identifier of the
753 * process @p to @pgid. 685 * process @p to @pgid.
@@ -769,11 +701,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
769 * @p contains the task_struct for the process and place is into @secid. 701 * @p contains the task_struct for the process and place is into @secid.
770 * In case of failure, @secid will be set to zero. 702 * In case of failure, @secid will be set to zero.
771 * 703 *
772 * @task_setgroups:
773 * Check permission before setting the supplementary group set of the
774 * current process.
775 * @group_info contains the new group information.
776 * Return 0 if permission is granted.
777 * @task_setnice: 704 * @task_setnice:
778 * Check permission before setting the nice value of @p to @nice. 705 * Check permission before setting the nice value of @p to @nice.
779 * @p contains the task_struct of process. 706 * @p contains the task_struct of process.
@@ -868,8 +795,9 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
868 * @unix_stream_connect: 795 * @unix_stream_connect:
869 * Check permissions before establishing a Unix domain stream connection 796 * Check permissions before establishing a Unix domain stream connection
870 * between @sock and @other. 797 * between @sock and @other.
871 * @sock contains the socket structure. 798 * @sock contains the sock structure.
872 * @other contains the peer socket structure. 799 * @other contains the peer sock structure.
800 * @newsk contains the new sock structure.
873 * Return 0 if permission is granted. 801 * Return 0 if permission is granted.
874 * @unix_may_send: 802 * @unix_may_send:
875 * Check permissions before connecting or sending datagrams from @sock to 803 * Check permissions before connecting or sending datagrams from @sock to
@@ -985,6 +913,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
985 * Check permissions on incoming network packets. This hook is distinct 913 * Check permissions on incoming network packets. This hook is distinct
986 * from Netfilter's IP input hooks since it is the first time that the 914 * from Netfilter's IP input hooks since it is the first time that the
987 * incoming sk_buff @skb has been associated with a particular socket, @sk. 915 * incoming sk_buff @skb has been associated with a particular socket, @sk.
916 * Must not sleep inside this hook because some callers hold spinlocks.
988 * @sk contains the sock (not socket) associated with the incoming sk_buff. 917 * @sk contains the sock (not socket) associated with the incoming sk_buff.
989 * @skb contains the incoming network data. 918 * @skb contains the incoming network data.
990 * @socket_getpeersec_stream: 919 * @socket_getpeersec_stream:
@@ -1029,6 +958,12 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1029 * Sets the new child socket's sid to the openreq sid. 958 * Sets the new child socket's sid to the openreq sid.
1030 * @inet_conn_established: 959 * @inet_conn_established:
1031 * Sets the connection's peersid to the secmark on skb. 960 * Sets the connection's peersid to the secmark on skb.
961 * @secmark_relabel_packet:
962 * check if the process should be allowed to relabel packets to the given secid
963 * @security_secmark_refcount_inc
964 * tells the LSM to increment the number of secmark labeling rules loaded
965 * @security_secmark_refcount_dec
966 * tells the LSM to decrement the number of secmark labeling rules loaded
1032 * @req_classify_flow: 967 * @req_classify_flow:
1033 * Sets the flow's sid to the openreq sid. 968 * Sets the flow's sid to the openreq sid.
1034 * @tun_dev_create: 969 * @tun_dev_create:
@@ -1123,8 +1058,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1123 * @cred points to the credentials to provide the context against which to 1058 * @cred points to the credentials to provide the context against which to
1124 * evaluate the security data on the key. 1059 * evaluate the security data on the key.
1125 * @perm describes the combination of permissions required of this key. 1060 * @perm describes the combination of permissions required of this key.
1126 * Return 1 if permission granted, 0 if permission denied and -ve it the 1061 * Return 0 if permission is granted, -ve error otherwise.
1127 * normal permissions model should be effected.
1128 * @key_getsecurity: 1062 * @key_getsecurity:
1129 * Get a textual representation of the security context attached to a key 1063 * Get a textual representation of the security context attached to a key
1130 * for the purposes of honouring KEYCTL_GETSECURITY. This function 1064 * for the purposes of honouring KEYCTL_GETSECURITY. This function
@@ -1136,13 +1070,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1136 * Return the length of the string (including terminating NUL) or -ve if 1070 * Return the length of the string (including terminating NUL) or -ve if
1137 * an error. 1071 * an error.
1138 * May also return 0 (and a NULL buffer pointer) if there is no label. 1072 * May also return 0 (and a NULL buffer pointer) if there is no label.
1139 * @key_session_to_parent:
1140 * Forcibly assign the session keyring from a process to its parent
1141 * process.
1142 * @cred: Pointer to process's credentials
1143 * @parent_cred: Pointer to parent process's credentials
1144 * @keyring: Proposed new session keyring
1145 * Return 0 if permission is granted, -ve error otherwise.
1146 * 1073 *
1147 * Security hooks affecting all System V IPC operations. 1074 * Security hooks affecting all System V IPC operations.
1148 * 1075 *
@@ -1330,13 +1257,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1330 * @cap contains the capability <include/linux/capability.h>. 1257 * @cap contains the capability <include/linux/capability.h>.
1331 * @audit: Whether to write an audit message or not 1258 * @audit: Whether to write an audit message or not
1332 * Return 0 if the capability is granted for @tsk. 1259 * Return 0 if the capability is granted for @tsk.
1333 * @acct:
1334 * Check permission before enabling or disabling process accounting. If
1335 * accounting is being enabled, then @file refers to the open file used to
1336 * store accounting records. If accounting is being disabled, then @file
1337 * is NULL.
1338 * @file contains the file structure for the accounting file (may be NULL).
1339 * Return 0 if permission is granted.
1340 * @sysctl: 1260 * @sysctl:
1341 * Check permission before accessing the @table sysctl variable in the 1261 * Check permission before accessing the @table sysctl variable in the
1342 * manner specified by @op. 1262 * manner specified by @op.
@@ -1348,6 +1268,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1348 * logging to the console. 1268 * logging to the console.
1349 * See the syslog(2) manual page for an explanation of the @type values. 1269 * See the syslog(2) manual page for an explanation of the @type values.
1350 * @type contains the type of action. 1270 * @type contains the type of action.
1271 * @from_file indicates the context of action (if it came from /proc).
1351 * Return 0 if permission is granted. 1272 * Return 0 if permission is granted.
1352 * @settime: 1273 * @settime:
1353 * Check permission to change the system time. 1274 * Check permission to change the system time.
@@ -1362,9 +1283,13 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1362 * Return 0 if permission is granted. 1283 * Return 0 if permission is granted.
1363 * 1284 *
1364 * @secid_to_secctx: 1285 * @secid_to_secctx:
1365 * Convert secid to security context. 1286 * Convert secid to security context. If secdata is NULL the length of
1287 * the result will be returned in seclen, but no secdata will be returned.
1288 * This does mean that the length could change between calls to check the
1289 * length and the next call which actually allocates and returns the secdata.
1366 * @secid contains the security ID. 1290 * @secid contains the security ID.
1367 * @secdata contains the pointer that stores the converted security context. 1291 * @secdata contains the pointer that stores the converted security context.
1292 * @seclen pointer which contains the length of the data
1368 * @secctx_to_secid: 1293 * @secctx_to_secid:
1369 * Convert security context to secid. 1294 * Convert security context to secid.
1370 * @secid contains the pointer to the generated security ID. 1295 * @secid contains the pointer to the generated security ID.
@@ -1458,7 +1383,6 @@ struct security_operations {
1458 const kernel_cap_t *permitted); 1383 const kernel_cap_t *permitted);
1459 int (*capable) (struct task_struct *tsk, const struct cred *cred, 1384 int (*capable) (struct task_struct *tsk, const struct cred *cred,
1460 int cap, int audit); 1385 int cap, int audit);
1461 int (*acct) (struct file *file);
1462 int (*sysctl) (struct ctl_table *table, int op); 1386 int (*sysctl) (struct ctl_table *table, int op);
1463 int (*quotactl) (int cmds, int type, int id, struct super_block *sb); 1387 int (*quotactl) (int cmds, int type, int id, struct super_block *sb);
1464 int (*quota_on) (struct dentry *dentry); 1388 int (*quota_on) (struct dentry *dentry);
@@ -1480,18 +1404,9 @@ struct security_operations {
1480 int (*sb_statfs) (struct dentry *dentry); 1404 int (*sb_statfs) (struct dentry *dentry);
1481 int (*sb_mount) (char *dev_name, struct path *path, 1405 int (*sb_mount) (char *dev_name, struct path *path,
1482 char *type, unsigned long flags, void *data); 1406 char *type, unsigned long flags, void *data);
1483 int (*sb_check_sb) (struct vfsmount *mnt, struct path *path);
1484 int (*sb_umount) (struct vfsmount *mnt, int flags); 1407 int (*sb_umount) (struct vfsmount *mnt, int flags);
1485 void (*sb_umount_close) (struct vfsmount *mnt);
1486 void (*sb_umount_busy) (struct vfsmount *mnt);
1487 void (*sb_post_remount) (struct vfsmount *mnt,
1488 unsigned long flags, void *data);
1489 void (*sb_post_addmount) (struct vfsmount *mnt,
1490 struct path *mountpoint);
1491 int (*sb_pivotroot) (struct path *old_path, 1408 int (*sb_pivotroot) (struct path *old_path,
1492 struct path *new_path); 1409 struct path *new_path);
1493 void (*sb_post_pivotroot) (struct path *old_path,
1494 struct path *new_path);
1495 int (*sb_set_mnt_opts) (struct super_block *sb, 1410 int (*sb_set_mnt_opts) (struct super_block *sb,
1496 struct security_mnt_opts *opts); 1411 struct security_mnt_opts *opts);
1497 void (*sb_clone_mnt_opts) (const struct super_block *oldsb, 1412 void (*sb_clone_mnt_opts) (const struct super_block *oldsb,
@@ -1504,8 +1419,7 @@ struct security_operations {
1504 int (*path_rmdir) (struct path *dir, struct dentry *dentry); 1419 int (*path_rmdir) (struct path *dir, struct dentry *dentry);
1505 int (*path_mknod) (struct path *dir, struct dentry *dentry, int mode, 1420 int (*path_mknod) (struct path *dir, struct dentry *dentry, int mode,
1506 unsigned int dev); 1421 unsigned int dev);
1507 int (*path_truncate) (struct path *path, loff_t length, 1422 int (*path_truncate) (struct path *path);
1508 unsigned int time_attrs);
1509 int (*path_symlink) (struct path *dir, struct dentry *dentry, 1423 int (*path_symlink) (struct path *dir, struct dentry *dentry,
1510 const char *old_name); 1424 const char *old_name);
1511 int (*path_link) (struct dentry *old_dentry, struct path *new_dir, 1425 int (*path_link) (struct dentry *old_dentry, struct path *new_dir,
@@ -1540,7 +1454,6 @@ struct security_operations {
1540 int (*inode_permission) (struct inode *inode, int mask); 1454 int (*inode_permission) (struct inode *inode, int mask);
1541 int (*inode_setattr) (struct dentry *dentry, struct iattr *attr); 1455 int (*inode_setattr) (struct dentry *dentry, struct iattr *attr);
1542 int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry); 1456 int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry);
1543 void (*inode_delete) (struct inode *inode);
1544 int (*inode_setxattr) (struct dentry *dentry, const char *name, 1457 int (*inode_setxattr) (struct dentry *dentry, const char *name,
1545 const void *value, size_t size, int flags); 1458 const void *value, size_t size, int flags);
1546 void (*inode_post_setxattr) (struct dentry *dentry, const char *name, 1459 void (*inode_post_setxattr) (struct dentry *dentry, const char *name,
@@ -1581,26 +1494,22 @@ struct security_operations {
1581 void (*cred_free) (struct cred *cred); 1494 void (*cred_free) (struct cred *cred);
1582 int (*cred_prepare)(struct cred *new, const struct cred *old, 1495 int (*cred_prepare)(struct cred *new, const struct cred *old,
1583 gfp_t gfp); 1496 gfp_t gfp);
1584 void (*cred_commit)(struct cred *new, const struct cred *old);
1585 void (*cred_transfer)(struct cred *new, const struct cred *old); 1497 void (*cred_transfer)(struct cred *new, const struct cred *old);
1586 int (*kernel_act_as)(struct cred *new, u32 secid); 1498 int (*kernel_act_as)(struct cred *new, u32 secid);
1587 int (*kernel_create_files_as)(struct cred *new, struct inode *inode); 1499 int (*kernel_create_files_as)(struct cred *new, struct inode *inode);
1588 int (*kernel_module_request)(char *kmod_name); 1500 int (*kernel_module_request)(char *kmod_name);
1589 int (*task_setuid) (uid_t id0, uid_t id1, uid_t id2, int flags);
1590 int (*task_fix_setuid) (struct cred *new, const struct cred *old, 1501 int (*task_fix_setuid) (struct cred *new, const struct cred *old,
1591 int flags); 1502 int flags);
1592 int (*task_setgid) (gid_t id0, gid_t id1, gid_t id2, int flags);
1593 int (*task_setpgid) (struct task_struct *p, pid_t pgid); 1503 int (*task_setpgid) (struct task_struct *p, pid_t pgid);
1594 int (*task_getpgid) (struct task_struct *p); 1504 int (*task_getpgid) (struct task_struct *p);
1595 int (*task_getsid) (struct task_struct *p); 1505 int (*task_getsid) (struct task_struct *p);
1596 void (*task_getsecid) (struct task_struct *p, u32 *secid); 1506 void (*task_getsecid) (struct task_struct *p, u32 *secid);
1597 int (*task_setgroups) (struct group_info *group_info);
1598 int (*task_setnice) (struct task_struct *p, int nice); 1507 int (*task_setnice) (struct task_struct *p, int nice);
1599 int (*task_setioprio) (struct task_struct *p, int ioprio); 1508 int (*task_setioprio) (struct task_struct *p, int ioprio);
1600 int (*task_getioprio) (struct task_struct *p); 1509 int (*task_getioprio) (struct task_struct *p);
1601 int (*task_setrlimit) (unsigned int resource, struct rlimit *new_rlim); 1510 int (*task_setrlimit) (struct task_struct *p, unsigned int resource,
1602 int (*task_setscheduler) (struct task_struct *p, int policy, 1511 struct rlimit *new_rlim);
1603 struct sched_param *lp); 1512 int (*task_setscheduler) (struct task_struct *p);
1604 int (*task_getscheduler) (struct task_struct *p); 1513 int (*task_getscheduler) (struct task_struct *p);
1605 int (*task_movememory) (struct task_struct *p); 1514 int (*task_movememory) (struct task_struct *p);
1606 int (*task_kill) (struct task_struct *p, 1515 int (*task_kill) (struct task_struct *p,
@@ -1658,8 +1567,7 @@ struct security_operations {
1658 int (*inode_getsecctx)(struct inode *inode, void **ctx, u32 *ctxlen); 1567 int (*inode_getsecctx)(struct inode *inode, void **ctx, u32 *ctxlen);
1659 1568
1660#ifdef CONFIG_SECURITY_NETWORK 1569#ifdef CONFIG_SECURITY_NETWORK
1661 int (*unix_stream_connect) (struct socket *sock, 1570 int (*unix_stream_connect) (struct sock *sock, struct sock *other, struct sock *newsk);
1662 struct socket *other, struct sock *newsk);
1663 int (*unix_may_send) (struct socket *sock, struct socket *other); 1571 int (*unix_may_send) (struct socket *sock, struct socket *other);
1664 1572
1665 int (*socket_create) (int family, int type, int protocol, int kern); 1573 int (*socket_create) (int family, int type, int protocol, int kern);
@@ -1692,6 +1600,9 @@ struct security_operations {
1692 struct request_sock *req); 1600 struct request_sock *req);
1693 void (*inet_csk_clone) (struct sock *newsk, const struct request_sock *req); 1601 void (*inet_csk_clone) (struct sock *newsk, const struct request_sock *req);
1694 void (*inet_conn_established) (struct sock *sk, struct sk_buff *skb); 1602 void (*inet_conn_established) (struct sock *sk, struct sk_buff *skb);
1603 int (*secmark_relabel_packet) (u32 secid);
1604 void (*secmark_refcount_inc) (void);
1605 void (*secmark_refcount_dec) (void);
1695 void (*req_classify_flow) (const struct request_sock *req, struct flowi *fl); 1606 void (*req_classify_flow) (const struct request_sock *req, struct flowi *fl);
1696 int (*tun_dev_create)(void); 1607 int (*tun_dev_create)(void);
1697 void (*tun_dev_post_create)(struct sock *sk); 1608 void (*tun_dev_post_create)(struct sock *sk);
@@ -1724,9 +1635,6 @@ struct security_operations {
1724 const struct cred *cred, 1635 const struct cred *cred,
1725 key_perm_t perm); 1636 key_perm_t perm);
1726 int (*key_getsecurity)(struct key *key, char **_buffer); 1637 int (*key_getsecurity)(struct key *key, char **_buffer);
1727 int (*key_session_to_parent)(const struct cred *cred,
1728 const struct cred *parent_cred,
1729 struct key *key);
1730#endif /* CONFIG_KEYS */ 1638#endif /* CONFIG_KEYS */
1731 1639
1732#ifdef CONFIG_AUDIT 1640#ifdef CONFIG_AUDIT
@@ -1757,7 +1665,6 @@ int security_capset(struct cred *new, const struct cred *old,
1757int security_capable(int cap); 1665int security_capable(int cap);
1758int security_real_capable(struct task_struct *tsk, int cap); 1666int security_real_capable(struct task_struct *tsk, int cap);
1759int security_real_capable_noaudit(struct task_struct *tsk, int cap); 1667int security_real_capable_noaudit(struct task_struct *tsk, int cap);
1760int security_acct(struct file *file);
1761int security_sysctl(struct ctl_table *table, int op); 1668int security_sysctl(struct ctl_table *table, int op);
1762int security_quotactl(int cmds, int type, int id, struct super_block *sb); 1669int security_quotactl(int cmds, int type, int id, struct super_block *sb);
1763int security_quota_on(struct dentry *dentry); 1670int security_quota_on(struct dentry *dentry);
@@ -1779,14 +1686,8 @@ int security_sb_show_options(struct seq_file *m, struct super_block *sb);
1779int security_sb_statfs(struct dentry *dentry); 1686int security_sb_statfs(struct dentry *dentry);
1780int security_sb_mount(char *dev_name, struct path *path, 1687int security_sb_mount(char *dev_name, struct path *path,
1781 char *type, unsigned long flags, void *data); 1688 char *type, unsigned long flags, void *data);
1782int security_sb_check_sb(struct vfsmount *mnt, struct path *path);
1783int security_sb_umount(struct vfsmount *mnt, int flags); 1689int security_sb_umount(struct vfsmount *mnt, int flags);
1784void security_sb_umount_close(struct vfsmount *mnt);
1785void security_sb_umount_busy(struct vfsmount *mnt);
1786void security_sb_post_remount(struct vfsmount *mnt, unsigned long flags, void *data);
1787void security_sb_post_addmount(struct vfsmount *mnt, struct path *mountpoint);
1788int security_sb_pivotroot(struct path *old_path, struct path *new_path); 1690int security_sb_pivotroot(struct path *old_path, struct path *new_path);
1789void security_sb_post_pivotroot(struct path *old_path, struct path *new_path);
1790int security_sb_set_mnt_opts(struct super_block *sb, struct security_mnt_opts *opts); 1691int security_sb_set_mnt_opts(struct super_block *sb, struct security_mnt_opts *opts);
1791void security_sb_clone_mnt_opts(const struct super_block *oldsb, 1692void security_sb_clone_mnt_opts(const struct super_block *oldsb,
1792 struct super_block *newsb); 1693 struct super_block *newsb);
@@ -1810,9 +1711,9 @@ int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry,
1810int security_inode_readlink(struct dentry *dentry); 1711int security_inode_readlink(struct dentry *dentry);
1811int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd); 1712int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd);
1812int security_inode_permission(struct inode *inode, int mask); 1713int security_inode_permission(struct inode *inode, int mask);
1714int security_inode_exec_permission(struct inode *inode, unsigned int flags);
1813int security_inode_setattr(struct dentry *dentry, struct iattr *attr); 1715int security_inode_setattr(struct dentry *dentry, struct iattr *attr);
1814int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry); 1716int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry);
1815void security_inode_delete(struct inode *inode);
1816int security_inode_setxattr(struct dentry *dentry, const char *name, 1717int security_inode_setxattr(struct dentry *dentry, const char *name,
1817 const void *value, size_t size, int flags); 1718 const void *value, size_t size, int flags);
1818void security_inode_post_setxattr(struct dentry *dentry, const char *name, 1719void security_inode_post_setxattr(struct dentry *dentry, const char *name,
@@ -1846,26 +1747,22 @@ int security_task_create(unsigned long clone_flags);
1846int security_cred_alloc_blank(struct cred *cred, gfp_t gfp); 1747int security_cred_alloc_blank(struct cred *cred, gfp_t gfp);
1847void security_cred_free(struct cred *cred); 1748void security_cred_free(struct cred *cred);
1848int security_prepare_creds(struct cred *new, const struct cred *old, gfp_t gfp); 1749int security_prepare_creds(struct cred *new, const struct cred *old, gfp_t gfp);
1849void security_commit_creds(struct cred *new, const struct cred *old);
1850void security_transfer_creds(struct cred *new, const struct cred *old); 1750void security_transfer_creds(struct cred *new, const struct cred *old);
1851int security_kernel_act_as(struct cred *new, u32 secid); 1751int security_kernel_act_as(struct cred *new, u32 secid);
1852int security_kernel_create_files_as(struct cred *new, struct inode *inode); 1752int security_kernel_create_files_as(struct cred *new, struct inode *inode);
1853int security_kernel_module_request(char *kmod_name); 1753int security_kernel_module_request(char *kmod_name);
1854int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, int flags);
1855int security_task_fix_setuid(struct cred *new, const struct cred *old, 1754int security_task_fix_setuid(struct cred *new, const struct cred *old,
1856 int flags); 1755 int flags);
1857int security_task_setgid(gid_t id0, gid_t id1, gid_t id2, int flags);
1858int security_task_setpgid(struct task_struct *p, pid_t pgid); 1756int security_task_setpgid(struct task_struct *p, pid_t pgid);
1859int security_task_getpgid(struct task_struct *p); 1757int security_task_getpgid(struct task_struct *p);
1860int security_task_getsid(struct task_struct *p); 1758int security_task_getsid(struct task_struct *p);
1861void security_task_getsecid(struct task_struct *p, u32 *secid); 1759void security_task_getsecid(struct task_struct *p, u32 *secid);
1862int security_task_setgroups(struct group_info *group_info);
1863int security_task_setnice(struct task_struct *p, int nice); 1760int security_task_setnice(struct task_struct *p, int nice);
1864int security_task_setioprio(struct task_struct *p, int ioprio); 1761int security_task_setioprio(struct task_struct *p, int ioprio);
1865int security_task_getioprio(struct task_struct *p); 1762int security_task_getioprio(struct task_struct *p);
1866int security_task_setrlimit(unsigned int resource, struct rlimit *new_rlim); 1763int security_task_setrlimit(struct task_struct *p, unsigned int resource,
1867int security_task_setscheduler(struct task_struct *p, 1764 struct rlimit *new_rlim);
1868 int policy, struct sched_param *lp); 1765int security_task_setscheduler(struct task_struct *p);
1869int security_task_getscheduler(struct task_struct *p); 1766int security_task_getscheduler(struct task_struct *p);
1870int security_task_movememory(struct task_struct *p); 1767int security_task_movememory(struct task_struct *p);
1871int security_task_kill(struct task_struct *p, struct siginfo *info, 1768int security_task_kill(struct task_struct *p, struct siginfo *info,
@@ -1986,11 +1883,6 @@ int security_real_capable_noaudit(struct task_struct *tsk, int cap)
1986 return ret; 1883 return ret;
1987} 1884}
1988 1885
1989static inline int security_acct(struct file *file)
1990{
1991 return 0;
1992}
1993
1994static inline int security_sysctl(struct ctl_table *table, int op) 1886static inline int security_sysctl(struct ctl_table *table, int op)
1995{ 1887{
1996 return 0; 1888 return 0;
@@ -2009,7 +1901,7 @@ static inline int security_quota_on(struct dentry *dentry)
2009 1901
2010static inline int security_syslog(int type) 1902static inline int security_syslog(int type)
2011{ 1903{
2012 return cap_syslog(type); 1904 return 0;
2013} 1905}
2014 1906
2015static inline int security_settime(struct timespec *ts, struct timezone *tz) 1907static inline int security_settime(struct timespec *ts, struct timezone *tz)
@@ -2095,41 +1987,17 @@ static inline int security_sb_mount(char *dev_name, struct path *path,
2095 return 0; 1987 return 0;
2096} 1988}
2097 1989
2098static inline int security_sb_check_sb(struct vfsmount *mnt,
2099 struct path *path)
2100{
2101 return 0;
2102}
2103
2104static inline int security_sb_umount(struct vfsmount *mnt, int flags) 1990static inline int security_sb_umount(struct vfsmount *mnt, int flags)
2105{ 1991{
2106 return 0; 1992 return 0;
2107} 1993}
2108 1994
2109static inline void security_sb_umount_close(struct vfsmount *mnt)
2110{ }
2111
2112static inline void security_sb_umount_busy(struct vfsmount *mnt)
2113{ }
2114
2115static inline void security_sb_post_remount(struct vfsmount *mnt,
2116 unsigned long flags, void *data)
2117{ }
2118
2119static inline void security_sb_post_addmount(struct vfsmount *mnt,
2120 struct path *mountpoint)
2121{ }
2122
2123static inline int security_sb_pivotroot(struct path *old_path, 1995static inline int security_sb_pivotroot(struct path *old_path,
2124 struct path *new_path) 1996 struct path *new_path)
2125{ 1997{
2126 return 0; 1998 return 0;
2127} 1999}
2128 2000
2129static inline void security_sb_post_pivotroot(struct path *old_path,
2130 struct path *new_path)
2131{ }
2132
2133static inline int security_sb_set_mnt_opts(struct super_block *sb, 2001static inline int security_sb_set_mnt_opts(struct super_block *sb,
2134 struct security_mnt_opts *opts) 2002 struct security_mnt_opts *opts)
2135{ 2003{
@@ -2233,6 +2101,12 @@ static inline int security_inode_permission(struct inode *inode, int mask)
2233 return 0; 2101 return 0;
2234} 2102}
2235 2103
2104static inline int security_inode_exec_permission(struct inode *inode,
2105 unsigned int flags)
2106{
2107 return 0;
2108}
2109
2236static inline int security_inode_setattr(struct dentry *dentry, 2110static inline int security_inode_setattr(struct dentry *dentry,
2237 struct iattr *attr) 2111 struct iattr *attr)
2238{ 2112{
@@ -2245,9 +2119,6 @@ static inline int security_inode_getattr(struct vfsmount *mnt,
2245 return 0; 2119 return 0;
2246} 2120}
2247 2121
2248static inline void security_inode_delete(struct inode *inode)
2249{ }
2250
2251static inline int security_inode_setxattr(struct dentry *dentry, 2122static inline int security_inode_setxattr(struct dentry *dentry,
2252 const char *name, const void *value, size_t size, int flags) 2123 const char *name, const void *value, size_t size, int flags)
2253{ 2124{
@@ -2394,11 +2265,6 @@ static inline int security_prepare_creds(struct cred *new,
2394 return 0; 2265 return 0;
2395} 2266}
2396 2267
2397static inline void security_commit_creds(struct cred *new,
2398 const struct cred *old)
2399{
2400}
2401
2402static inline void security_transfer_creds(struct cred *new, 2268static inline void security_transfer_creds(struct cred *new,
2403 const struct cred *old) 2269 const struct cred *old)
2404{ 2270{
@@ -2420,12 +2286,6 @@ static inline int security_kernel_module_request(char *kmod_name)
2420 return 0; 2286 return 0;
2421} 2287}
2422 2288
2423static inline int security_task_setuid(uid_t id0, uid_t id1, uid_t id2,
2424 int flags)
2425{
2426 return 0;
2427}
2428
2429static inline int security_task_fix_setuid(struct cred *new, 2289static inline int security_task_fix_setuid(struct cred *new,
2430 const struct cred *old, 2290 const struct cred *old,
2431 int flags) 2291 int flags)
@@ -2433,12 +2293,6 @@ static inline int security_task_fix_setuid(struct cred *new,
2433 return cap_task_fix_setuid(new, old, flags); 2293 return cap_task_fix_setuid(new, old, flags);
2434} 2294}
2435 2295
2436static inline int security_task_setgid(gid_t id0, gid_t id1, gid_t id2,
2437 int flags)
2438{
2439 return 0;
2440}
2441
2442static inline int security_task_setpgid(struct task_struct *p, pid_t pgid) 2296static inline int security_task_setpgid(struct task_struct *p, pid_t pgid)
2443{ 2297{
2444 return 0; 2298 return 0;
@@ -2459,11 +2313,6 @@ static inline void security_task_getsecid(struct task_struct *p, u32 *secid)
2459 *secid = 0; 2313 *secid = 0;
2460} 2314}
2461 2315
2462static inline int security_task_setgroups(struct group_info *group_info)
2463{
2464 return 0;
2465}
2466
2467static inline int security_task_setnice(struct task_struct *p, int nice) 2316static inline int security_task_setnice(struct task_struct *p, int nice)
2468{ 2317{
2469 return cap_task_setnice(p, nice); 2318 return cap_task_setnice(p, nice);
@@ -2479,17 +2328,16 @@ static inline int security_task_getioprio(struct task_struct *p)
2479 return 0; 2328 return 0;
2480} 2329}
2481 2330
2482static inline int security_task_setrlimit(unsigned int resource, 2331static inline int security_task_setrlimit(struct task_struct *p,
2332 unsigned int resource,
2483 struct rlimit *new_rlim) 2333 struct rlimit *new_rlim)
2484{ 2334{
2485 return 0; 2335 return 0;
2486} 2336}
2487 2337
2488static inline int security_task_setscheduler(struct task_struct *p, 2338static inline int security_task_setscheduler(struct task_struct *p)
2489 int policy,
2490 struct sched_param *lp)
2491{ 2339{
2492 return cap_task_setscheduler(p, policy, lp); 2340 return cap_task_setscheduler(p);
2493} 2341}
2494 2342
2495static inline int security_task_getscheduler(struct task_struct *p) 2343static inline int security_task_getscheduler(struct task_struct *p)
@@ -2682,8 +2530,7 @@ static inline int security_inode_getsecctx(struct inode *inode, void **ctx, u32
2682 2530
2683#ifdef CONFIG_SECURITY_NETWORK 2531#ifdef CONFIG_SECURITY_NETWORK
2684 2532
2685int security_unix_stream_connect(struct socket *sock, struct socket *other, 2533int security_unix_stream_connect(struct sock *sock, struct sock *other, struct sock *newsk);
2686 struct sock *newsk);
2687int security_unix_may_send(struct socket *sock, struct socket *other); 2534int security_unix_may_send(struct socket *sock, struct socket *other);
2688int security_socket_create(int family, int type, int protocol, int kern); 2535int security_socket_create(int family, int type, int protocol, int kern);
2689int security_socket_post_create(struct socket *sock, int family, 2536int security_socket_post_create(struct socket *sock, int family,
@@ -2716,13 +2563,16 @@ void security_inet_csk_clone(struct sock *newsk,
2716 const struct request_sock *req); 2563 const struct request_sock *req);
2717void security_inet_conn_established(struct sock *sk, 2564void security_inet_conn_established(struct sock *sk,
2718 struct sk_buff *skb); 2565 struct sk_buff *skb);
2566int security_secmark_relabel_packet(u32 secid);
2567void security_secmark_refcount_inc(void);
2568void security_secmark_refcount_dec(void);
2719int security_tun_dev_create(void); 2569int security_tun_dev_create(void);
2720void security_tun_dev_post_create(struct sock *sk); 2570void security_tun_dev_post_create(struct sock *sk);
2721int security_tun_dev_attach(struct sock *sk); 2571int security_tun_dev_attach(struct sock *sk);
2722 2572
2723#else /* CONFIG_SECURITY_NETWORK */ 2573#else /* CONFIG_SECURITY_NETWORK */
2724static inline int security_unix_stream_connect(struct socket *sock, 2574static inline int security_unix_stream_connect(struct sock *sock,
2725 struct socket *other, 2575 struct sock *other,
2726 struct sock *newsk) 2576 struct sock *newsk)
2727{ 2577{
2728 return 0; 2578 return 0;
@@ -2870,6 +2720,19 @@ static inline void security_inet_conn_established(struct sock *sk,
2870{ 2720{
2871} 2721}
2872 2722
2723static inline int security_secmark_relabel_packet(u32 secid)
2724{
2725 return 0;
2726}
2727
2728static inline void security_secmark_refcount_inc(void)
2729{
2730}
2731
2732static inline void security_secmark_refcount_dec(void)
2733{
2734}
2735
2873static inline int security_tun_dev_create(void) 2736static inline int security_tun_dev_create(void)
2874{ 2737{
2875 return 0; 2738 return 0;
@@ -2972,8 +2835,7 @@ int security_path_mkdir(struct path *dir, struct dentry *dentry, int mode);
2972int security_path_rmdir(struct path *dir, struct dentry *dentry); 2835int security_path_rmdir(struct path *dir, struct dentry *dentry);
2973int security_path_mknod(struct path *dir, struct dentry *dentry, int mode, 2836int security_path_mknod(struct path *dir, struct dentry *dentry, int mode,
2974 unsigned int dev); 2837 unsigned int dev);
2975int security_path_truncate(struct path *path, loff_t length, 2838int security_path_truncate(struct path *path);
2976 unsigned int time_attrs);
2977int security_path_symlink(struct path *dir, struct dentry *dentry, 2839int security_path_symlink(struct path *dir, struct dentry *dentry,
2978 const char *old_name); 2840 const char *old_name);
2979int security_path_link(struct dentry *old_dentry, struct path *new_dir, 2841int security_path_link(struct dentry *old_dentry, struct path *new_dir,
@@ -3007,8 +2869,7 @@ static inline int security_path_mknod(struct path *dir, struct dentry *dentry,
3007 return 0; 2869 return 0;
3008} 2870}
3009 2871
3010static inline int security_path_truncate(struct path *path, loff_t length, 2872static inline int security_path_truncate(struct path *path)
3011 unsigned int time_attrs)
3012{ 2873{
3013 return 0; 2874 return 0;
3014} 2875}
@@ -3060,9 +2921,6 @@ void security_key_free(struct key *key);
3060int security_key_permission(key_ref_t key_ref, 2921int security_key_permission(key_ref_t key_ref,
3061 const struct cred *cred, key_perm_t perm); 2922 const struct cred *cred, key_perm_t perm);
3062int security_key_getsecurity(struct key *key, char **_buffer); 2923int security_key_getsecurity(struct key *key, char **_buffer);
3063int security_key_session_to_parent(const struct cred *cred,
3064 const struct cred *parent_cred,
3065 struct key *key);
3066 2924
3067#else 2925#else
3068 2926
@@ -3090,13 +2948,6 @@ static inline int security_key_getsecurity(struct key *key, char **_buffer)
3090 return 0; 2948 return 0;
3091} 2949}
3092 2950
3093static inline int security_key_session_to_parent(const struct cred *cred,
3094 const struct cred *parent_cred,
3095 struct key *key)
3096{
3097 return 0;
3098}
3099
3100#endif 2951#endif
3101#endif /* CONFIG_KEYS */ 2952#endif /* CONFIG_KEYS */
3102 2953