diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/nfs4.h | 22 | ||||
-rw-r--r-- | include/linux/nfs_fs.h | 27 | ||||
-rw-r--r-- | include/linux/nfs_fs_sb.h | 8 | ||||
-rw-r--r-- | include/linux/nfs_xdr.h | 20 | ||||
-rw-r--r-- | include/linux/security.h | 57 | ||||
-rw-r--r-- | include/linux/sunrpc/sched.h | 20 |
6 files changed, 125 insertions, 29 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 fc01d5cb4cf1..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,10 +353,13 @@ 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); |
358 | extern struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry, fmode_t f_mode); | 361 | extern struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry, fmode_t f_mode); |
362 | extern void nfs_inode_attach_open_context(struct nfs_open_context *ctx); | ||
359 | extern void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx); | 363 | extern void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx); |
360 | extern struct nfs_lock_context *nfs_get_lock_context(struct nfs_open_context *ctx); | 364 | extern struct nfs_lock_context *nfs_get_lock_context(struct nfs_open_context *ctx); |
361 | extern void nfs_put_lock_context(struct nfs_lock_context *l_ctx); | 365 | extern void nfs_put_lock_context(struct nfs_lock_context *l_ctx); |
@@ -468,7 +472,8 @@ extern const struct file_operations nfs_dir_operations; | |||
468 | extern const struct dentry_operations nfs_dentry_operations; | 472 | extern const struct dentry_operations nfs_dentry_operations; |
469 | 473 | ||
470 | extern void nfs_force_lookup_revalidate(struct inode *dir); | 474 | extern void nfs_force_lookup_revalidate(struct inode *dir); |
471 | 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); | ||
472 | 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); |
473 | extern void nfs_access_zap_cache(struct inode *inode); | 478 | extern void nfs_access_zap_cache(struct inode *inode); |
474 | 479 | ||
@@ -497,6 +502,24 @@ extern int nfs_mountpoint_expiry_timeout; | |||
497 | extern void nfs_release_automount_timer(void); | 502 | extern void nfs_release_automount_timer(void); |
498 | 503 | ||
499 | /* | 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 | /* | ||
500 | * linux/fs/nfs/unlink.c | 523 | * linux/fs/nfs/unlink.c |
501 | */ | 524 | */ |
502 | 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 104b62f23ee0..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 |
@@ -246,6 +248,7 @@ struct nfs4_layoutget_res { | |||
246 | struct nfs4_layoutget { | 248 | struct nfs4_layoutget { |
247 | struct nfs4_layoutget_args args; | 249 | struct nfs4_layoutget_args args; |
248 | struct nfs4_layoutget_res res; | 250 | struct nfs4_layoutget_res res; |
251 | struct rpc_cred *cred; | ||
249 | gfp_t gfp_flags; | 252 | gfp_t gfp_flags; |
250 | }; | 253 | }; |
251 | 254 | ||
@@ -347,6 +350,7 @@ struct nfs_openargs { | |||
347 | const u32 * open_bitmap; | 350 | const u32 * open_bitmap; |
348 | __u32 claim; | 351 | __u32 claim; |
349 | enum createmode4 createmode; | 352 | enum createmode4 createmode; |
353 | const struct nfs4_label *label; | ||
350 | }; | 354 | }; |
351 | 355 | ||
352 | struct nfs_openres { | 356 | struct nfs_openres { |
@@ -356,6 +360,7 @@ struct nfs_openres { | |||
356 | struct nfs4_change_info cinfo; | 360 | struct nfs4_change_info cinfo; |
357 | __u32 rflags; | 361 | __u32 rflags; |
358 | struct nfs_fattr * f_attr; | 362 | struct nfs_fattr * f_attr; |
363 | struct nfs4_label *f_label; | ||
359 | struct nfs_seqid * seqid; | 364 | struct nfs_seqid * seqid; |
360 | const struct nfs_server *server; | 365 | const struct nfs_server *server; |
361 | fmode_t delegation_type; | 366 | fmode_t delegation_type; |
@@ -598,6 +603,7 @@ struct nfs_entry { | |||
598 | int eof; | 603 | int eof; |
599 | struct nfs_fh * fh; | 604 | struct nfs_fh * fh; |
600 | struct nfs_fattr * fattr; | 605 | struct nfs_fattr * fattr; |
606 | struct nfs4_label *label; | ||
601 | unsigned char d_type; | 607 | unsigned char d_type; |
602 | struct nfs_server * server; | 608 | struct nfs_server * server; |
603 | }; | 609 | }; |
@@ -630,6 +636,7 @@ struct nfs_setattrargs { | |||
630 | struct iattr * iap; | 636 | struct iattr * iap; |
631 | const struct nfs_server * server; /* Needed for name mapping */ | 637 | const struct nfs_server * server; /* Needed for name mapping */ |
632 | const u32 * bitmask; | 638 | const u32 * bitmask; |
639 | const struct nfs4_label *label; | ||
633 | }; | 640 | }; |
634 | 641 | ||
635 | struct nfs_setaclargs { | 642 | struct nfs_setaclargs { |
@@ -665,6 +672,7 @@ struct nfs_getaclres { | |||
665 | struct nfs_setattrres { | 672 | struct nfs_setattrres { |
666 | struct nfs4_sequence_res seq_res; | 673 | struct nfs4_sequence_res seq_res; |
667 | struct nfs_fattr * fattr; | 674 | struct nfs_fattr * fattr; |
675 | struct nfs4_label *label; | ||
668 | const struct nfs_server * server; | 676 | const struct nfs_server * server; |
669 | }; | 677 | }; |
670 | 678 | ||
@@ -862,6 +870,7 @@ struct nfs4_create_arg { | |||
862 | const struct iattr * attrs; | 870 | const struct iattr * attrs; |
863 | const struct nfs_fh * dir_fh; | 871 | const struct nfs_fh * dir_fh; |
864 | const u32 * bitmask; | 872 | const u32 * bitmask; |
873 | const struct nfs4_label *label; | ||
865 | }; | 874 | }; |
866 | 875 | ||
867 | struct nfs4_create_res { | 876 | struct nfs4_create_res { |
@@ -869,6 +878,7 @@ struct nfs4_create_res { | |||
869 | const struct nfs_server * server; | 878 | const struct nfs_server * server; |
870 | struct nfs_fh * fh; | 879 | struct nfs_fh * fh; |
871 | struct nfs_fattr * fattr; | 880 | struct nfs_fattr * fattr; |
881 | struct nfs4_label *label; | ||
872 | struct nfs4_change_info dir_cinfo; | 882 | struct nfs4_change_info dir_cinfo; |
873 | }; | 883 | }; |
874 | 884 | ||
@@ -893,6 +903,7 @@ struct nfs4_getattr_res { | |||
893 | struct nfs4_sequence_res seq_res; | 903 | struct nfs4_sequence_res seq_res; |
894 | const struct nfs_server * server; | 904 | const struct nfs_server * server; |
895 | struct nfs_fattr * fattr; | 905 | struct nfs_fattr * fattr; |
906 | struct nfs4_label *label; | ||
896 | }; | 907 | }; |
897 | 908 | ||
898 | struct nfs4_link_arg { | 909 | struct nfs4_link_arg { |
@@ -907,6 +918,7 @@ struct nfs4_link_res { | |||
907 | struct nfs4_sequence_res seq_res; | 918 | struct nfs4_sequence_res seq_res; |
908 | const struct nfs_server * server; | 919 | const struct nfs_server * server; |
909 | struct nfs_fattr * fattr; | 920 | struct nfs_fattr * fattr; |
921 | struct nfs4_label *label; | ||
910 | struct nfs4_change_info cinfo; | 922 | struct nfs4_change_info cinfo; |
911 | struct nfs_fattr * dir_attr; | 923 | struct nfs_fattr * dir_attr; |
912 | }; | 924 | }; |
@@ -924,6 +936,7 @@ struct nfs4_lookup_res { | |||
924 | const struct nfs_server * server; | 936 | const struct nfs_server * server; |
925 | struct nfs_fattr * fattr; | 937 | struct nfs_fattr * fattr; |
926 | struct nfs_fh * fh; | 938 | struct nfs_fh * fh; |
939 | struct nfs4_label *label; | ||
927 | }; | 940 | }; |
928 | 941 | ||
929 | struct nfs4_lookup_root_arg { | 942 | struct nfs4_lookup_root_arg { |
@@ -1366,11 +1379,12 @@ struct nfs_rpc_ops { | |||
1366 | struct dentry *(*try_mount) (int, const char *, struct nfs_mount_info *, | 1379 | struct dentry *(*try_mount) (int, const char *, struct nfs_mount_info *, |
1367 | struct nfs_subversion *); | 1380 | struct nfs_subversion *); |
1368 | int (*getattr) (struct nfs_server *, struct nfs_fh *, | 1381 | int (*getattr) (struct nfs_server *, struct nfs_fh *, |
1369 | struct nfs_fattr *); | 1382 | struct nfs_fattr *, struct nfs4_label *); |
1370 | int (*setattr) (struct dentry *, struct nfs_fattr *, | 1383 | int (*setattr) (struct dentry *, struct nfs_fattr *, |
1371 | struct iattr *); | 1384 | struct iattr *); |
1372 | int (*lookup) (struct inode *, struct qstr *, | 1385 | int (*lookup) (struct inode *, struct qstr *, |
1373 | struct nfs_fh *, struct nfs_fattr *); | 1386 | struct nfs_fh *, struct nfs_fattr *, |
1387 | struct nfs4_label *); | ||
1374 | int (*access) (struct inode *, struct nfs_access_entry *); | 1388 | int (*access) (struct inode *, struct nfs_access_entry *); |
1375 | int (*readlink)(struct inode *, struct page *, unsigned int, | 1389 | int (*readlink)(struct inode *, struct page *, unsigned int, |
1376 | unsigned int); | 1390 | unsigned int); |
diff --git a/include/linux/security.h b/include/linux/security.h index 40560f41e3d5..7ce53ae1266b 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. |
@@ -1440,10 +1460,16 @@ struct security_operations { | |||
1440 | int (*sb_pivotroot) (struct path *old_path, | 1460 | int (*sb_pivotroot) (struct path *old_path, |
1441 | struct path *new_path); | 1461 | struct path *new_path); |
1442 | int (*sb_set_mnt_opts) (struct super_block *sb, | 1462 | int (*sb_set_mnt_opts) (struct super_block *sb, |
1443 | struct security_mnt_opts *opts); | 1463 | struct security_mnt_opts *opts, |
1464 | unsigned long kern_flags, | ||
1465 | unsigned long *set_kern_flags); | ||
1444 | int (*sb_clone_mnt_opts) (const struct super_block *oldsb, | 1466 | int (*sb_clone_mnt_opts) (const struct super_block *oldsb, |
1445 | struct super_block *newsb); | 1467 | struct super_block *newsb); |
1446 | int (*sb_parse_opts_str) (char *options, struct security_mnt_opts *opts); | 1468 | int (*sb_parse_opts_str) (char *options, struct security_mnt_opts *opts); |
1469 | int (*dentry_init_security) (struct dentry *dentry, int mode, | ||
1470 | struct qstr *name, void **ctx, | ||
1471 | u32 *ctxlen); | ||
1472 | |||
1447 | 1473 | ||
1448 | #ifdef CONFIG_SECURITY_PATH | 1474 | #ifdef CONFIG_SECURITY_PATH |
1449 | int (*path_unlink) (struct path *dir, struct dentry *dentry); | 1475 | int (*path_unlink) (struct path *dir, struct dentry *dentry); |
@@ -1591,6 +1617,7 @@ struct security_operations { | |||
1591 | 1617 | ||
1592 | int (*getprocattr) (struct task_struct *p, char *name, char **value); | 1618 | int (*getprocattr) (struct task_struct *p, char *name, char **value); |
1593 | int (*setprocattr) (struct task_struct *p, char *name, void *value, size_t size); | 1619 | int (*setprocattr) (struct task_struct *p, char *name, void *value, size_t size); |
1620 | int (*ismaclabel) (const char *name); | ||
1594 | int (*secid_to_secctx) (u32 secid, char **secdata, u32 *seclen); | 1621 | int (*secid_to_secctx) (u32 secid, char **secdata, u32 *seclen); |
1595 | int (*secctx_to_secid) (const char *secdata, u32 seclen, u32 *secid); | 1622 | int (*secctx_to_secid) (const char *secdata, u32 seclen, u32 *secid); |
1596 | void (*release_secctx) (char *secdata, u32 seclen); | 1623 | void (*release_secctx) (char *secdata, u32 seclen); |
@@ -1726,10 +1753,16 @@ int security_sb_mount(const char *dev_name, struct path *path, | |||
1726 | const char *type, unsigned long flags, void *data); | 1753 | const char *type, unsigned long flags, void *data); |
1727 | int security_sb_umount(struct vfsmount *mnt, int flags); | 1754 | int security_sb_umount(struct vfsmount *mnt, int flags); |
1728 | int security_sb_pivotroot(struct path *old_path, struct path *new_path); | 1755 | int security_sb_pivotroot(struct path *old_path, struct path *new_path); |
1729 | int security_sb_set_mnt_opts(struct super_block *sb, struct security_mnt_opts *opts); | 1756 | int security_sb_set_mnt_opts(struct super_block *sb, |
1757 | struct security_mnt_opts *opts, | ||
1758 | unsigned long kern_flags, | ||
1759 | unsigned long *set_kern_flags); | ||
1730 | int security_sb_clone_mnt_opts(const struct super_block *oldsb, | 1760 | int security_sb_clone_mnt_opts(const struct super_block *oldsb, |
1731 | struct super_block *newsb); | 1761 | struct super_block *newsb); |
1732 | int security_sb_parse_opts_str(char *options, struct security_mnt_opts *opts); | 1762 | int security_sb_parse_opts_str(char *options, struct security_mnt_opts *opts); |
1763 | int security_dentry_init_security(struct dentry *dentry, int mode, | ||
1764 | struct qstr *name, void **ctx, | ||
1765 | u32 *ctxlen); | ||
1733 | 1766 | ||
1734 | int security_inode_alloc(struct inode *inode); | 1767 | int security_inode_alloc(struct inode *inode); |
1735 | void security_inode_free(struct inode *inode); | 1768 | void security_inode_free(struct inode *inode); |
@@ -1841,6 +1874,7 @@ void security_d_instantiate(struct dentry *dentry, struct inode *inode); | |||
1841 | int security_getprocattr(struct task_struct *p, char *name, char **value); | 1874 | int security_getprocattr(struct task_struct *p, char *name, char **value); |
1842 | int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size); | 1875 | int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size); |
1843 | int security_netlink_send(struct sock *sk, struct sk_buff *skb); | 1876 | int security_netlink_send(struct sock *sk, struct sk_buff *skb); |
1877 | int security_ismaclabel(const char *name); | ||
1844 | int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen); | 1878 | int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen); |
1845 | int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid); | 1879 | int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid); |
1846 | void security_release_secctx(char *secdata, u32 seclen); | 1880 | void security_release_secctx(char *secdata, u32 seclen); |
@@ -2012,7 +2046,9 @@ static inline int security_sb_pivotroot(struct path *old_path, | |||
2012 | } | 2046 | } |
2013 | 2047 | ||
2014 | static inline int security_sb_set_mnt_opts(struct super_block *sb, | 2048 | static inline int security_sb_set_mnt_opts(struct super_block *sb, |
2015 | struct security_mnt_opts *opts) | 2049 | struct security_mnt_opts *opts, |
2050 | unsigned long kern_flags, | ||
2051 | unsigned long *set_kern_flags) | ||
2016 | { | 2052 | { |
2017 | return 0; | 2053 | return 0; |
2018 | } | 2054 | } |
@@ -2036,6 +2072,16 @@ static inline int security_inode_alloc(struct inode *inode) | |||
2036 | static inline void security_inode_free(struct inode *inode) | 2072 | static inline void security_inode_free(struct inode *inode) |
2037 | { } | 2073 | { } |
2038 | 2074 | ||
2075 | static inline int security_dentry_init_security(struct dentry *dentry, | ||
2076 | int mode, | ||
2077 | struct qstr *name, | ||
2078 | void **ctx, | ||
2079 | u32 *ctxlen) | ||
2080 | { | ||
2081 | return -EOPNOTSUPP; | ||
2082 | } | ||
2083 | |||
2084 | |||
2039 | static inline int security_inode_init_security(struct inode *inode, | 2085 | static inline int security_inode_init_security(struct inode *inode, |
2040 | struct inode *dir, | 2086 | struct inode *dir, |
2041 | const struct qstr *qstr, | 2087 | const struct qstr *qstr, |
@@ -2521,6 +2567,11 @@ static inline int security_netlink_send(struct sock *sk, struct sk_buff *skb) | |||
2521 | return cap_netlink_send(sk, skb); | 2567 | return cap_netlink_send(sk, skb); |
2522 | } | 2568 | } |
2523 | 2569 | ||
2570 | static inline int security_ismaclabel(const char *name) | ||
2571 | { | ||
2572 | return 0; | ||
2573 | } | ||
2574 | |||
2524 | static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) | 2575 | static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) |
2525 | { | 2576 | { |
2526 | return -EOPNOTSUPP; | 2577 | return -EOPNOTSUPP; |
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h index 84ca436b76c2..6d870353674a 100644 --- a/include/linux/sunrpc/sched.h +++ b/include/linux/sunrpc/sched.h | |||
@@ -88,15 +88,6 @@ struct rpc_task { | |||
88 | tk_rebind_retry : 2; | 88 | tk_rebind_retry : 2; |
89 | }; | 89 | }; |
90 | 90 | ||
91 | /* support walking a list of tasks on a wait queue */ | ||
92 | #define task_for_each(task, pos, head) \ | ||
93 | list_for_each(pos, head) \ | ||
94 | if ((task=list_entry(pos, struct rpc_task, u.tk_wait.list)),1) | ||
95 | |||
96 | #define task_for_first(task, head) \ | ||
97 | if (!list_empty(head) && \ | ||
98 | ((task=list_entry((head)->next, struct rpc_task, u.tk_wait.list)),1)) | ||
99 | |||
100 | typedef void (*rpc_action)(struct rpc_task *); | 91 | typedef void (*rpc_action)(struct rpc_task *); |
101 | 92 | ||
102 | struct rpc_call_ops { | 93 | struct rpc_call_ops { |
@@ -238,7 +229,6 @@ struct rpc_task *rpc_wake_up_first(struct rpc_wait_queue *, | |||
238 | bool (*)(struct rpc_task *, void *), | 229 | bool (*)(struct rpc_task *, void *), |
239 | void *); | 230 | void *); |
240 | void rpc_wake_up_status(struct rpc_wait_queue *, int); | 231 | void rpc_wake_up_status(struct rpc_wait_queue *, int); |
241 | int rpc_queue_empty(struct rpc_wait_queue *); | ||
242 | void rpc_delay(struct rpc_task *, unsigned long); | 232 | void rpc_delay(struct rpc_task *, unsigned long); |
243 | void * rpc_malloc(struct rpc_task *, size_t); | 233 | void * rpc_malloc(struct rpc_task *, size_t); |
244 | void rpc_free(void *); | 234 | void rpc_free(void *); |
@@ -259,16 +249,6 @@ static inline int rpc_wait_for_completion_task(struct rpc_task *task) | |||
259 | return __rpc_wait_for_completion_task(task, NULL); | 249 | return __rpc_wait_for_completion_task(task, NULL); |
260 | } | 250 | } |
261 | 251 | ||
262 | static inline void rpc_task_set_priority(struct rpc_task *task, unsigned char prio) | ||
263 | { | ||
264 | task->tk_priority = prio - RPC_PRIORITY_LOW; | ||
265 | } | ||
266 | |||
267 | static inline int rpc_task_has_priority(struct rpc_task *task, unsigned char prio) | ||
268 | { | ||
269 | return (task->tk_priority + RPC_PRIORITY_LOW == prio); | ||
270 | } | ||
271 | |||
272 | #if defined(RPC_DEBUG) || defined (RPC_TRACEPOINTS) | 252 | #if defined(RPC_DEBUG) || defined (RPC_TRACEPOINTS) |
273 | static inline const char * rpc_qname(const struct rpc_wait_queue *q) | 253 | static inline const char * rpc_qname(const struct rpc_wait_queue *q) |
274 | { | 254 | { |