login
Login
/
Register
Search
Search this site:
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2008
»
March
»
17
Re: Audit vs netlink interaction problem
view
thread
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
[view in full thread]
From: Pavel Emelyanov
Subject:
Re: Audit vs netlink interaction problem
Date: Monday, March 17, 2008 - 1:01 am
Thomas Graf wrote:
quoted text
> * Thomas Graf <tgraf@suug.ch> 2008-03-14 19:29 >> * Pavel Emelyanov <xemul@openvz.org> 2008-03-14 20:05 >>> Hmmm... I'm afraid, that this can break the audit filtering and signal >>> auditing. I haven't yet looked deep into it, but it compares the >>> task->tgid with this audit_pid for different purposes. If audit_pid >>> changes this code will be broken. >> OK, then both pids have to be stored. audit_pid remains as-is but is >> no longer used as destination netlink pid. A second pid is stored and >> updated whenever a netlink message is received from userspace. > > The following patch represents what I mean. Untested!
Looks great, all the more so I created very similar patch. David, can we have this in mainline some day? Thanks, Pavel
quoted text
> Index: net-2.6.26/kernel/audit.c > =================================================================== > --- net-2.6.26.orig/kernel/audit.c 2008-03-14 19:31:53.000000000 +0100 > +++ net-2.6.26/kernel/audit.c 2008-03-14 19:38:35.000000000 +0100 > @@ -82,6 +82,9 @@ > * contains the (non-zero) pid. */ > int audit_pid; > > +/* Actual netlink pid of the userspace process */ > +static int audit_nlk_pid; > + > /* If audit_rate_limit is non-zero, limit the rate of sending audit records > * to that number per second. This prevents DoS attacks, but results in > * audit records being dropped. */ > @@ -347,12 +350,12 @@ > skb = skb_dequeue(&audit_skb_queue); > wake_up(&audit_backlog_wait); > if (skb) { > - if (audit_pid) { > - int err = netlink_unicast(audit_sock, skb, audit_pid, 0); > + if (audit_nlk_pid) { > + int err = netlink_unicast(audit_sock, skb, audit_nlk_pid, 0); > if (err < 0) { > BUG_ON(err != -ECONNREFUSED); /* Shoudn't happen */ > - printk(KERN_ERR "audit: *NO* daemon at audit_pid=%d\n", audit_pid); > - audit_pid = 0; > + printk(KERN_ERR "audit: *NO* daemon at audit_nlk_pid=%d\n", audit_nlk_pid); > + audit_nlk_pid = 0; > } > } else { > if (printk_ratelimit()) > @@ -623,6 +626,12 @@ > sid, 1); > > audit_pid = new_pid; > + > + /* > + * Netlink pid is only updated here to avoid overwrites > + * from potential processes only querying the interface. > + */ > + audit_nlk_pid = NETLINK_CB(skb).pid; > } > if (status_get->mask & AUDIT_STATUS_RATE_LIMIT) > err = audit_set_rate_limit(status_get->rate_limit, > @@ -1350,7 +1359,7 @@ > if (!audit_rate_check()) { > audit_log_lost("rate limit exceeded"); > } else { > - if (audit_pid) { > + if (audit_nlk_pid) { > struct nlmsghdr *nlh = nlmsg_hdr(ab->skb); > nlh->nlmsg_len = ab->skb->len - NLMSG_SPACE(0); > skb_queue_tail(&audit_skb_queue, ab->skb); >
--
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
Messages in current thread:
Audit vs netlink interaction problem
, Pavel Emelyanov
, (Fri Mar 14, 9:22 am)
Re: Audit vs netlink interaction problem
, Thomas Graf
, (Fri Mar 14, 9:39 am)
Re: Audit vs netlink interaction problem
, Pavel Emelyanov
, (Fri Mar 14, 10:05 am)
Re: Audit vs netlink interaction problem
, Thomas Graf
, (Fri Mar 14, 11:29 am)
Re: Audit vs netlink interaction problem
, Thomas Graf
, (Fri Mar 14, 11:40 am)
Re: Audit vs netlink interaction problem
, Pavel Emelyanov
, (Mon Mar 17, 12:59 am)
Re: Audit vs netlink interaction problem
, Pavel Emelyanov
, (Mon Mar 17, 1:01 am)
Re: Audit vs netlink interaction problem
, Eric Paris
, (Mon Mar 17, 12:41 pm)
Navigation
Create content
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Greg Kroah-Hartman
[PATCH 20/36] Driver core: Call device_pm_add() after bus_add_device() in device_a...
Peter Zijlstra
Re: divide by zero bug in find_busiest_group
Tejun Heo
Re: [PATCH] block: use jiffies conversion functions in scsi_ioctl.c
Balbir Singh
Re: [RFC][PATCH] page reclaim throttle take2
David Miller
Re: [PATCHv2] uwb: use '%pM' format to print MAC address
git
:
Stephen R. van den Berg
Re: [RFC] origin link for cherry-pick and revert
Christian Stimming
git-gui: Fix broken revert confirmation.
Junio C Hamano
Re: git-svnimport
Anuj Gakhar
Git Architecture Question
Johannes Schindelin
Re: [PATCH] Fix approxidate("never") to always return 0
git-commits-head
:
Linux Kernel Mailing List
ath9k_htc: Allocate URBs properly
Linux Kernel Mailing List
[ARM] dma: use new dmabounce_sync_for_xxx() for dma_sync_single_xxx()
Linux Kernel Mailing List
MIPS: Cavium: Remove unused watchdog code.
Linux Kernel Mailing List
V4L/DVB (8976): af9015: Add USB ID for AVerMedia A309
Linux Kernel Mailing List
ARM: 5670/1: bcmring: add default configuration for bcmring arch
linux-netdev
:
Gerrit Renker
v2 [PATCH 1/4] dccp: Limit feature negotiation to connection setup phase
Daniel Lezcano
getsockopt(TCP_DEFER_ACCEPT) value change
David Miller
Re: 2.6.27.18: bnx2/tg3: BUG: "scheduling while atomic" trying to ifenslave a seco...
Ingo Molnar
Re: [regression] nf_iterate(), BUG: unable to handle kernel NULL pointer dereference
Gerrit Renker
[PATCH 37/37] dccp: Debugging functions for feature negotiation
openbsd-misc
:
Christophe Rioux
Implementation example of snmp
Ryan McBride
Re: Packets Per Second Limit?
Nick Holland
Re: booting openbsd on eee without cd-rom
Bryan Irvine
Re: OpenBSD 4.7 Released, May 19 2010
Jacob Yocom-Piatt
Re: Same shit all over again
Colocation donated by:
Syndicate