SOURCES: udev-netlink-owner-check.patch (NEW) - fix for CVE-2009-1185 for u...

hawk hawk at pld-linux.org
Sat Apr 25 14:08:05 CEST 2009


Author: hawk                         Date: Sat Apr 25 12:08:05 2009 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- fix for CVE-2009-1185 for udev 124, taken from Gentoo

---- Files affected:
SOURCES:
   udev-netlink-owner-check.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/udev-netlink-owner-check.patch
diff -u /dev/null SOURCES/udev-netlink-owner-check.patch:1.1
--- /dev/null	Sat Apr 25 14:08:06 2009
+++ SOURCES/udev-netlink-owner-check.patch	Sat Apr 25 14:08:00 2009
@@ -0,0 +1,39 @@
+diff -ruNp udev-124~/udevd.c udev-124/udevd.c
+--- udev-124~/udevd.c	2008-06-11 22:24:30.000000000 -0700
++++ udev-124/udevd.c	2009-04-08 16:30:06.000000000 -0700
+@@ -753,16 +753,34 @@ static struct udevd_uevent_msg *get_netl
+ 	struct udevd_uevent_msg *msg;
+ 	int bufpos;
+ 	ssize_t size;
++	struct sockaddr_nl snl;
++	struct msghdr smsg;
++	struct iovec iov;
+ 	static char buffer[UEVENT_BUFFER_SIZE+512];
+ 	char *pos;
+ 
+-	size = recv(uevent_netlink_sock, &buffer, sizeof(buffer), 0);
++	iov.iov_base = buffer;
++	iov.iov_len = sizeof(buffer);
++
++	memset(&smsg, 0x00, sizeof(struct msghdr));
++	smsg.msg_name = &snl;
++	smsg.msg_namelen = sizeof(struct sockaddr_nl);
++	smsg.msg_iov = &iov;
++	smsg.msg_iovlen = 1;
++
++	size = recvmsg(uevent_netlink_sock, &smsg, 0);
+ 	if (size <  0) {
+ 		if (errno != EINTR)
+ 			err("unable to receive kernel netlink message: %s\n", strerror(errno));
+ 		return NULL;
+ 	}
+ 
++	if ((snl.nl_groups != 1) || (snl.nl_pid != 0)) {
++		info("ignored netlink message from invalid group/sender %d/%d\n",
++		     snl.nl_groups, snl.nl_pid);
++		return NULL;
++	}
++
+ 	if ((size_t)size > sizeof(buffer)-1)
+ 		size = sizeof(buffer)-1;
+ 	buffer[size] = '\0';
================================================================


More information about the pld-cvs-commit mailing list