Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Sep 2008 19:48:11 +0400
From:      Chagin Dmitry <dchagin@freebsd.org>
To:        Roman Divacky <rdivacky@freebsd.org>
Cc:        freebsd-emulation@freebsd.org, Jose Garcia Juanino <jjuanino@gmail.com>
Subject:   Re: sqlplus segfaults when receiving INT signal
Message-ID:  <20080915154811.GA3696@dchagin.dialup.corbina.ru>
In-Reply-To: <20080914184933.GB86425@freebsd.org>
References:  <20080912205202.GA83925@sanabria> <20080913070920.GA1440@dchagin.dialup.corbina.ru> <20080913084412.GA1263@sanabria> <20080913085108.GA2308@dchagin.dialup.corbina.ru> <20080913205515.GA6158@sanabria> <20080914090856.GA51307@freebsd.org> <20080914092519.GA3121@dchagin.dialup.corbina.ru> <20080914184933.GB86425@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Sep 14, 2008 at 08:49:33PM +0200, Roman Divacky wrote:
> On Sun, Sep 14, 2008 at 01:25:19PM +0400, Chagin Dmitry wrote:
> > > 
> > > please provide ktrace/linux_kdump... the "unknown futex operation" problem is fixed
> > > in this release so there must be something else
> > 
> >   1428 sqlplus  0.874520 CALL  munmap(0x28066000,0xc41d)
> >   1428 sqlplus  0.874543 RET   munmap 0
> >   1428 sqlplus  0.874553 CALL  linux_set_tid_address(0x292cf708)
> >   1428 sqlplus  0.874563 RET   linux_set_tid_address 1428/0x594
> >   1428 sqlplus  0.874572 CALL  linux_set_robust_list(0x292cf710,0xc)
> >   1428 sqlplus  0.874580 RET   linux_set_robust_list -1 errno 22 (EINVAL) Invali
> > d argument
> >   1428 sqlplus  0.874596 CALL  linux_sys_futex(0xffffdbc4,FUTEX_WAKE|FUTEX_PRIVA
> > TE_FLAG,0x1,0x292cf6c0,0x29154ff4,0xffffdbd8)
> >   1428 sqlplus  0.874608 RET   linux_sys_futex 1
> >   1428 sqlplus  0.874641 CALL  linux_rt_sigaction(SIG 32,0xffffd87c,0,0x8)
> >   1428 sqlplus  0.874651 RET   linux_rt_sigaction 0
> 
> the robust futexes are also implemented in -CURRENT but I dont feel like
> MFcing them.... the error is also harmless

it amd64, so, set_robust_list() here does not work. look at a patch bellow,
I show it for example only because I don't understand how futexes work :)


diff --git a/src/sys/compat/linux/linux_futex.c b/src/sys/compat/linux/linux_futex.c
index 6588d23..73cf3a7 100644
--- a/src/sys/compat/linux/linux_futex.c
+++ b/src/sys/compat/linux/linux_futex.c
@@ -551,7 +551,7 @@ linux_set_robust_list(struct thread *td, struct linux_set_robust_list_args *args
 		return (EINVAL);
 
 	em = em_find(td->td_proc, EMUL_DOLOCK);
-	em->robust_futexes = args->head;
+	em->robust_futexes = PTRIN(args->head);
 	EMUL_UNLOCK(&emul_lock);
 
 	return (0);	
@@ -661,17 +661,17 @@ release_futexes(struct proc *p)
 	if (head == NULL)
 		return;
 
-	if (fetch_robust_entry(&entry, &head->list.next, &pi))
+	if (fetch_robust_entry(&entry, PTRIN(&head->list.next), &pi))
 		return;
 
 	if (copyin(&head->futex_offset, &futex_offset, sizeof(l_ulong)))
 		return;
 
-	if (fetch_robust_entry(&pending, &head->pending_list, &pip))
+	if (fetch_robust_entry(&pending, PTRIN(&head->pending_list), &pip))
 		return;
 
 	while (entry != &head->list) {
-		rc = fetch_robust_entry(&next_entry, &entry->next, &next_pi);
+		rc = fetch_robust_entry(&next_entry, PTRIN(&entry->next), &next_pi);
 
 		if (entry != pending)
 			if (handle_futex_death((char *)entry + futex_offset,
diff --git a/src/sys/compat/linux/linux_futex.h b/src/sys/compat/linux/linux_futex.h
index f6a2d4b..67b5115 100644
--- a/src/sys/compat/linux/linux_futex.h
+++ b/src/sys/compat/linux/linux_futex.h
@@ -66,14 +66,22 @@
 /* This is defined by Linux user-space */
 
 struct linux_robust_list {
-	struct linux_robust_list	*next;
-};
+	l_uintptr_t	next;
+}
+#if defined(__amd64__) && defined(COMPAT_LINUX32)
+__packed
+#endif
+;
 
 struct linux_robust_list_head {
 	struct linux_robust_list	list;
 	l_ulong				futex_offset;
-	struct linux_robust_list	*pending_list;
-};
+	l_uintptr_t			pending_list;
+}
+#if defined(__amd64__) && defined(COMPAT_LINUX32)
+__packed
+#endif
+;
 
 #define	FUTEX_WAITERS		0x80000000
 #define	FUTEX_OWNER_DIED	0x40000000

thnx!

-- 
Have fun!
chd



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