Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Aug 2006 19:28:58 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        Steve Kargl <sgk@troutmask.apl.washington.edu>
Cc:        amd64@freebsd.org
Subject:   Re: FINALLY! Re: linux32 breakage in current..
Message-ID:  <200608291928.59024.jhb@freebsd.org>
In-Reply-To: <20060829223203.GA951@troutmask.apl.washington.edu>
References:  <200608151701.46724.jhb@freebsd.org> <20060828173520.GA911@troutmask.apl.washington.edu> <20060829223203.GA951@troutmask.apl.washington.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday 29 August 2006 18:32, Steve Kargl wrote:
> On Mon, Aug 28, 2006 at 10:35:20AM -0700, Steve Kargl wrote:
> > On Mon, Aug 21, 2006 at 03:13:44PM -0700, Steve Kargl wrote:
> > > > > > 
> > > > > > Ok.  Can you walk it back further?
> > > > > 
> > > > > I've gone as far back as 15 Jul 06, and the problem is still 
> > > > > there.  I ran out of time to go back to earlier versions.  I'll
> > > > > try again on Monday.
> > > > 
> > > > Wow, thanks!
> > > 
> 
> John,
> 
> I've finally tracked down the commit that broke acroread
> and linux openoffice.   Hopefully, this is enough info for
> you.
> 
> Here is a log of my supfile contents. 
> 
> *default host=cvsup10.FreeBSD.org
> *default base=/var/db
> *default prefix=/usr
> *default release=cvs tag=.
> *default delete use-rel-suffix
> 
> # Good -- Acroread works.
> # *default date=2006.06.27.14.50.00
> # *default date=2006.06.27.18.00.00
> # *default date=2006.06.27.18.30.00
> 
> # Bad --- Acroread segfaults.
> # *default date=2006.06.27.19.00.00
> # *default date=2006.06.27.18.45.00
> *default date=2006.06.27.18.35.00
> 
> src-sys
> 
> The difference between the good supfile and bad are these files:
> 
>  Edit src/sys/amd64/linux32/linux32_proto.h
>  Edit src/sys/amd64/linux32/linux32_syscall.h
>  Edit src/sys/amd64/linux32/linux32_sysent.c
>  Edit src/sys/compat/linux/linux_util.h
>  Edit src/sys/compat/svr4/svr4_ipc.c
>  Edit src/sys/compat/svr4/svr4_proto.h
>  Edit src/sys/compat/svr4/svr4_syscall.h
>  Edit src/sys/compat/svr4/svr4_syscallnames.c
>  Edit src/sys/compat/svr4/svr4_sysent.c
>  Edit src/sys/compat/svr4/syscalls.master
>  Edit src/sys/i386/linux/linux_proto.h
>  Edit src/sys/i386/linux/linux_syscall.h
>  Edit src/sys/i386/linux/linux_sysent.c
> 
> ident shows
> $FreeBSD: src/sys/amd64/linux32/linux32_proto.h,v 1.16 2006/06/27 18:32:16 jhb Exp $
> $FreeBSD: src/sys/amd64/linux32/linux32_syscall.h,v 1.16 2006/06/27 18:32:16 jhb Exp $
> $FreeBSD: src/sys/amd64/linux32/linux32_sysent.c,v 1.16 2006/06/27 18:32:16 jhb Exp $
> 
> CVSWeb reveals that the above are all regenerated files.
> 
> With the bad kernel, I see symptoms of a race condition.
> 
> troutmask:kargl[205] acroread church.pdf
> Segmentation fault (core dumped)
> troutmask:kargl[206] acroread church.pdf
> Segmentation fault (core dumped)
> troutmask:kargl[207] acroread church.pdf
> Segmentation fault (core dumped)
> troutmask:kargl[208] acroread church.pdf    <-- This worked.
> troutmask:kargl[209] acroread church.pdf    <-- This worked.
> troutmask:kargl[210] acroread church.pdf
> Segmentation fault (core dumped)
> troutmask:kargl[211] acroread church.pdf    <-- This worked.
> troutmask:kargl[212] acroread church.pdf
> Segmentation fault (core dumped)

But when you add printf's linux_ipc() isn't being called?  *sigh*  Try
this anyway:

Index: linux32_machdep.c
===================================================================
RCS file: /host/cvs/usr/cvs/src/sys/amd64/linux32/linux32_machdep.c,v
retrieving revision 1.17
diff -u -r1.17 linux32_machdep.c
--- linux32_machdep.c	28 Aug 2006 13:09:24 -0000	1.17
+++ linux32_machdep.c	29 Aug 2006 23:28:22 -0000
@@ -308,22 +308,31 @@
 linux_ipc(struct thread *td, struct linux_ipc_args *args)
 {
 
+	printf("I'm a peacock! (%x)\n", args->what & 0xFFFF);
 	switch (args->what & 0xFFFF) {
 	case LINUX_SEMOP: {
 		struct linux_semop_args a;
+		int error;
 
 		a.semid = args->arg1;
 		a.tsops = args->ptr;
 		a.nsops = args->arg2;
-		return (linux_semop(td, &a));
+		mtx_lock(&Giant);
+		error = linux_semop(td, &a);
+		mtx_unlock(&Giant);
+		return (error);
 	}
 	case LINUX_SEMGET: {
 		struct linux_semget_args a;
+		int error;
 
 		a.key = args->arg1;
 		a.nsems = args->arg2;
 		a.semflg = args->arg3;
-		return (linux_semget(td, &a));
+		mtx_lock(&Giant);
+		error = linux_semget(td, &a);
+		mtx_unlock(&Giant);
+		return (error);
 	}
 	case LINUX_SEMCTL: {
 		struct linux_semctl_args a;
@@ -335,19 +344,27 @@
 		error = copyin(args->ptr, &a.arg, sizeof(a.arg));
 		if (error)
 			return (error);
-		return (linux_semctl(td, &a));
+		mtx_lock(&Giant);
+		error = linux_semctl(td, &a);
+		mtx_unlock(&Giant);
+		return (error);
 	}
 	case LINUX_MSGSND: {
 		struct linux_msgsnd_args a;
+		int error;
 
 		a.msqid = args->arg1;
 		a.msgp = args->ptr;
 		a.msgsz = args->arg2;
 		a.msgflg = args->arg3;
-		return (linux_msgsnd(td, &a));
+		mtx_lock(&Giant);
+		error = linux_msgsnd(td, &a);
+		mtx_unlock(&Giant);
+		return (error);
 	}
 	case LINUX_MSGRCV: {
 		struct linux_msgrcv_args a;
+		int error;
 
 		a.msqid = args->arg1;
 		a.msgsz = args->arg2;
@@ -367,53 +384,80 @@
 			a.msgp = args->ptr;
 			a.msgtyp = args->arg5;
 		}
-		return (linux_msgrcv(td, &a));
+		mtx_lock(&Giant);
+		error = linux_msgrcv(td, &a);
+		mtx_unlock(&Giant);
+		return (error);
 	}
 	case LINUX_MSGGET: {
 		struct linux_msgget_args a;
+		int error;
 
 		a.key = args->arg1;
 		a.msgflg = args->arg2;
-		return (linux_msgget(td, &a));
+		mtx_lock(&Giant);
+		error = linux_msgget(td, &a);
+		mtx_unlock(&Giant);
+		return (error);
 	}
 	case LINUX_MSGCTL: {
 		struct linux_msgctl_args a;
+		int error;
 
 		a.msqid = args->arg1;
 		a.cmd = args->arg2;
 		a.buf = args->ptr;
-		return (linux_msgctl(td, &a));
+		mtx_lock(&Giant);
+		error = linux_msgctl(td, &a);
+		mtx_unlock(&Giant);
+		return (error);
 	}
 	case LINUX_SHMAT: {
 		struct linux_shmat_args a;
+		int error;
 
 		a.shmid = args->arg1;
 		a.shmaddr = args->ptr;
 		a.shmflg = args->arg2;
 		a.raddr = PTRIN((l_uint)args->arg3);
-		return (linux_shmat(td, &a));
+		mtx_lock(&Giant);
+		error = linux_shmat(td, &a);
+		mtx_unlock(&Giant);
+		return (error);
 	}
 	case LINUX_SHMDT: {
 		struct linux_shmdt_args a;
+		int error;
 
 		a.shmaddr = args->ptr;
-		return (linux_shmdt(td, &a));
+		mtx_lock(&Giant);
+		error = linux_shmdt(td, &a);
+		mtx_unlock(&Giant);
+		return (error);
 	}
 	case LINUX_SHMGET: {
 		struct linux_shmget_args a;
+		int error;
 
 		a.key = args->arg1;
 		a.size = args->arg2;
 		a.shmflg = args->arg3;
-		return (linux_shmget(td, &a));
+		mtx_lock(&Giant);
+		error = linux_shmget(td, &a);
+		mtx_unlock(&Giant);
+		return (error);
 	}
 	case LINUX_SHMCTL: {
 		struct linux_shmctl_args a;
+		int error;
 
 		a.shmid = args->arg1;
 		a.cmd = args->arg2;
 		a.buf = args->ptr;
-		return (linux_shmctl(td, &a));
+		mtx_lock(&Giant);
+		error = linux_shmctl(td, &a);
+		mtx_unlock(&Giant);
+		return (error);
 	}
 	default:
 		break;

-- 
John Baldwin



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