All of lore.kernel.org
 help / color / mirror / Atom feed
From: Carsten Langgaard <carstenl@mips.com>
To: Ralf Baechle <ralf@uni-koblenz.de>,
	"Maciej W. Rozycki" <macro@ds2.pg.gda.pl>,
	linux-mips@oss.sgi.com
Subject: Re: sys32_execve fix
Date: Mon, 22 Jul 2002 16:46:44 +0200	[thread overview]
Message-ID: <3D3C1ACB.E7D17386@mips.com> (raw)
In-Reply-To: 3D3C0E26.676F4799@mips.com

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

I just found another problem in the linux32.c file.
I believe the "flock32" structure has been copied from other architecture, but we
are little bit different, so it need a fix.
The patch below should fix that problem, please notice it also include the
previous patch I send.

Maybe it would be even better to put the "flock32" structure definition in
include/asm-mips64/fcntl.h instead.

/Carsten



Carsten Langgaard wrote:

> 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
>
>   ------------------------------------------------------------------------
> 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;

--
_    _ ____  ___   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: 1021 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 14:40:04
@@ -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;
@@ -1406,8 +1408,9 @@
 	short l_whence;
 	__kernel_off_t32 l_start;
 	__kernel_off_t32 l_len;
+	int  l_sysid;
 	__kernel_pid_t32 l_pid;
-	short __unused;
+	int  pad[4];
 };
 
 static inline int get_flock(struct flock *kfl, struct flock32 *ufl)

  reply	other threads:[~2002-07-22 14:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-22 13:52 sys32_execve fix Carsten Langgaard
2002-07-22 14:46 ` Carsten Langgaard [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3D3C1ACB.E7D17386@mips.com \
    --to=carstenl@mips.com \
    --cc=linux-mips@oss.sgi.com \
    --cc=macro@ds2.pg.gda.pl \
    --cc=ralf@uni-koblenz.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.