aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDarrel Goeddel <dgoeddel@trustedcs.com>2006-06-27 16:26:11 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-06-29 19:57:55 -0400
commitc7bdb545d23026b18be53289fd866d1ac07f5f8c (patch)
tree6d9a218871d88f7579dd53f14692df2529b6e712 /include
parent576a30eb6453439b3c37ba24455ac7090c247b5a (diff)
[NETLINK]: Encapsulate eff_cap usage within security framework.
This patch encapsulates the usage of eff_cap (in netlink_skb_params) within the security framework by extending security_netlink_recv to include a required capability parameter and converting all direct usage of eff_caps outside of the lsm modules to use the interface. It also updates the SELinux implementation of the security_netlink_send and security_netlink_recv hooks to take advantage of the sid in the netlink_skb_params struct. This also enables SELinux to perform auditing of netlink capability checks. Please apply, for 2.6.18 if possible. Signed-off-by: Darrel Goeddel <dgoeddel@trustedcs.com> Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov> Acked-by: James Morris <jmorris@namei.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/linux/security.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/include/linux/security.h b/include/linux/security.h
index 51805806f974..c7ea15716dce 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -67,7 +67,7 @@ struct xfrm_state;
67struct xfrm_user_sec_ctx; 67struct xfrm_user_sec_ctx;
68 68
69extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb); 69extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb);
70extern int cap_netlink_recv(struct sk_buff *skb); 70extern int cap_netlink_recv(struct sk_buff *skb, int cap);
71 71
72/* 72/*
73 * Values used in the task_security_ops calls 73 * Values used in the task_security_ops calls
@@ -656,6 +656,7 @@ struct swap_info_struct;
656 * Check permission before processing the received netlink message in 656 * Check permission before processing the received netlink message in
657 * @skb. 657 * @skb.
658 * @skb contains the sk_buff structure for the netlink message. 658 * @skb contains the sk_buff structure for the netlink message.
659 * @cap indicates the capability required
659 * Return 0 if permission is granted. 660 * Return 0 if permission is granted.
660 * 661 *
661 * Security hooks for Unix domain networking. 662 * Security hooks for Unix domain networking.
@@ -1266,7 +1267,7 @@ struct security_operations {
1266 struct sembuf * sops, unsigned nsops, int alter); 1267 struct sembuf * sops, unsigned nsops, int alter);
1267 1268
1268 int (*netlink_send) (struct sock * sk, struct sk_buff * skb); 1269 int (*netlink_send) (struct sock * sk, struct sk_buff * skb);
1269 int (*netlink_recv) (struct sk_buff * skb); 1270 int (*netlink_recv) (struct sk_buff * skb, int cap);
1270 1271
1271 /* allow module stacking */ 1272 /* allow module stacking */
1272 int (*register_security) (const char *name, 1273 int (*register_security) (const char *name,
@@ -2032,9 +2033,9 @@ static inline int security_netlink_send(struct sock *sk, struct sk_buff * skb)
2032 return security_ops->netlink_send(sk, skb); 2033 return security_ops->netlink_send(sk, skb);
2033} 2034}
2034 2035
2035static inline int security_netlink_recv(struct sk_buff * skb) 2036static inline int security_netlink_recv(struct sk_buff * skb, int cap)
2036{ 2037{
2037 return security_ops->netlink_recv(skb); 2038 return security_ops->netlink_recv(skb, cap);
2038} 2039}
2039 2040
2040/* prototypes */ 2041/* prototypes */
@@ -2670,9 +2671,9 @@ static inline int security_netlink_send (struct sock *sk, struct sk_buff *skb)
2670 return cap_netlink_send (sk, skb); 2671 return cap_netlink_send (sk, skb);
2671} 2672}
2672 2673
2673static inline int security_netlink_recv (struct sk_buff *skb) 2674static inline int security_netlink_recv (struct sk_buff *skb, int cap)
2674{ 2675{
2675 return cap_netlink_recv (skb); 2676 return cap_netlink_recv (skb, cap);
2676} 2677}
2677 2678
2678static inline struct dentry *securityfs_create_dir(const char *name, 2679static inline struct dentry *securityfs_create_dir(const char *name,