netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Problem with recent CMSG_COMPAT_OK fix
@ 2005-01-04 16:59 Olaf Kirch
  2005-01-10 20:52 ` David S. Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Olaf Kirch @ 2005-01-04 16:59 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev

[-- Attachment #1: Type: text/plain, Size: 1010 bytes --]

Hi,

The recent fixes for cmsg_len handling seem to break 32bit compatibility
at least on x86_64. The new CMSG_COMPAT_OK macro requires that cmsg_len
is greater or equal the size of struct cmsghdr, which is the 64bit
version of the struct.  The code should really check against the size
of struct compat_cmsghdr.

Signed-off-by: Olaf Kirch <okir@suse.de>

--- linux-2.6.10/net/compat.c.orig	2005-01-04 13:51:49.000000000 +0100
+++ linux-2.6.10/net/compat.c	2005-01-04 16:53:38.000000000 +0100
@@ -125,7 +125,7 @@
 	 (struct compat_cmsghdr __user *)NULL)
 
 #define CMSG_COMPAT_OK(ucmlen, ucmsg, mhdr) \
-	((ucmlen) >= sizeof(struct cmsghdr) && \
+	((ucmlen) >= sizeof(struct compat_cmsghdr) && \
 	 (ucmlen) <= (unsigned long) \
 	 ((mhdr)->msg_controllen - \
 	  ((char *)(ucmsg) - (char *)(mhdr)->msg_control)))

-- 
Olaf Kirch     | Things that make Monday morning interesting, #2:
okir@suse.de   |        "We have 8,000 NFS mount points, why do we keep
---------------+ 	 running out of privileged ports?"

[-- Attachment #2: cmsg-compat-signedness-fix-fix --]
[-- Type: text/plain, Size: 921 bytes --]

From: Olaf Kirch <okir@suse.de>
Subject: Fix cmsg_len checks in 32bit compat mode
References: 49517 - LTC13227

The recent fixes for cmsg_len handling seem to break 32bit compatibility
at least on x86_64. The new CMSG_COMPAT_OK macro requires that cmsg_len
is greater or equal the size of struct cmsghdr, which is the 64bit
version of the struct.  The code should really check against the size
of struct compat_cmsghdr.

Signed-off-by: Olaf Kirch <okir@suse.de>

--- linux-2.6.10/net/compat.c.orig	2005-01-04 13:51:49.000000000 +0100
+++ linux-2.6.10/net/compat.c	2005-01-04 16:53:38.000000000 +0100
@@ -125,7 +125,7 @@
 	 (struct compat_cmsghdr __user *)NULL)
 
 #define CMSG_COMPAT_OK(ucmlen, ucmsg, mhdr) \
-	((ucmlen) >= sizeof(struct cmsghdr) && \
+	((ucmlen) >= sizeof(struct compat_cmsghdr) && \
 	 (ucmlen) <= (unsigned long) \
 	 ((mhdr)->msg_controllen - \
 	  ((char *)(ucmsg) - (char *)(mhdr)->msg_control)))

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-01-10 20:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-04 16:59 [PATCH] Problem with recent CMSG_COMPAT_OK fix Olaf Kirch
2005-01-10 20:52 ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).