Skip to contentSkip to conversation

- Copy_to/from_user audit - parisc -RESEND]

parisc-linux Matthew Wilcox 2 participants 2 messages Aug 31, 2003 PA-RISC architecture

lore
Share & tools
lore
#0 lore raw

----- Forwarded message from Ron Gage <[email protected]> -----

From: Ron Gage <[email protected]>
To: [email protected]
Subject: [Patchbomb] - Copy_to/from_user audit - parisc -RESEND
User-Agent: KMail/1.5.2
Errors-To: [email protected]
X-BeenThere: [email protected]
X-Mailman-Version: 2.0.9-sf.net
Precedence: bulk
List-Help: <mailto:[email protected]?subject=help>
List-Post: <mailto:[email protected]>
List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/kernel-janitor-discuss>,
<mailto:[email protected]?subject=subscribe>
List-Id: kernel janitor discussion list <kernel-janitor-discuss.lists.sourceforge.net>
List-Unsubscribe: <https://lists.sourceforge.net/lists/listinfo/kernel-janitor-discuss>,
<mailto:[email protected]?subject=unsubscribe>
List-Archive: <http://sourceforge.net/mailarchive/forum.php?forum=kernel-janitor-discuss>
X-Original-Date: Sun, 31 Aug 2003 11:18:49 -0400
Date: Sun, 31 Aug 2003 11:18:49 -0400

This patch is also available on my ftp server
ftp://new.rongage.org/pub/linux

This patch catches insures proper return values from copy_to/from_user calls.

Ron Gage - Pontiac, MI

arch/parisc/kernel/signal32.c +1 -1
diff -urN linux-2.6.0-test4/arch/parisc/kernel/signal32.c linux-2.6.0-test4-patched/arch/parisc/kernel/signal32.c
@@ -38,7 +38,7 @@
 	if (sz != sizeof *set) panic("put_sigset32()");
 	sigset_64to32(&s, set);
 
-	return copy_to_user(up, &s, sizeof s);
+	return copy_to_user(up, &s, sizeof s) ? -EFAULT : 0 ;
 }
 
 static int
arch/parisc/kernel/sys_parisc.c +1 -1
diff -urN linux-2.6.0-test4/arch/parisc/kernel/sys_parisc.c linux-2.6.0-test4-patched/arch/parisc/kernel/sys_parisc.c
@@ -271,7 +271,7 @@
 	tbuf.shm_cpid = sbuf->shm_cpid;
 	tbuf.shm_lpid = sbuf->shm_lpid;
 	tbuf.shm_nattch = sbuf->shm_nattch;
-	return copy_to_user(buf, &tbuf, sizeof tbuf);
+	return copy_to_user(buf, &tbuf, sizeof tbuf) ? -EFAULT : 0;
 }
 
 int sys_msgctl_broken(int msqid, int cmd, struct msqid_ds *buf)
arch/parisc/kernel/sys_parisc32.c +1 -1
diff -urN linux-2.6.0-test4/arch/parisc/kernel/sys_parisc32.c linux-2.6.0-test4-patched/arch/parisc/kernel/sys_parisc32.c
@@ -370,7 +370,7 @@
 	struct compat_timeval t32;
 	t32.tv_sec = t->tv_sec;
 	t32.tv_usec = t->tv_usec;
-	return copy_to_user(u, &t32, sizeof t32);
+	return copy_to_user(u, &t32, sizeof t32) ? -EFAULT : 0 ;
 }
 
 static int

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Kernel-janitor-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kernel-janitor-discuss

----- End forwarded message -----

Signature · 3 lines
"It's not Hollywood.  War is real, war is primarily not about defeat or
victory, it is about death.  I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk
#1 lore raw
Quoted 2 lines

This patch catches insures proper return values from copy_to/from_user calls.

um, some of these are not quite correct.

arch/parisc/kernel/signal32.c line 42

Quoted 8 lines

+++ linux-2.6.0-test4-patched/arch/parisc/kernel/signal32.c 2003-08-29 21:38:02.000000000 -0400

arch/parisc/kernel/signal32.c +1 -1
@@ -38,7 +38,7 @@
 	if (sz != sizeof *set) panic("put_sigset32()");
 	sigset_64to32(&s, set);
 
-	return copy_to_user(up, &s, sizeof s);
+	return copy_to_user(up, &s, sizeof s) ? -EFAULT : 0 ;
 }

this one is for put_sigset32, which is used like this:

        if (!ret && oset && put_sigset32(oset, &old_set, sigsetsize))
                return -EFAULT;

so your patch is not needed.

arch/parisc/kernel/sys_parisc32.c line 374

Quoted 9 lines
arch/parisc/kernel/sys_parisc32.c +1 -1
@@ -370,7 +370,7 @@
 	struct compat_timeval t32;
 	t32.tv_sec = t->tv_sec;
 	t32.tv_usec = t->tv_usec;
-	return copy_to_user(u, &t32, sizeof t32);
+	return copy_to_user(u, &t32, sizeof t32) ? -EFAULT : 0 ;
 }

this one is similar.

arch/parisc/kernel/sys_parisc.c line 277

Quoted 13 lines
arch/parisc/kernel/sys_parisc32.c +0 -0
 static int

diff -urN linux-2.6.0-test4/arch/parisc/kernel/sys_parisc.c linux-2.6.0-test4-patched/arch/parisc/kernel/sys_parisc.c

arch/parisc/kernel/sys_parisc.c +1 -1
@@ -271,7 +271,7 @@
 	tbuf.shm_cpid = sbuf->shm_cpid;
 	tbuf.shm_lpid = sbuf->shm_lpid;
 	tbuf.shm_nattch = sbuf->shm_nattch;
-	return copy_to_user(buf, &tbuf, sizeof tbuf);
+	return copy_to_user(buf, &tbuf, sizeof tbuf) ? -EFAULT : 0;
 }
 
 int sys_msgctl_broken(int msqid, int cmd, struct msqid_ds *buf)

this one seems correct. i'll apply it to the parisc tree.

thx
randolph

Signature · 3 lines
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/