aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/security.h
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2013-06-28 16:29:51 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2013-06-28 16:29:51 -0400
commit959d921f5eb8878ea16049a7f6e9bcbb6dfbcb88 (patch)
tree83fb4d2756fab97f508b5dccaac7578ba63a76e0 /include/linux/security.h
parentf112bb48994e56868870a080773c392f774fa9a2 (diff)
parent7017310ad737880d8520a7fc7e25a26b2e7e37f0 (diff)
Merge branch 'labeled-nfs' into linux-next
* labeled-nfs: NFS: Apply v4.1 capabilities to v4.2 NFS: Add in v4.2 callback operation NFS: Make callbacks minor version generic Kconfig: Add Kconfig entry for Labeled NFS V4 client NFS: Extend NFS xattr handlers to accept the security namespace NFS: Client implementation of Labeled-NFS NFS: Add label lifecycle management NFS:Add labels to client function prototypes NFSv4: Extend fattr bitmaps to support all 3 words NFSv4: Introduce new label structure NFSv4: Add label recommended attribute and NFSv4 flags NFSv4.2: Added NFS v4.2 support to the NFS client SELinux: Add new labeling type native labels LSM: Add flags field to security_sb_set_mnt_opts for in kernel mount data. Security: Add Hook to test if the particular xattr is part of a MAC model. Security: Add hook to calculate context based on a negative dentry. NFS: Add NFSv4.2 protocol constants Conflicts: fs/nfs/nfs4proc.c
Diffstat (limited to 'include/linux/security.h')
-rw-r--r--include/linux/security.h57
1 files changed, 54 insertions, 3 deletions
diff --git a/include/linux/security.h b/include/linux/security.h
index 4686491852a7..a585a9085e46 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -26,6 +26,7 @@
26#include <linux/capability.h> 26#include <linux/capability.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/err.h> 28#include <linux/err.h>
29#include <linux/string.h>
29 30
30struct linux_binprm; 31struct linux_binprm;
31struct cred; 32struct cred;
@@ -60,6 +61,9 @@ struct mm_struct;
60#define SECURITY_CAP_NOAUDIT 0 61#define SECURITY_CAP_NOAUDIT 0
61#define SECURITY_CAP_AUDIT 1 62#define SECURITY_CAP_AUDIT 1
62 63
64/* LSM Agnostic defines for sb_set_mnt_opts */
65#define SECURITY_LSM_NATIVE_LABELS 1
66
63struct ctl_table; 67struct ctl_table;
64struct audit_krule; 68struct audit_krule;
65struct user_namespace; 69struct user_namespace;
@@ -306,6 +310,15 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
306 * Parse a string of security data filling in the opts structure 310 * Parse a string of security data filling in the opts structure
307 * @options string containing all mount options known by the LSM 311 * @options string containing all mount options known by the LSM
308 * @opts binary data structure usable by the LSM 312 * @opts binary data structure usable by the LSM
313 * @dentry_init_security:
314 * Compute a context for a dentry as the inode is not yet available
315 * since NFSv4 has no label backed by an EA anyway.
316 * @dentry dentry to use in calculating the context.
317 * @mode mode used to determine resource type.
318 * @name name of the last path component used to create file
319 * @ctx pointer to place the pointer to the resulting context in.
320 * @ctxlen point to place the length of the resulting context.
321 *
309 * 322 *
310 * Security hooks for inode operations. 323 * Security hooks for inode operations.
311 * 324 *
@@ -1313,6 +1326,13 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1313 * @pages contains the number of pages. 1326 * @pages contains the number of pages.
1314 * Return 0 if permission is granted. 1327 * Return 0 if permission is granted.
1315 * 1328 *
1329 * @ismaclabel:
1330 * Check if the extended attribute specified by @name
1331 * represents a MAC label. Returns 1 if name is a MAC
1332 * attribute otherwise returns 0.
1333 * @name full extended attribute name to check against
1334 * LSM as a MAC label.
1335 *
1316 * @secid_to_secctx: 1336 * @secid_to_secctx:
1317 * Convert secid to security context. If secdata is NULL the length of 1337 * Convert secid to security context. If secdata is NULL the length of
1318 * the result will be returned in seclen, but no secdata will be returned. 1338 * the result will be returned in seclen, but no secdata will be returned.
@@ -1439,10 +1459,16 @@ struct security_operations {
1439 int (*sb_pivotroot) (struct path *old_path, 1459 int (*sb_pivotroot) (struct path *old_path,
1440 struct path *new_path); 1460 struct path *new_path);
1441 int (*sb_set_mnt_opts) (struct super_block *sb, 1461 int (*sb_set_mnt_opts) (struct super_block *sb,
1442 struct security_mnt_opts *opts); 1462 struct security_mnt_opts *opts,
1463 unsigned long kern_flags,
1464 unsigned long *set_kern_flags);
1443 int (*sb_clone_mnt_opts) (const struct super_block *oldsb, 1465 int (*sb_clone_mnt_opts) (const struct super_block *oldsb,
1444 struct super_block *newsb); 1466 struct super_block *newsb);
1445 int (*sb_parse_opts_str) (char *options, struct security_mnt_opts *opts); 1467 int (*sb_parse_opts_str) (char *options, struct security_mnt_opts *opts);
1468 int (*dentry_init_security) (struct dentry *dentry, int mode,
1469 struct qstr *name, void **ctx,
1470 u32 *ctxlen);
1471
1446 1472
1447#ifdef CONFIG_SECURITY_PATH 1473#ifdef CONFIG_SECURITY_PATH
1448 int (*path_unlink) (struct path *dir, struct dentry *dentry); 1474 int (*path_unlink) (struct path *dir, struct dentry *dentry);
@@ -1590,6 +1616,7 @@ struct security_operations {
1590 1616
1591 int (*getprocattr) (struct task_struct *p, char *name, char **value); 1617 int (*getprocattr) (struct task_struct *p, char *name, char **value);
1592 int (*setprocattr) (struct task_struct *p, char *name, void *value, size_t size); 1618 int (*setprocattr) (struct task_struct *p, char *name, void *value, size_t size);
1619 int (*ismaclabel) (const char *name);
1593 int (*secid_to_secctx) (u32 secid, char **secdata, u32 *seclen); 1620 int (*secid_to_secctx) (u32 secid, char **secdata, u32 *seclen);
1594 int (*secctx_to_secid) (const char *secdata, u32 seclen, u32 *secid); 1621 int (*secctx_to_secid) (const char *secdata, u32 seclen, u32 *secid);
1595 void (*release_secctx) (char *secdata, u32 seclen); 1622 void (*release_secctx) (char *secdata, u32 seclen);
@@ -1725,10 +1752,16 @@ int security_sb_mount(const char *dev_name, struct path *path,
1725 const char *type, unsigned long flags, void *data); 1752 const char *type, unsigned long flags, void *data);
1726int security_sb_umount(struct vfsmount *mnt, int flags); 1753int security_sb_umount(struct vfsmount *mnt, int flags);
1727int security_sb_pivotroot(struct path *old_path, struct path *new_path); 1754int security_sb_pivotroot(struct path *old_path, struct path *new_path);
1728int security_sb_set_mnt_opts(struct super_block *sb, struct security_mnt_opts *opts); 1755int security_sb_set_mnt_opts(struct super_block *sb,
1756 struct security_mnt_opts *opts,
1757 unsigned long kern_flags,
1758 unsigned long *set_kern_flags);
1729int security_sb_clone_mnt_opts(const struct super_block *oldsb, 1759int security_sb_clone_mnt_opts(const struct super_block *oldsb,
1730 struct super_block *newsb); 1760 struct super_block *newsb);
1731int security_sb_parse_opts_str(char *options, struct security_mnt_opts *opts); 1761int security_sb_parse_opts_str(char *options, struct security_mnt_opts *opts);
1762int security_dentry_init_security(struct dentry *dentry, int mode,
1763 struct qstr *name, void **ctx,
1764 u32 *ctxlen);
1732 1765
1733int security_inode_alloc(struct inode *inode); 1766int security_inode_alloc(struct inode *inode);
1734void security_inode_free(struct inode *inode); 1767void security_inode_free(struct inode *inode);
@@ -1840,6 +1873,7 @@ void security_d_instantiate(struct dentry *dentry, struct inode *inode);
1840int security_getprocattr(struct task_struct *p, char *name, char **value); 1873int security_getprocattr(struct task_struct *p, char *name, char **value);
1841int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size); 1874int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size);
1842int security_netlink_send(struct sock *sk, struct sk_buff *skb); 1875int security_netlink_send(struct sock *sk, struct sk_buff *skb);
1876int security_ismaclabel(const char *name);
1843int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen); 1877int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen);
1844int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid); 1878int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid);
1845void security_release_secctx(char *secdata, u32 seclen); 1879void security_release_secctx(char *secdata, u32 seclen);
@@ -2011,7 +2045,9 @@ static inline int security_sb_pivotroot(struct path *old_path,
2011} 2045}
2012 2046
2013static inline int security_sb_set_mnt_opts(struct super_block *sb, 2047static inline int security_sb_set_mnt_opts(struct super_block *sb,
2014 struct security_mnt_opts *opts) 2048 struct security_mnt_opts *opts,
2049 unsigned long kern_flags,
2050 unsigned long *set_kern_flags)
2015{ 2051{
2016 return 0; 2052 return 0;
2017} 2053}
@@ -2035,6 +2071,16 @@ static inline int security_inode_alloc(struct inode *inode)
2035static inline void security_inode_free(struct inode *inode) 2071static inline void security_inode_free(struct inode *inode)
2036{ } 2072{ }
2037 2073
2074static inline int security_dentry_init_security(struct dentry *dentry,
2075 int mode,
2076 struct qstr *name,
2077 void **ctx,
2078 u32 *ctxlen)
2079{
2080 return -EOPNOTSUPP;
2081}
2082
2083
2038static inline int security_inode_init_security(struct inode *inode, 2084static inline int security_inode_init_security(struct inode *inode,
2039 struct inode *dir, 2085 struct inode *dir,
2040 const struct qstr *qstr, 2086 const struct qstr *qstr,
@@ -2520,6 +2566,11 @@ static inline int security_netlink_send(struct sock *sk, struct sk_buff *skb)
2520 return cap_netlink_send(sk, skb); 2566 return cap_netlink_send(sk, skb);
2521} 2567}
2522 2568
2569static inline int security_ismaclabel(const char *name)
2570{
2571 return 0;
2572}
2573
2523static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) 2574static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
2524{ 2575{
2525 return -EOPNOTSUPP; 2576 return -EOPNOTSUPP;