aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/audit.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-09-07 16:12:54 -0400
committerDavid S. Miller <davem@davemloft.net>2012-09-10 15:30:41 -0400
commit15e473046cb6e5d18a4d0057e61d76315230382b (patch)
tree893d2df5d46a6ce156933ac57a1398f0ad22b889 /kernel/audit.c
parent9f00d9776bc5beb92e8bfc884a7e96ddc5589e2e (diff)
netlink: Rename pid to portid to avoid confusion
It is a frequent mistake to confuse the netlink port identifier with a process identifier. Try to reduce this confusion by renaming fields that hold port identifiers portid instead of pid. I have carefully avoided changing the structures exported to userspace to avoid changing the userspace API. I have successfully built an allyesconfig kernel with this change. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> Acked-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'kernel/audit.c')
-rw-r--r--kernel/audit.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/kernel/audit.c b/kernel/audit.c
index a24aafa850a..e0cf64a0ae2 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -87,11 +87,11 @@ static int audit_failure = AUDIT_FAIL_PRINTK;
87 87
88/* 88/*
89 * If audit records are to be written to the netlink socket, audit_pid 89 * If audit records are to be written to the netlink socket, audit_pid
90 * contains the pid of the auditd process and audit_nlk_pid contains 90 * contains the pid of the auditd process and audit_nlk_portid contains
91 * the pid to use to send netlink messages to that process. 91 * the portid to use to send netlink messages to that process.
92 */ 92 */
93int audit_pid; 93int audit_pid;
94static int audit_nlk_pid; 94static int audit_nlk_portid;
95 95
96/* If audit_rate_limit is non-zero, limit the rate of sending audit records 96/* If audit_rate_limit is non-zero, limit the rate of sending audit records
97 * to that number per second. This prevents DoS attacks, but results in 97 * to that number per second. This prevents DoS attacks, but results in
@@ -401,7 +401,7 @@ static void kauditd_send_skb(struct sk_buff *skb)
401 int err; 401 int err;
402 /* take a reference in case we can't send it and we want to hold it */ 402 /* take a reference in case we can't send it and we want to hold it */
403 skb_get(skb); 403 skb_get(skb);
404 err = netlink_unicast(audit_sock, skb, audit_nlk_pid, 0); 404 err = netlink_unicast(audit_sock, skb, audit_nlk_portid, 0);
405 if (err < 0) { 405 if (err < 0) {
406 BUG_ON(err != -ECONNREFUSED); /* Shouldn't happen */ 406 BUG_ON(err != -ECONNREFUSED); /* Shouldn't happen */
407 printk(KERN_ERR "audit: *NO* daemon at audit_pid=%d\n", audit_pid); 407 printk(KERN_ERR "audit: *NO* daemon at audit_pid=%d\n", audit_pid);
@@ -692,7 +692,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
692 status_set.backlog_limit = audit_backlog_limit; 692 status_set.backlog_limit = audit_backlog_limit;
693 status_set.lost = atomic_read(&audit_lost); 693 status_set.lost = atomic_read(&audit_lost);
694 status_set.backlog = skb_queue_len(&audit_skb_queue); 694 status_set.backlog = skb_queue_len(&audit_skb_queue);
695 audit_send_reply(NETLINK_CB(skb).pid, seq, AUDIT_GET, 0, 0, 695 audit_send_reply(NETLINK_CB(skb).portid, seq, AUDIT_GET, 0, 0,
696 &status_set, sizeof(status_set)); 696 &status_set, sizeof(status_set));
697 break; 697 break;
698 case AUDIT_SET: 698 case AUDIT_SET:
@@ -720,7 +720,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
720 sessionid, sid, 1); 720 sessionid, sid, 1);
721 721
722 audit_pid = new_pid; 722 audit_pid = new_pid;
723 audit_nlk_pid = NETLINK_CB(skb).pid; 723 audit_nlk_portid = NETLINK_CB(skb).portid;
724 } 724 }
725 if (status_get->mask & AUDIT_STATUS_RATE_LIMIT) { 725 if (status_get->mask & AUDIT_STATUS_RATE_LIMIT) {
726 err = audit_set_rate_limit(status_get->rate_limit, 726 err = audit_set_rate_limit(status_get->rate_limit,
@@ -782,7 +782,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
782 } 782 }
783 /* fallthrough */ 783 /* fallthrough */
784 case AUDIT_LIST: 784 case AUDIT_LIST:
785 err = audit_receive_filter(msg_type, NETLINK_CB(skb).pid, 785 err = audit_receive_filter(msg_type, NETLINK_CB(skb).portid,
786 uid, seq, data, nlmsg_len(nlh), 786 uid, seq, data, nlmsg_len(nlh),
787 loginuid, sessionid, sid); 787 loginuid, sessionid, sid);
788 break; 788 break;
@@ -801,7 +801,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
801 } 801 }
802 /* fallthrough */ 802 /* fallthrough */
803 case AUDIT_LIST_RULES: 803 case AUDIT_LIST_RULES:
804 err = audit_receive_filter(msg_type, NETLINK_CB(skb).pid, 804 err = audit_receive_filter(msg_type, NETLINK_CB(skb).portid,
805 uid, seq, data, nlmsg_len(nlh), 805 uid, seq, data, nlmsg_len(nlh),
806 loginuid, sessionid, sid); 806 loginuid, sessionid, sid);
807 break; 807 break;
@@ -872,7 +872,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
872 memcpy(sig_data->ctx, ctx, len); 872 memcpy(sig_data->ctx, ctx, len);
873 security_release_secctx(ctx, len); 873 security_release_secctx(ctx, len);
874 } 874 }
875 audit_send_reply(NETLINK_CB(skb).pid, seq, AUDIT_SIGNAL_INFO, 875 audit_send_reply(NETLINK_CB(skb).portid, seq, AUDIT_SIGNAL_INFO,
876 0, 0, sig_data, sizeof(*sig_data) + len); 876 0, 0, sig_data, sizeof(*sig_data) + len);
877 kfree(sig_data); 877 kfree(sig_data);
878 break; 878 break;
@@ -891,7 +891,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
891 rcu_read_unlock(); 891 rcu_read_unlock();
892 892
893 if (!err) 893 if (!err)
894 audit_send_reply(NETLINK_CB(skb).pid, seq, 894 audit_send_reply(NETLINK_CB(skb).portid, seq,
895 AUDIT_TTY_GET, 0, 0, &s, sizeof(s)); 895 AUDIT_TTY_GET, 0, 0, &s, sizeof(s));
896 break; 896 break;
897 } 897 }