diff options
Diffstat (limited to 'security/capability.c')
| -rw-r--r-- | security/capability.c | 82 |
1 files changed, 81 insertions, 1 deletions
diff --git a/security/capability.c b/security/capability.c index 88f752e8152c..5c700e1a4fd3 100644 --- a/security/capability.c +++ b/security/capability.c | |||
| @@ -308,6 +308,22 @@ static int cap_path_truncate(struct path *path, loff_t length, | |||
| 308 | { | 308 | { |
| 309 | return 0; | 309 | return 0; |
| 310 | } | 310 | } |
| 311 | |||
| 312 | static int cap_path_chmod(struct dentry *dentry, struct vfsmount *mnt, | ||
| 313 | mode_t mode) | ||
| 314 | { | ||
| 315 | return 0; | ||
| 316 | } | ||
| 317 | |||
| 318 | static int cap_path_chown(struct path *path, uid_t uid, gid_t gid) | ||
| 319 | { | ||
| 320 | return 0; | ||
| 321 | } | ||
| 322 | |||
| 323 | static int cap_path_chroot(struct path *root) | ||
| 324 | { | ||
| 325 | return 0; | ||
| 326 | } | ||
| 311 | #endif | 327 | #endif |
| 312 | 328 | ||
| 313 | static int cap_file_permission(struct file *file, int mask) | 329 | static int cap_file_permission(struct file *file, int mask) |
| @@ -373,6 +389,11 @@ static int cap_task_create(unsigned long clone_flags) | |||
| 373 | return 0; | 389 | return 0; |
| 374 | } | 390 | } |
| 375 | 391 | ||
| 392 | static int cap_cred_alloc_blank(struct cred *cred, gfp_t gfp) | ||
| 393 | { | ||
| 394 | return 0; | ||
| 395 | } | ||
| 396 | |||
| 376 | static void cap_cred_free(struct cred *cred) | 397 | static void cap_cred_free(struct cred *cred) |
| 377 | { | 398 | { |
| 378 | } | 399 | } |
| @@ -386,6 +407,10 @@ static void cap_cred_commit(struct cred *new, const struct cred *old) | |||
| 386 | { | 407 | { |
| 387 | } | 408 | } |
| 388 | 409 | ||
| 410 | static void cap_cred_transfer(struct cred *new, const struct cred *old) | ||
| 411 | { | ||
| 412 | } | ||
| 413 | |||
| 389 | static int cap_kernel_act_as(struct cred *new, u32 secid) | 414 | static int cap_kernel_act_as(struct cred *new, u32 secid) |
| 390 | { | 415 | { |
| 391 | return 0; | 416 | return 0; |
| @@ -396,6 +421,11 @@ static int cap_kernel_create_files_as(struct cred *new, struct inode *inode) | |||
| 396 | return 0; | 421 | return 0; |
| 397 | } | 422 | } |
| 398 | 423 | ||
| 424 | static int cap_kernel_module_request(char *kmod_name) | ||
| 425 | { | ||
| 426 | return 0; | ||
| 427 | } | ||
| 428 | |||
| 399 | static int cap_task_setuid(uid_t id0, uid_t id1, uid_t id2, int flags) | 429 | static int cap_task_setuid(uid_t id0, uid_t id1, uid_t id2, int flags) |
| 400 | { | 430 | { |
| 401 | return 0; | 431 | return 0; |
| @@ -701,10 +731,26 @@ static void cap_inet_conn_established(struct sock *sk, struct sk_buff *skb) | |||
| 701 | { | 731 | { |
| 702 | } | 732 | } |
| 703 | 733 | ||
| 734 | |||
| 735 | |||
| 704 | static void cap_req_classify_flow(const struct request_sock *req, | 736 | static void cap_req_classify_flow(const struct request_sock *req, |
| 705 | struct flowi *fl) | 737 | struct flowi *fl) |
| 706 | { | 738 | { |
| 707 | } | 739 | } |
| 740 | |||
| 741 | static int cap_tun_dev_create(void) | ||
| 742 | { | ||
| 743 | return 0; | ||
| 744 | } | ||
| 745 | |||
| 746 | static void cap_tun_dev_post_create(struct sock *sk) | ||
| 747 | { | ||
| 748 | } | ||
| 749 | |||
| 750 | static int cap_tun_dev_attach(struct sock *sk) | ||
| 751 | { | ||
| 752 | return 0; | ||
| 753 | } | ||
| 708 | #endif /* CONFIG_SECURITY_NETWORK */ | 754 | #endif /* CONFIG_SECURITY_NETWORK */ |
| 709 | 755 | ||
| 710 | #ifdef CONFIG_SECURITY_NETWORK_XFRM | 756 | #ifdef CONFIG_SECURITY_NETWORK_XFRM |
| @@ -792,6 +838,20 @@ static void cap_release_secctx(char *secdata, u32 seclen) | |||
| 792 | { | 838 | { |
| 793 | } | 839 | } |
| 794 | 840 | ||
| 841 | static int cap_inode_notifysecctx(struct inode *inode, void *ctx, u32 ctxlen) | ||
| 842 | { | ||
| 843 | return 0; | ||
| 844 | } | ||
| 845 | |||
| 846 | static int cap_inode_setsecctx(struct dentry *dentry, void *ctx, u32 ctxlen) | ||
| 847 | { | ||
| 848 | return 0; | ||
| 849 | } | ||
| 850 | |||
| 851 | static int cap_inode_getsecctx(struct inode *inode, void **ctx, u32 *ctxlen) | ||
| 852 | { | ||
| 853 | return 0; | ||
| 854 | } | ||
| 795 | #ifdef CONFIG_KEYS | 855 | #ifdef CONFIG_KEYS |
| 796 | static int cap_key_alloc(struct key *key, const struct cred *cred, | 856 | static int cap_key_alloc(struct key *key, const struct cred *cred, |
| 797 | unsigned long flags) | 857 | unsigned long flags) |
| @@ -815,6 +875,13 @@ static int cap_key_getsecurity(struct key *key, char **_buffer) | |||
| 815 | return 0; | 875 | return 0; |
| 816 | } | 876 | } |
| 817 | 877 | ||
| 878 | static int cap_key_session_to_parent(const struct cred *cred, | ||
| 879 | const struct cred *parent_cred, | ||
| 880 | struct key *key) | ||
| 881 | { | ||
| 882 | return 0; | ||
| 883 | } | ||
| 884 | |||
| 818 | #endif /* CONFIG_KEYS */ | 885 | #endif /* CONFIG_KEYS */ |
| 819 | 886 | ||
| 820 | #ifdef CONFIG_AUDIT | 887 | #ifdef CONFIG_AUDIT |
| @@ -854,7 +921,7 @@ struct security_operations default_security_ops = { | |||
| 854 | 921 | ||
| 855 | void security_fixup_ops(struct security_operations *ops) | 922 | void security_fixup_ops(struct security_operations *ops) |
| 856 | { | 923 | { |
| 857 | set_to_cap_if_null(ops, ptrace_may_access); | 924 | set_to_cap_if_null(ops, ptrace_access_check); |
| 858 | set_to_cap_if_null(ops, ptrace_traceme); | 925 | set_to_cap_if_null(ops, ptrace_traceme); |
| 859 | set_to_cap_if_null(ops, capget); | 926 | set_to_cap_if_null(ops, capget); |
| 860 | set_to_cap_if_null(ops, capset); | 927 | set_to_cap_if_null(ops, capset); |
| @@ -926,6 +993,9 @@ void security_fixup_ops(struct security_operations *ops) | |||
| 926 | set_to_cap_if_null(ops, path_link); | 993 | set_to_cap_if_null(ops, path_link); |
| 927 | set_to_cap_if_null(ops, path_rename); | 994 | set_to_cap_if_null(ops, path_rename); |
| 928 | set_to_cap_if_null(ops, path_truncate); | 995 | set_to_cap_if_null(ops, path_truncate); |
| 996 | set_to_cap_if_null(ops, path_chmod); | ||
| 997 | set_to_cap_if_null(ops, path_chown); | ||
| 998 | set_to_cap_if_null(ops, path_chroot); | ||
| 929 | #endif | 999 | #endif |
| 930 | set_to_cap_if_null(ops, file_permission); | 1000 | set_to_cap_if_null(ops, file_permission); |
| 931 | set_to_cap_if_null(ops, file_alloc_security); | 1001 | set_to_cap_if_null(ops, file_alloc_security); |
| @@ -940,11 +1010,14 @@ void security_fixup_ops(struct security_operations *ops) | |||
| 940 | set_to_cap_if_null(ops, file_receive); | 1010 | set_to_cap_if_null(ops, file_receive); |
| 941 | set_to_cap_if_null(ops, dentry_open); | 1011 | set_to_cap_if_null(ops, dentry_open); |
| 942 | set_to_cap_if_null(ops, task_create); | 1012 | set_to_cap_if_null(ops, task_create); |
| 1013 | set_to_cap_if_null(ops, cred_alloc_blank); | ||
| 943 | set_to_cap_if_null(ops, cred_free); | 1014 | set_to_cap_if_null(ops, cred_free); |
| 944 | set_to_cap_if_null(ops, cred_prepare); | 1015 | set_to_cap_if_null(ops, cred_prepare); |
| 945 | set_to_cap_if_null(ops, cred_commit); | 1016 | set_to_cap_if_null(ops, cred_commit); |
| 1017 | set_to_cap_if_null(ops, cred_transfer); | ||
| 946 | set_to_cap_if_null(ops, kernel_act_as); | 1018 | set_to_cap_if_null(ops, kernel_act_as); |
| 947 | set_to_cap_if_null(ops, kernel_create_files_as); | 1019 | set_to_cap_if_null(ops, kernel_create_files_as); |
| 1020 | set_to_cap_if_null(ops, kernel_module_request); | ||
| 948 | set_to_cap_if_null(ops, task_setuid); | 1021 | set_to_cap_if_null(ops, task_setuid); |
| 949 | set_to_cap_if_null(ops, task_fix_setuid); | 1022 | set_to_cap_if_null(ops, task_fix_setuid); |
| 950 | set_to_cap_if_null(ops, task_setgid); | 1023 | set_to_cap_if_null(ops, task_setgid); |
| @@ -992,6 +1065,9 @@ void security_fixup_ops(struct security_operations *ops) | |||
| 992 | set_to_cap_if_null(ops, secid_to_secctx); | 1065 | set_to_cap_if_null(ops, secid_to_secctx); |
| 993 | set_to_cap_if_null(ops, secctx_to_secid); | 1066 | set_to_cap_if_null(ops, secctx_to_secid); |
| 994 | set_to_cap_if_null(ops, release_secctx); | 1067 | set_to_cap_if_null(ops, release_secctx); |
| 1068 | set_to_cap_if_null(ops, inode_notifysecctx); | ||
| 1069 | set_to_cap_if_null(ops, inode_setsecctx); | ||
| 1070 | set_to_cap_if_null(ops, inode_getsecctx); | ||
| 995 | #ifdef CONFIG_SECURITY_NETWORK | 1071 | #ifdef CONFIG_SECURITY_NETWORK |
| 996 | set_to_cap_if_null(ops, unix_stream_connect); | 1072 | set_to_cap_if_null(ops, unix_stream_connect); |
| 997 | set_to_cap_if_null(ops, unix_may_send); | 1073 | set_to_cap_if_null(ops, unix_may_send); |
| @@ -1020,6 +1096,9 @@ void security_fixup_ops(struct security_operations *ops) | |||
| 1020 | set_to_cap_if_null(ops, inet_csk_clone); | 1096 | set_to_cap_if_null(ops, inet_csk_clone); |
| 1021 | set_to_cap_if_null(ops, inet_conn_established); | 1097 | set_to_cap_if_null(ops, inet_conn_established); |
| 1022 | set_to_cap_if_null(ops, req_classify_flow); | 1098 | set_to_cap_if_null(ops, req_classify_flow); |
| 1099 | set_to_cap_if_null(ops, tun_dev_create); | ||
| 1100 | set_to_cap_if_null(ops, tun_dev_post_create); | ||
| 1101 | set_to_cap_if_null(ops, tun_dev_attach); | ||
| 1023 | #endif /* CONFIG_SECURITY_NETWORK */ | 1102 | #endif /* CONFIG_SECURITY_NETWORK */ |
| 1024 | #ifdef CONFIG_SECURITY_NETWORK_XFRM | 1103 | #ifdef CONFIG_SECURITY_NETWORK_XFRM |
| 1025 | set_to_cap_if_null(ops, xfrm_policy_alloc_security); | 1104 | set_to_cap_if_null(ops, xfrm_policy_alloc_security); |
| @@ -1038,6 +1117,7 @@ void security_fixup_ops(struct security_operations *ops) | |||
| 1038 | set_to_cap_if_null(ops, key_free); | 1117 | set_to_cap_if_null(ops, key_free); |
| 1039 | set_to_cap_if_null(ops, key_permission); | 1118 | set_to_cap_if_null(ops, key_permission); |
| 1040 | set_to_cap_if_null(ops, key_getsecurity); | 1119 | set_to_cap_if_null(ops, key_getsecurity); |
| 1120 | set_to_cap_if_null(ops, key_session_to_parent); | ||
| 1041 | #endif /* CONFIG_KEYS */ | 1121 | #endif /* CONFIG_KEYS */ |
| 1042 | #ifdef CONFIG_AUDIT | 1122 | #ifdef CONFIG_AUDIT |
| 1043 | set_to_cap_if_null(ops, audit_rule_init); | 1123 | set_to_cap_if_null(ops, audit_rule_init); |
