diff options
| author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2013-06-28 16:29:51 -0400 |
|---|---|---|
| committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2013-06-28 16:29:51 -0400 |
| commit | 959d921f5eb8878ea16049a7f6e9bcbb6dfbcb88 (patch) | |
| tree | 83fb4d2756fab97f508b5dccaac7578ba63a76e0 /include | |
| parent | f112bb48994e56868870a080773c392f774fa9a2 (diff) | |
| parent | 7017310ad737880d8520a7fc7e25a26b2e7e37f0 (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')
| -rw-r--r-- | include/linux/nfs4.h | 22 | ||||
| -rw-r--r-- | include/linux/nfs_fs.h | 26 | ||||
| -rw-r--r-- | include/linux/nfs_fs_sb.h | 8 | ||||
| -rw-r--r-- | include/linux/nfs_xdr.h | 19 | ||||
| -rw-r--r-- | include/linux/security.h | 57 |
5 files changed, 123 insertions, 9 deletions
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h index 7b8fc73810ad..e36dee52f224 100644 --- a/include/linux/nfs4.h +++ b/include/linux/nfs4.h | |||
| @@ -32,6 +32,15 @@ struct nfs4_acl { | |||
| 32 | struct nfs4_ace aces[0]; | 32 | struct nfs4_ace aces[0]; |
| 33 | }; | 33 | }; |
| 34 | 34 | ||
| 35 | #define NFS4_MAXLABELLEN 2048 | ||
| 36 | |||
| 37 | struct nfs4_label { | ||
| 38 | uint32_t lfs; | ||
| 39 | uint32_t pi; | ||
| 40 | u32 len; | ||
| 41 | char *label; | ||
| 42 | }; | ||
| 43 | |||
| 35 | typedef struct { char data[NFS4_VERIFIER_SIZE]; } nfs4_verifier; | 44 | typedef struct { char data[NFS4_VERIFIER_SIZE]; } nfs4_verifier; |
| 36 | 45 | ||
| 37 | struct nfs_stateid4 { | 46 | struct nfs_stateid4 { |
| @@ -219,6 +228,14 @@ enum nfsstat4 { | |||
| 219 | NFS4ERR_REJECT_DELEG = 10085, /* on callback */ | 228 | NFS4ERR_REJECT_DELEG = 10085, /* on callback */ |
| 220 | NFS4ERR_RETURNCONFLICT = 10086, /* outstanding layoutreturn */ | 229 | NFS4ERR_RETURNCONFLICT = 10086, /* outstanding layoutreturn */ |
| 221 | NFS4ERR_DELEG_REVOKED = 10087, /* deleg./layout revoked */ | 230 | NFS4ERR_DELEG_REVOKED = 10087, /* deleg./layout revoked */ |
| 231 | |||
| 232 | /* nfs42 */ | ||
| 233 | NFS4ERR_PARTNER_NOTSUPP = 10088, | ||
| 234 | NFS4ERR_PARTNER_NO_AUTH = 10089, | ||
| 235 | NFS4ERR_METADATA_NOTSUPP = 10090, | ||
| 236 | NFS4ERR_OFFLOAD_DENIED = 10091, | ||
| 237 | NFS4ERR_WRONG_LFS = 10092, | ||
| 238 | NFS4ERR_BADLABEL = 10093, | ||
| 222 | }; | 239 | }; |
| 223 | 240 | ||
| 224 | static inline bool seqid_mutating_err(u32 err) | 241 | static inline bool seqid_mutating_err(u32 err) |
| @@ -378,6 +395,7 @@ enum lock_type4 { | |||
| 378 | #define FATTR4_WORD1_FS_LAYOUT_TYPES (1UL << 30) | 395 | #define FATTR4_WORD1_FS_LAYOUT_TYPES (1UL << 30) |
| 379 | #define FATTR4_WORD2_LAYOUT_BLKSIZE (1UL << 1) | 396 | #define FATTR4_WORD2_LAYOUT_BLKSIZE (1UL << 1) |
| 380 | #define FATTR4_WORD2_MDSTHRESHOLD (1UL << 4) | 397 | #define FATTR4_WORD2_MDSTHRESHOLD (1UL << 4) |
| 398 | #define FATTR4_WORD2_SECURITY_LABEL (1UL << 17) | ||
| 381 | 399 | ||
| 382 | /* MDS threshold bitmap bits */ | 400 | /* MDS threshold bitmap bits */ |
| 383 | #define THRESHOLD_RD (1UL << 0) | 401 | #define THRESHOLD_RD (1UL << 0) |
| @@ -390,11 +408,15 @@ enum lock_type4 { | |||
| 390 | #define NFS4_VERSION 4 | 408 | #define NFS4_VERSION 4 |
| 391 | #define NFS4_MINOR_VERSION 0 | 409 | #define NFS4_MINOR_VERSION 0 |
| 392 | 410 | ||
| 411 | #if defined(CONFIG_NFS_V4_2) | ||
| 412 | #define NFS4_MAX_MINOR_VERSION 2 | ||
| 413 | #else | ||
| 393 | #if defined(CONFIG_NFS_V4_1) | 414 | #if defined(CONFIG_NFS_V4_1) |
| 394 | #define NFS4_MAX_MINOR_VERSION 1 | 415 | #define NFS4_MAX_MINOR_VERSION 1 |
| 395 | #else | 416 | #else |
| 396 | #define NFS4_MAX_MINOR_VERSION 0 | 417 | #define NFS4_MAX_MINOR_VERSION 0 |
| 397 | #endif /* CONFIG_NFS_V4_1 */ | 418 | #endif /* CONFIG_NFS_V4_1 */ |
| 419 | #endif /* CONFIG_NFS_V4_2 */ | ||
| 398 | 420 | ||
| 399 | #define NFS4_DEBUG 1 | 421 | #define NFS4_DEBUG 1 |
| 400 | 422 | ||
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 1384ed92cad6..0b176297aaf6 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
| @@ -207,6 +207,7 @@ struct nfs_inode { | |||
| 207 | #define NFS_INO_INVALID_ACL 0x0010 /* cached acls are invalid */ | 207 | #define NFS_INO_INVALID_ACL 0x0010 /* cached acls are invalid */ |
| 208 | #define NFS_INO_REVAL_PAGECACHE 0x0020 /* must revalidate pagecache */ | 208 | #define NFS_INO_REVAL_PAGECACHE 0x0020 /* must revalidate pagecache */ |
| 209 | #define NFS_INO_REVAL_FORCED 0x0040 /* force revalidation ignoring a delegation */ | 209 | #define NFS_INO_REVAL_FORCED 0x0040 /* force revalidation ignoring a delegation */ |
| 210 | #define NFS_INO_INVALID_LABEL 0x0080 /* cached label is invalid */ | ||
| 210 | 211 | ||
| 211 | /* | 212 | /* |
| 212 | * Bit offsets in flags field | 213 | * Bit offsets in flags field |
| @@ -336,7 +337,7 @@ extern void nfs_zap_mapping(struct inode *inode, struct address_space *mapping); | |||
| 336 | extern void nfs_zap_caches(struct inode *); | 337 | extern void nfs_zap_caches(struct inode *); |
| 337 | extern void nfs_invalidate_atime(struct inode *); | 338 | extern void nfs_invalidate_atime(struct inode *); |
| 338 | extern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *, | 339 | extern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *, |
| 339 | struct nfs_fattr *); | 340 | struct nfs_fattr *, struct nfs4_label *); |
| 340 | extern int nfs_refresh_inode(struct inode *, struct nfs_fattr *); | 341 | extern int nfs_refresh_inode(struct inode *, struct nfs_fattr *); |
| 341 | extern int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr); | 342 | extern int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr); |
| 342 | extern int nfs_post_op_update_inode_force_wcc(struct inode *inode, struct nfs_fattr *fattr); | 343 | extern int nfs_post_op_update_inode_force_wcc(struct inode *inode, struct nfs_fattr *fattr); |
| @@ -352,6 +353,8 @@ extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *); | |||
| 352 | extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping); | 353 | extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping); |
| 353 | extern int nfs_setattr(struct dentry *, struct iattr *); | 354 | extern int nfs_setattr(struct dentry *, struct iattr *); |
| 354 | extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr); | 355 | extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr); |
| 356 | extern void nfs_setsecurity(struct inode *inode, struct nfs_fattr *fattr, | ||
| 357 | struct nfs4_label *label); | ||
| 355 | extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); | 358 | extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); |
| 356 | extern void put_nfs_open_context(struct nfs_open_context *ctx); | 359 | extern void put_nfs_open_context(struct nfs_open_context *ctx); |
| 357 | extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, fmode_t mode); | 360 | extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, fmode_t mode); |
| @@ -469,7 +472,8 @@ extern const struct file_operations nfs_dir_operations; | |||
| 469 | extern const struct dentry_operations nfs_dentry_operations; | 472 | extern const struct dentry_operations nfs_dentry_operations; |
| 470 | 473 | ||
| 471 | extern void nfs_force_lookup_revalidate(struct inode *dir); | 474 | extern void nfs_force_lookup_revalidate(struct inode *dir); |
| 472 | extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_fattr *fattr); | 475 | extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, |
| 476 | struct nfs_fattr *fattr, struct nfs4_label *label); | ||
| 473 | extern int nfs_may_open(struct inode *inode, struct rpc_cred *cred, int openflags); | 477 | extern int nfs_may_open(struct inode *inode, struct rpc_cred *cred, int openflags); |
| 474 | extern void nfs_access_zap_cache(struct inode *inode); | 478 | extern void nfs_access_zap_cache(struct inode *inode); |
| 475 | 479 | ||
| @@ -498,6 +502,24 @@ extern int nfs_mountpoint_expiry_timeout; | |||
| 498 | extern void nfs_release_automount_timer(void); | 502 | extern void nfs_release_automount_timer(void); |
| 499 | 503 | ||
| 500 | /* | 504 | /* |
| 505 | * linux/fs/nfs/nfs4proc.c | ||
| 506 | */ | ||
| 507 | #ifdef CONFIG_NFS_V4_SECURITY_LABEL | ||
| 508 | extern struct nfs4_label *nfs4_label_alloc(struct nfs_server *server, gfp_t flags); | ||
| 509 | static inline void nfs4_label_free(struct nfs4_label *label) | ||
| 510 | { | ||
| 511 | if (label) { | ||
| 512 | kfree(label->label); | ||
| 513 | kfree(label); | ||
| 514 | } | ||
| 515 | return; | ||
| 516 | } | ||
| 517 | #else | ||
| 518 | static inline struct nfs4_label *nfs4_label_alloc(struct nfs_server *server, gfp_t flags) { return NULL; } | ||
| 519 | static inline void nfs4_label_free(void *label) {} | ||
| 520 | #endif | ||
| 521 | |||
| 522 | /* | ||
| 501 | * linux/fs/nfs/unlink.c | 523 | * linux/fs/nfs/unlink.c |
| 502 | */ | 524 | */ |
| 503 | extern void nfs_complete_unlink(struct dentry *dentry, struct inode *); | 525 | extern void nfs_complete_unlink(struct dentry *dentry, struct inode *); |
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h index 3b7fa2abecca..d2212432c456 100644 --- a/include/linux/nfs_fs_sb.h +++ b/include/linux/nfs_fs_sb.h | |||
| @@ -146,7 +146,12 @@ struct nfs_server { | |||
| 146 | u32 attr_bitmask[3];/* V4 bitmask representing the set | 146 | u32 attr_bitmask[3];/* V4 bitmask representing the set |
| 147 | of attributes supported on this | 147 | of attributes supported on this |
| 148 | filesystem */ | 148 | filesystem */ |
| 149 | u32 cache_consistency_bitmask[2]; | 149 | u32 attr_bitmask_nl[3]; |
| 150 | /* V4 bitmask representing the | ||
| 151 | set of attributes supported | ||
| 152 | on this filesystem excluding | ||
| 153 | the label support bit. */ | ||
| 154 | u32 cache_consistency_bitmask[3]; | ||
| 150 | /* V4 bitmask representing the subset | 155 | /* V4 bitmask representing the subset |
| 151 | of change attribute, size, ctime | 156 | of change attribute, size, ctime |
| 152 | and mtime attributes supported by | 157 | and mtime attributes supported by |
| @@ -200,5 +205,6 @@ struct nfs_server { | |||
| 200 | #define NFS_CAP_UIDGID_NOMAP (1U << 15) | 205 | #define NFS_CAP_UIDGID_NOMAP (1U << 15) |
| 201 | #define NFS_CAP_STATEID_NFSV41 (1U << 16) | 206 | #define NFS_CAP_STATEID_NFSV41 (1U << 16) |
| 202 | #define NFS_CAP_ATOMIC_OPEN_V1 (1U << 17) | 207 | #define NFS_CAP_ATOMIC_OPEN_V1 (1U << 17) |
| 208 | #define NFS_CAP_SECURITY_LABEL (1U << 18) | ||
| 203 | 209 | ||
| 204 | #endif | 210 | #endif |
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index 32c95d64e3aa..8651574a305b 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h | |||
| @@ -101,6 +101,7 @@ struct nfs_fattr { | |||
| 101 | #define NFS_ATTR_FATTR_MOUNTED_ON_FILEID (1U << 22) | 101 | #define NFS_ATTR_FATTR_MOUNTED_ON_FILEID (1U << 22) |
| 102 | #define NFS_ATTR_FATTR_OWNER_NAME (1U << 23) | 102 | #define NFS_ATTR_FATTR_OWNER_NAME (1U << 23) |
| 103 | #define NFS_ATTR_FATTR_GROUP_NAME (1U << 24) | 103 | #define NFS_ATTR_FATTR_GROUP_NAME (1U << 24) |
| 104 | #define NFS_ATTR_FATTR_V4_SECURITY_LABEL (1U << 25) | ||
| 104 | 105 | ||
| 105 | #define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \ | 106 | #define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \ |
| 106 | | NFS_ATTR_FATTR_MODE \ | 107 | | NFS_ATTR_FATTR_MODE \ |
| @@ -120,7 +121,8 @@ struct nfs_fattr { | |||
| 120 | #define NFS_ATTR_FATTR_V3 (NFS_ATTR_FATTR \ | 121 | #define NFS_ATTR_FATTR_V3 (NFS_ATTR_FATTR \ |
| 121 | | NFS_ATTR_FATTR_SPACE_USED) | 122 | | NFS_ATTR_FATTR_SPACE_USED) |
| 122 | #define NFS_ATTR_FATTR_V4 (NFS_ATTR_FATTR \ | 123 | #define NFS_ATTR_FATTR_V4 (NFS_ATTR_FATTR \ |
| 123 | | NFS_ATTR_FATTR_SPACE_USED) | 124 | | NFS_ATTR_FATTR_SPACE_USED \ |
| 125 | | NFS_ATTR_FATTR_V4_SECURITY_LABEL) | ||
| 124 | 126 | ||
| 125 | /* | 127 | /* |
| 126 | * Info on the file system | 128 | * Info on the file system |
| @@ -348,6 +350,7 @@ struct nfs_openargs { | |||
| 348 | const u32 * open_bitmap; | 350 | const u32 * open_bitmap; |
| 349 | __u32 claim; | 351 | __u32 claim; |
| 350 | enum createmode4 createmode; | 352 | enum createmode4 createmode; |
| 353 | const struct nfs4_label *label; | ||
| 351 | }; | 354 | }; |
| 352 | 355 | ||
| 353 | struct nfs_openres { | 356 | struct nfs_openres { |
| @@ -357,6 +360,7 @@ struct nfs_openres { | |||
| 357 | struct nfs4_change_info cinfo; | 360 | struct nfs4_change_info cinfo; |
| 358 | __u32 rflags; | 361 | __u32 rflags; |
| 359 | struct nfs_fattr * f_attr; | 362 | struct nfs_fattr * f_attr; |
| 363 | struct nfs4_label *f_label; | ||
| 360 | struct nfs_seqid * seqid; | 364 | struct nfs_seqid * seqid; |
| 361 | const struct nfs_server *server; | 365 | const struct nfs_server *server; |
| 362 | fmode_t delegation_type; | 366 | fmode_t delegation_type; |
| @@ -599,6 +603,7 @@ struct nfs_entry { | |||
| 599 | int eof; | 603 | int eof; |
| 600 | struct nfs_fh * fh; | 604 | struct nfs_fh * fh; |
| 601 | struct nfs_fattr * fattr; | 605 | struct nfs_fattr * fattr; |
| 606 | struct nfs4_label *label; | ||
| 602 | unsigned char d_type; | 607 | unsigned char d_type; |
| 603 | struct nfs_server * server; | 608 | struct nfs_server * server; |
| 604 | }; | 609 | }; |
| @@ -631,6 +636,7 @@ struct nfs_setattrargs { | |||
| 631 | struct iattr * iap; | 636 | struct iattr * iap; |
| 632 | const struct nfs_server * server; /* Needed for name mapping */ | 637 | const struct nfs_server * server; /* Needed for name mapping */ |
| 633 | const u32 * bitmask; | 638 | const u32 * bitmask; |
| 639 | const struct nfs4_label *label; | ||
| 634 | }; | 640 | }; |
| 635 | 641 | ||
| 636 | struct nfs_setaclargs { | 642 | struct nfs_setaclargs { |
| @@ -666,6 +672,7 @@ struct nfs_getaclres { | |||
| 666 | struct nfs_setattrres { | 672 | struct nfs_setattrres { |
| 667 | struct nfs4_sequence_res seq_res; | 673 | struct nfs4_sequence_res seq_res; |
| 668 | struct nfs_fattr * fattr; | 674 | struct nfs_fattr * fattr; |
| 675 | struct nfs4_label *label; | ||
| 669 | const struct nfs_server * server; | 676 | const struct nfs_server * server; |
| 670 | }; | 677 | }; |
| 671 | 678 | ||
| @@ -863,6 +870,7 @@ struct nfs4_create_arg { | |||
| 863 | const struct iattr * attrs; | 870 | const struct iattr * attrs; |
| 864 | const struct nfs_fh * dir_fh; | 871 | const struct nfs_fh * dir_fh; |
| 865 | const u32 * bitmask; | 872 | const u32 * bitmask; |
| 873 | const struct nfs4_label *label; | ||
| 866 | }; | 874 | }; |
| 867 | 875 | ||
| 868 | struct nfs4_create_res { | 876 | struct nfs4_create_res { |
| @@ -870,6 +878,7 @@ struct nfs4_create_res { | |||
| 870 | const struct nfs_server * server; | 878 | const struct nfs_server * server; |
| 871 | struct nfs_fh * fh; | 879 | struct nfs_fh * fh; |
| 872 | struct nfs_fattr * fattr; | 880 | struct nfs_fattr * fattr; |
| 881 | struct nfs4_label *label; | ||
| 873 | struct nfs4_change_info dir_cinfo; | 882 | struct nfs4_change_info dir_cinfo; |
| 874 | }; | 883 | }; |
| 875 | 884 | ||
| @@ -894,6 +903,7 @@ struct nfs4_getattr_res { | |||
| 894 | struct nfs4_sequence_res seq_res; | 903 | struct nfs4_sequence_res seq_res; |
| 895 | const struct nfs_server * server; | 904 | const struct nfs_server * server; |
| 896 | struct nfs_fattr * fattr; | 905 | struct nfs_fattr * fattr; |
| 906 | struct nfs4_label *label; | ||
| 897 | }; | 907 | }; |
| 898 | 908 | ||
| 899 | struct nfs4_link_arg { | 909 | struct nfs4_link_arg { |
| @@ -908,6 +918,7 @@ struct nfs4_link_res { | |||
| 908 | struct nfs4_sequence_res seq_res; | 918 | struct nfs4_sequence_res seq_res; |
| 909 | const struct nfs_server * server; | 919 | const struct nfs_server * server; |
| 910 | struct nfs_fattr * fattr; | 920 | struct nfs_fattr * fattr; |
| 921 | struct nfs4_label *label; | ||
| 911 | struct nfs4_change_info cinfo; | 922 | struct nfs4_change_info cinfo; |
| 912 | struct nfs_fattr * dir_attr; | 923 | struct nfs_fattr * dir_attr; |
| 913 | }; | 924 | }; |
| @@ -925,6 +936,7 @@ struct nfs4_lookup_res { | |||
| 925 | const struct nfs_server * server; | 936 | const struct nfs_server * server; |
| 926 | struct nfs_fattr * fattr; | 937 | struct nfs_fattr * fattr; |
| 927 | struct nfs_fh * fh; | 938 | struct nfs_fh * fh; |
| 939 | struct nfs4_label *label; | ||
| 928 | }; | 940 | }; |
| 929 | 941 | ||
| 930 | struct nfs4_lookup_root_arg { | 942 | struct nfs4_lookup_root_arg { |
| @@ -1367,11 +1379,12 @@ struct nfs_rpc_ops { | |||
| 1367 | struct dentry *(*try_mount) (int, const char *, struct nfs_mount_info *, | 1379 | struct dentry *(*try_mount) (int, const char *, struct nfs_mount_info *, |
| 1368 | struct nfs_subversion *); | 1380 | struct nfs_subversion *); |
| 1369 | int (*getattr) (struct nfs_server *, struct nfs_fh *, | 1381 | int (*getattr) (struct nfs_server *, struct nfs_fh *, |
| 1370 | struct nfs_fattr *); | 1382 | struct nfs_fattr *, struct nfs4_label *); |
| 1371 | int (*setattr) (struct dentry *, struct nfs_fattr *, | 1383 | int (*setattr) (struct dentry *, struct nfs_fattr *, |
| 1372 | struct iattr *); | 1384 | struct iattr *); |
| 1373 | int (*lookup) (struct inode *, struct qstr *, | 1385 | int (*lookup) (struct inode *, struct qstr *, |
| 1374 | struct nfs_fh *, struct nfs_fattr *); | 1386 | struct nfs_fh *, struct nfs_fattr *, |
| 1387 | struct nfs4_label *); | ||
| 1375 | int (*access) (struct inode *, struct nfs_access_entry *); | 1388 | int (*access) (struct inode *, struct nfs_access_entry *); |
| 1376 | int (*readlink)(struct inode *, struct page *, unsigned int, | 1389 | int (*readlink)(struct inode *, struct page *, unsigned int, |
| 1377 | unsigned int); | 1390 | unsigned int); |
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 | ||
| 30 | struct linux_binprm; | 31 | struct linux_binprm; |
| 31 | struct cred; | 32 | struct 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 | |||
| 63 | struct ctl_table; | 67 | struct ctl_table; |
| 64 | struct audit_krule; | 68 | struct audit_krule; |
| 65 | struct user_namespace; | 69 | struct 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); |
| 1726 | int security_sb_umount(struct vfsmount *mnt, int flags); | 1753 | int security_sb_umount(struct vfsmount *mnt, int flags); |
| 1727 | int security_sb_pivotroot(struct path *old_path, struct path *new_path); | 1754 | int security_sb_pivotroot(struct path *old_path, struct path *new_path); |
| 1728 | int security_sb_set_mnt_opts(struct super_block *sb, struct security_mnt_opts *opts); | 1755 | int 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); | ||
| 1729 | int security_sb_clone_mnt_opts(const struct super_block *oldsb, | 1759 | int security_sb_clone_mnt_opts(const struct super_block *oldsb, |
| 1730 | struct super_block *newsb); | 1760 | struct super_block *newsb); |
| 1731 | int security_sb_parse_opts_str(char *options, struct security_mnt_opts *opts); | 1761 | int security_sb_parse_opts_str(char *options, struct security_mnt_opts *opts); |
| 1762 | int security_dentry_init_security(struct dentry *dentry, int mode, | ||
| 1763 | struct qstr *name, void **ctx, | ||
| 1764 | u32 *ctxlen); | ||
| 1732 | 1765 | ||
| 1733 | int security_inode_alloc(struct inode *inode); | 1766 | int security_inode_alloc(struct inode *inode); |
| 1734 | void security_inode_free(struct inode *inode); | 1767 | void security_inode_free(struct inode *inode); |
| @@ -1840,6 +1873,7 @@ void security_d_instantiate(struct dentry *dentry, struct inode *inode); | |||
| 1840 | int security_getprocattr(struct task_struct *p, char *name, char **value); | 1873 | int security_getprocattr(struct task_struct *p, char *name, char **value); |
| 1841 | int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size); | 1874 | int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size); |
| 1842 | int security_netlink_send(struct sock *sk, struct sk_buff *skb); | 1875 | int security_netlink_send(struct sock *sk, struct sk_buff *skb); |
| 1876 | int security_ismaclabel(const char *name); | ||
| 1843 | int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen); | 1877 | int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen); |
| 1844 | int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid); | 1878 | int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid); |
| 1845 | void security_release_secctx(char *secdata, u32 seclen); | 1879 | void 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 | ||
| 2013 | static inline int security_sb_set_mnt_opts(struct super_block *sb, | 2047 | static 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) | |||
| 2035 | static inline void security_inode_free(struct inode *inode) | 2071 | static inline void security_inode_free(struct inode *inode) |
| 2036 | { } | 2072 | { } |
| 2037 | 2073 | ||
| 2074 | static 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 | |||
| 2038 | static inline int security_inode_init_security(struct inode *inode, | 2084 | static 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 | ||
| 2569 | static inline int security_ismaclabel(const char *name) | ||
| 2570 | { | ||
| 2571 | return 0; | ||
| 2572 | } | ||
| 2573 | |||
| 2523 | static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) | 2574 | static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) |
| 2524 | { | 2575 | { |
| 2525 | return -EOPNOTSUPP; | 2576 | return -EOPNOTSUPP; |
