Skip to content

Commit 077cee2

Browse files
committed
In metrics:
* Require that netlink messages come from the kernel, not from userspace. Patch by Nelson Elhage.
1 parent f78d6e3 commit 077cee2

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

debathena/metrics/connector.pyx

+8-6
Original file line numberDiff line numberDiff line change
@@ -270,14 +270,16 @@ cdef class Connector:
270270
cdef proc_event *ev
271271
cdef object ret
272272

273-
from_addr.nl_family = AF_NETLINK
274-
from_addr.nl_groups = CN_IDX_PROC
275-
from_addr.nl_pid = 1
276273
s = sizeof(from_addr)
277274

278-
if recvfrom(self.sock, buf, sizeof(buf), 0,
279-
<sockaddr *>&from_addr, &s) == -1:
280-
raise IOError(errno, strerror(errno))
275+
while True:
276+
if recvfrom(self.sock, buf, sizeof(buf), 0,
277+
<sockaddr *>&from_addr, &s) == -1:
278+
raise IOError(errno, strerror(errno))
279+
280+
if from_addr.nl_pid != 0:
281+
# Ignore messages that don't come from the kernel
282+
continue
281283

282284
ev = <proc_event *>((<cn_msg *>NLMSG_DATA(buf)).data)
283285

debian/changelog

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
debathena-metrics (1.6) unstable; urgency=low
2+
3+
* Require that netlink messages come from the kernel, not from userspace.
4+
Patch by Nelson Elhage.
5+
6+
-- Geoffrey Thomas <geofft@mit.edu> Wed, 02 Mar 2011 20:02:12 -0500
7+
18
debathena-metrics (1.5.1) unstable; urgency=low
29

310
* Update the blacklist

0 commit comments

Comments
 (0)