Date: Tue, 25 Sep 2001 17:57:50 +0900 (JST) From: Mitsuru IWASAKI <iwasaki@jp.FreeBSD.org> To: marcel@FreeBSD.org Cc: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/alpha/linux linux.h linux_dummy.c linux_genassym.c linux_machdep.c linux_proto.h linux_syscall.h linux_sysent.c src/sys/compat/linux linux_sysctl.c linux_file.c linux_ioctl.c linux_ipc.c linux_ipc.h linux_mib.c linux_misc.c ... Message-ID: <20010925.175750.74756409.iwasaki@jp.FreeBSD.org> In-Reply-To: <200109081907.f88J74P38588@freefall.freebsd.org> References: <200109081907.f88J74P38588@freefall.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi,
From: Marcel Moolenaar <marcel@FreeBSD.org>
Date: Sat, 8 Sep 2001 12:07:04 -0700 (PDT)
> marcel 2001/09/08 12:07:04 PDT
>
> Modified files:
> sys/alpha/linux linux.h linux_dummy.c linux_genassym.c
> linux_machdep.c linux_proto.h
> linux_syscall.h linux_sysent.c
> sys/compat/linux linux_file.c linux_ioctl.c linux_ipc.c
> linux_ipc.h linux_mib.c linux_misc.c
> linux_signal.c linux_signal.h
> linux_socket.c linux_stats.c
> sys/i386/linux linux.h linux_dummy.c linux_genassym.c
> linux_machdep.c linux_proto.h
> linux_syscall.h linux_sysent.c
> linux_sysvec.c
> sys/modules/linux Makefile
> Added files:
> sys/compat/linux linux_sysctl.c
> Log:
> Round of cleanups and enhancements. These include (in random order):
>
> o Introduce private types for use in linux syscalls for two reasons:
> 1. establish type independence for ease in porting and,
> 2. provide a visual queue as to which syscalls have proper
> prototypes to further cleanup the i386/alpha split.
> Linuxulator types are prefixed by 'l_'. void and char have not
> been "virtualized".
>
> o Provide dummy functions for all syscalls and remove dummy functions
> or implementations of truely obsolete syscalls.
>
> o Sanitize the shm*, sem* and msg* syscalls.
It seems that this change breaks Linux sysv syscalls (at least, i386
version of linux_semctl()) and my Oracle 8.1.7 stopped working.
In sys/i386/linux_machdep.c:linux_ipc()
case LINUX_SEMCTL: {
struct linux_semctl_args a;
int error;
a.semid = args->arg1;
a.semnum = args->arg2;
a.cmd = args->arg3;
error = copyin((caddr_t)args->ptr, &a.arg, sizeof(a.arg));
if (error)
return (error);
return (linux_semctl(td, &a));
}
Note that we already did copyin() and have linux_semctl_args in kernel space.
however in sys/kern/sysv_sem.c:__semctl(),
case SETVAL:
if ((error = ipcperm(td, &semaptr->sem_perm, IPC_W)))
goto done2;
if (semnum < 0 || semnum >= semaptr->sem_nsems) {
error = EINVAL;
goto done2;
}
if ((error = copyin(arg, &real_arg, sizeof(real_arg))) != 0)
goto done2;
semaptr->sem_base[semnum].semval = real_arg.val;
semundo_clear(semid, semnum);
wakeup((caddr_t)semaptr);
break;
it seems that we are trying to copyin() from auto-variable in kernel space,
not user space.
# Of course copyin() returns EFAULT in this case.
I've made quick fix for this just for linux_semctl() so that Oracle
8.1.7 can be startup and shutdown. I hope that correct and complete
fix will come soon :-)
Thanks
Index: compat/linux/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
--- compat/linux/linux_ipc.c 15 Sep 2001 09:50:31 -0000 1.25
+++ compat/linux/linux_ipc.c 25 Sep 2001 08:23:12 -0000
@@ -246,6 +246,7 @@
break;
case LINUX_SETVAL:
bsd_args.cmd = SETVAL;
+ bsd_args.arg = (union semun *)args->ptr;
break;
case LINUX_IPC_SET:
bsd_args.cmd = IPC_SET;
Index: compat/linux/linux_ipc.h
===================================================================
RCS file: /home/ncvs/src/sys/compat/linux/linux_ipc.h,v
retrieving revision 1.7
diff -u -r1.7 linux_ipc.h
--- compat/linux/linux_ipc.h 12 Sep 2001 08:36:57 -0000 1.7
+++ compat/linux/linux_ipc.h 25 Sep 2001 08:08:21 -0000
@@ -69,6 +69,7 @@
l_int semnum;
l_int cmd;
union l_semun arg;
+ caddr_t ptr;
};
struct linux_semget_args
Index: i386/linux/linux_machdep.c
===================================================================
RCS file: /home/ncvs/src/sys/i386/linux/linux_machdep.c,v
retrieving revision 1.19
diff -u -r1.19 linux_machdep.c
--- i386/linux/linux_machdep.c 12 Sep 2001 08:37:35 -0000 1.19
+++ i386/linux/linux_machdep.c 25 Sep 2001 08:08:42 -0000
@@ -151,9 +151,13 @@
a.semid = args->arg1;
a.semnum = args->arg2;
a.cmd = args->arg3;
+#if 0
error = copyin((caddr_t)args->ptr, &a.arg, sizeof(a.arg));
if (error)
return (error);
+#else
+ a.ptr = args->ptr;
+#endif
return (linux_semctl(td, &a));
}
case LINUX_MSGSND: {
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010925.175750.74756409.iwasaki>
