Linux MIPS Architecture development
 help / color / mirror / Atom feed
* sys32_execve fix
@ 2002-07-22 13:52 Carsten Langgaard
  2002-07-22 14:46 ` Carsten Langgaard
  2002-07-22 16:56 ` Maciej W. Rozycki
  0 siblings, 2 replies; 6+ messages in thread
From: Carsten Langgaard @ 2002-07-22 13:52 UTC (permalink / raw)
  To: Ralf Baechle, Maciej W. Rozycki, linux-mips

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

The following test fails on the 64-bit kernel:

#include <unistd.h>
#include <errno.h>

main(void)
{
        int ret;

        ret = execve("/bin/ls", NULL, NULL);
        printf("ret = %d, errno = %d\n", ret, errno);
}


The problem is that "nargs" in arch/mips64/kernel/linux32.c fails when
argv is NULL, the patch below should fix the problem:

/Carsten



--
_    _ ____  ___   Carsten Langgaard   Mailto:carstenl@mips.com
|\  /|||___)(___   MIPS Denmark        Direct: +45 4486 5527
| \/ |||    ____)  Lautrupvang 4B      Switch: +45 4486 5555
  TECHNOLOGIES     2750 Ballerup       Fax...: +45 4486 5556
                   Denmark             http://www.mips.com



[-- Attachment #2: linux32.patch --]
[-- Type: text/plain, Size: 777 bytes --]

Index: arch/mips64/kernel/linux32.c
===================================================================
RCS file: /cvs/linux/arch/mips64/kernel/linux32.c,v
retrieving revision 1.42.2.6
diff -u -r1.42.2.6 linux32.c
--- arch/mips64/kernel/linux32.c	2002/07/01 00:17:14	1.42.2.6
+++ arch/mips64/kernel/linux32.c	2002/07/22 13:49:33
@@ -411,12 +411,14 @@
 	int n, ret;
 
 	n = 0;
+	ptr = NULL;
 	do {
 		/* egcs is stupid */
 		if (!access_ok(VERIFY_READ, arg, sizeof (unsigned int)))
 			return -EFAULT;
-		if (IS_ERR(ret = __get_user((long)ptr,(int *)A(arg))))
-			return ret;
+		if (arg)
+			if (IS_ERR(ret = __get_user((long)ptr,(int *)A(arg))))
+				return ret;
 		if (ap)		/* no access_ok needed, we allocated */
 			if (IS_ERR(ret = __put_user(ptr, ap++)))
 				return ret;

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

end of thread, other threads:[~2002-07-23 12:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-07-22 13:52 sys32_execve fix Carsten Langgaard
2002-07-22 14:46 ` Carsten Langgaard
2002-07-23  9:19   ` Carsten Langgaard
2002-07-23 11:39     ` Ralf Baechle
2002-07-22 16:56 ` Maciej W. Rozycki
2002-07-22 18:36   ` Ralf Baechle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox