Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Sep 2001 21:31:33 -0700
From:      Marcel Moolenaar <marcel@xcllnt.net>
To:        Mitsuru IWASAKI <iwasaki@jp.FreeBSD.org>
Cc:        emulation@FreeBSD.org
Subject:   Fix for linux_semctl - please test
Message-ID:  <20010925213133.A5791@athlon.pn.xcllnt.net>
In-Reply-To: <20010925.175750.74756409.iwasaki@jp.FreeBSD.org>
References:  <200109081907.f88J74P38588@freefall.freebsd.org> <20010925.175750.74756409.iwasaki@jp.FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--/9DWx/yDrRhgMJTb
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Tue, Sep 25, 2001 at 05:57:50PM +0900, Mitsuru IWASAKI wrote:
> 
> It seems that this change breaks Linux sysv syscalls (at least, i386
> version of linux_semctl()) and my Oracle 8.1.7 stopped working.

Please try attached patch.

-- 
 Marcel Moolenaar	  USPA: A-39004		 marcel@xcllnt.net

--/9DWx/yDrRhgMJTb
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="linux.diff"

Index: linux_ipc.c
===================================================================
RCS file: /home/ncvs/src/sys/compat/linux/linux_ipc.c,v
retrieving revision 1.25
diff -u -r1.25 linux_ipc.c
--- linux_ipc.c	15 Sep 2001 09:50:31 -0000	1.25
+++ linux_ipc.c	26 Sep 2001 03:32:21 -0000
@@ -224,9 +224,14 @@
 	caddr_t sg;
 
 	sg = stackgap_init();
+
+	/* Make sure the arg parameter can be copied in. */
+	unptr = stackgap_alloc(&sg, sizeof(union semun));
+	bcopy(unptr, &args->arg, sizeof(union semun));
+
 	bsd_args.semid = args->semid;
 	bsd_args.semnum = args->semnum;
-	bsd_args.arg = (union semun *)&args->arg;
+	bsd_args.arg = unptr;
 
 	switch (args->cmd) {
 	case LINUX_IPC_RMID:
@@ -253,10 +258,8 @@
 		    sizeof(linux_semid));
 		if (error)
 			return (error);
-		unptr = stackgap_alloc(&sg, sizeof(union semun));
 		unptr->buf = stackgap_alloc(&sg, sizeof(struct semid_ds));
 		linux_to_bsd_semid_ds(&linux_semid, unptr->buf);
-		bsd_args.arg = unptr;
 		return __semctl(td, &bsd_args);
 	case LINUX_IPC_STAT:
 	case LINUX_SEM_STAT:
@@ -264,9 +267,7 @@
 			bsd_args.cmd = IPC_STAT;
 		else
 			bsd_args.cmd = SEM_STAT;
-		unptr = stackgap_alloc(&sg, sizeof(union semun));
 		unptr->buf = stackgap_alloc(&sg, sizeof(struct semid_ds));
-		bsd_args.arg = unptr;
 		error = __semctl(td, &bsd_args);
 		if (error)
 			return error;

--/9DWx/yDrRhgMJTb--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-emulation" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010925213133.A5791>