diff options
Diffstat (limited to 'include/linux/security.h')
| -rw-r--r-- | include/linux/security.h | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/include/linux/security.h b/include/linux/security.h index f75303831d09..6bc2aad494ff 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
| @@ -1109,6 +1109,16 @@ struct swap_info_struct; | |||
| 1109 | * @name contains the name of the security module being unstacked. | 1109 | * @name contains the name of the security module being unstacked. |
| 1110 | * @ops contains a pointer to the struct security_operations of the module to unstack. | 1110 | * @ops contains a pointer to the struct security_operations of the module to unstack. |
| 1111 | * | 1111 | * |
| 1112 | * @secid_to_secctx: | ||
| 1113 | * Convert secid to security context. | ||
| 1114 | * @secid contains the security ID. | ||
| 1115 | * @secdata contains the pointer that stores the converted security context. | ||
| 1116 | * | ||
| 1117 | * @release_secctx: | ||
| 1118 | * Release the security context. | ||
| 1119 | * @secdata contains the security context. | ||
| 1120 | * @seclen contains the length of the security context. | ||
| 1121 | * | ||
| 1112 | * This is the main security structure. | 1122 | * This is the main security structure. |
| 1113 | */ | 1123 | */ |
| 1114 | struct security_operations { | 1124 | struct security_operations { |
| @@ -1289,6 +1299,8 @@ struct security_operations { | |||
| 1289 | 1299 | ||
| 1290 | int (*getprocattr)(struct task_struct *p, char *name, void *value, size_t size); | 1300 | int (*getprocattr)(struct task_struct *p, char *name, void *value, size_t size); |
| 1291 | int (*setprocattr)(struct task_struct *p, char *name, void *value, size_t size); | 1301 | int (*setprocattr)(struct task_struct *p, char *name, void *value, size_t size); |
| 1302 | int (*secid_to_secctx)(u32 secid, char **secdata, u32 *seclen); | ||
| 1303 | void (*release_secctx)(char *secdata, u32 seclen); | ||
| 1292 | 1304 | ||
| 1293 | #ifdef CONFIG_SECURITY_NETWORK | 1305 | #ifdef CONFIG_SECURITY_NETWORK |
| 1294 | int (*unix_stream_connect) (struct socket * sock, | 1306 | int (*unix_stream_connect) (struct socket * sock, |
| @@ -1317,7 +1329,7 @@ struct security_operations { | |||
| 1317 | int (*socket_shutdown) (struct socket * sock, int how); | 1329 | int (*socket_shutdown) (struct socket * sock, int how); |
| 1318 | int (*socket_sock_rcv_skb) (struct sock * sk, struct sk_buff * skb); | 1330 | int (*socket_sock_rcv_skb) (struct sock * sk, struct sk_buff * skb); |
| 1319 | int (*socket_getpeersec_stream) (struct socket *sock, char __user *optval, int __user *optlen, unsigned len); | 1331 | int (*socket_getpeersec_stream) (struct socket *sock, char __user *optval, int __user *optlen, unsigned len); |
| 1320 | int (*socket_getpeersec_dgram) (struct sk_buff *skb, char **secdata, u32 *seclen); | 1332 | int (*socket_getpeersec_dgram) (struct socket *sock, struct sk_buff *skb, u32 *secid); |
| 1321 | int (*sk_alloc_security) (struct sock *sk, int family, gfp_t priority); | 1333 | int (*sk_alloc_security) (struct sock *sk, int family, gfp_t priority); |
| 1322 | void (*sk_free_security) (struct sock *sk); | 1334 | void (*sk_free_security) (struct sock *sk); |
| 1323 | unsigned int (*sk_getsid) (struct sock *sk, struct flowi *fl, u8 dir); | 1335 | unsigned int (*sk_getsid) (struct sock *sk, struct flowi *fl, u8 dir); |
| @@ -2059,6 +2071,16 @@ static inline int security_netlink_recv(struct sk_buff * skb, int cap) | |||
| 2059 | return security_ops->netlink_recv(skb, cap); | 2071 | return security_ops->netlink_recv(skb, cap); |
| 2060 | } | 2072 | } |
| 2061 | 2073 | ||
| 2074 | static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) | ||
| 2075 | { | ||
| 2076 | return security_ops->secid_to_secctx(secid, secdata, seclen); | ||
| 2077 | } | ||
| 2078 | |||
| 2079 | static inline void security_release_secctx(char *secdata, u32 seclen) | ||
| 2080 | { | ||
| 2081 | return security_ops->release_secctx(secdata, seclen); | ||
| 2082 | } | ||
| 2083 | |||
| 2062 | /* prototypes */ | 2084 | /* prototypes */ |
| 2063 | extern int security_init (void); | 2085 | extern int security_init (void); |
| 2064 | extern int register_security (struct security_operations *ops); | 2086 | extern int register_security (struct security_operations *ops); |
| @@ -2725,6 +2747,14 @@ static inline void securityfs_remove(struct dentry *dentry) | |||
| 2725 | { | 2747 | { |
| 2726 | } | 2748 | } |
| 2727 | 2749 | ||
| 2750 | static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) | ||
| 2751 | { | ||
| 2752 | return -EOPNOTSUPP; | ||
| 2753 | } | ||
| 2754 | |||
| 2755 | static inline void security_release_secctx(char *secdata, u32 seclen) | ||
| 2756 | { | ||
| 2757 | } | ||
| 2728 | #endif /* CONFIG_SECURITY */ | 2758 | #endif /* CONFIG_SECURITY */ |
| 2729 | 2759 | ||
| 2730 | #ifdef CONFIG_SECURITY_NETWORK | 2760 | #ifdef CONFIG_SECURITY_NETWORK |
| @@ -2840,10 +2870,9 @@ static inline int security_socket_getpeersec_stream(struct socket *sock, char __ | |||
| 2840 | return security_ops->socket_getpeersec_stream(sock, optval, optlen, len); | 2870 | return security_ops->socket_getpeersec_stream(sock, optval, optlen, len); |
| 2841 | } | 2871 | } |
| 2842 | 2872 | ||
| 2843 | static inline int security_socket_getpeersec_dgram(struct sk_buff *skb, char **secdata, | 2873 | static inline int security_socket_getpeersec_dgram(struct socket *sock, struct sk_buff *skb, u32 *secid) |
| 2844 | u32 *seclen) | ||
| 2845 | { | 2874 | { |
| 2846 | return security_ops->socket_getpeersec_dgram(skb, secdata, seclen); | 2875 | return security_ops->socket_getpeersec_dgram(sock, skb, secid); |
| 2847 | } | 2876 | } |
| 2848 | 2877 | ||
| 2849 | static inline int security_sk_alloc(struct sock *sk, int family, gfp_t priority) | 2878 | static inline int security_sk_alloc(struct sock *sk, int family, gfp_t priority) |
| @@ -2968,8 +2997,7 @@ static inline int security_socket_getpeersec_stream(struct socket *sock, char __ | |||
| 2968 | return -ENOPROTOOPT; | 2997 | return -ENOPROTOOPT; |
| 2969 | } | 2998 | } |
| 2970 | 2999 | ||
| 2971 | static inline int security_socket_getpeersec_dgram(struct sk_buff *skb, char **secdata, | 3000 | static inline int security_socket_getpeersec_dgram(struct socket *sock, struct sk_buff *skb, u32 *secid) |
| 2972 | u32 *seclen) | ||
| 2973 | { | 3001 | { |
| 2974 | return -ENOPROTOOPT; | 3002 | return -ENOPROTOOPT; |
| 2975 | } | 3003 | } |
