From owner-freebsd-threads@FreeBSD.ORG Fri Dec 31 13:08:56 2010 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B3FDE1065670 for ; Fri, 31 Dec 2010 13:08:56 +0000 (UTC) (envelope-from freebsdml@marino.st) Received: from shepard.synsport.net (mail.synsport.com [208.69.230.148]) by mx1.freebsd.org (Postfix) with ESMTP id 8C9628FC14 for ; Fri, 31 Dec 2010 13:08:56 +0000 (UTC) Received: from [192.168.1.33] (78.red-79-158-163.staticip.rima-tde.net [79.158.163.78]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by shepard.synsport.net (Postfix) with ESMTP id DA6A3438BE; Fri, 31 Dec 2010 07:08:44 -0600 (CST) Message-ID: <4D1DD5CF.5020305@marino.st> Date: Fri, 31 Dec 2010 14:08:31 +0100 From: John Marino User-Agent: Thunderbird 2.0.0.24 (Windows/20100228) MIME-Version: 1.0 To: Kostik Belousov References: <4D1DC299.2090808@marino.st> <20101231122225.GK90883@deviant.kiev.zoral.com.ua> <4D1DCE02.3050601@marino.st> <20101231125215.GL90883@deviant.kiev.zoral.com.ua> In-Reply-To: <20101231125215.GL90883@deviant.kiev.zoral.com.ua> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-threads@freebsd.org Subject: Re: AMD64 version of GNAT Ada compiler broken due to libthr X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Dec 2010 13:08:56 -0000 Hi Kostik, The result is the test passes. A small gdb log follows to prove it. So what does this mean? -- John Starting program: /usr/home/marino/test_gnat/test_c9a009c/c9a009c [New LWP 100064] [New Thread 800a041c0 (LWP 100064)] [New Thread 800a0ae40 (LWP 100051)] [New Thread 800a64c80 (LWP 100073)] [New Thread 800aa1ac0 (LWP 100090)] [Thread 800aa1ac0 (LWP 100090) exited] Invalid selected thread. [Switching to thread 2 (Thread 800a041c0 (LWP 100064))]#0 0x00000008006923cc in _umtx_op_err () at /usr/src/lib/libthr/arch/amd64/amd64/_umtx_op_err.S:37 37 RSYSCALL_ERR(_umtx_op) Continuing. [Thread 800a64c80 (LWP 100073) exited] Invalid selected thread. [Switching to thread 2 (Thread 800a041c0 (LWP 100064))]#0 0x00000008006923cc in _umtx_op_err () at /usr/src/lib/libthr/arch/amd64/amd64/_umtx_op_err.S:37 37 RSYSCALL_ERR(_umtx_op) Continuing. [Thread 800a0ae40 (LWP 100051) exited] Invalid selected thread. [Switching to thread 2 (Thread 800a041c0 (LWP 100064))]#0 0x00000008006923cc in _umtx_op_err () at /usr/src/lib/libthr/arch/amd64/amd64/_umtx_op_err.S:37 37 RSYSCALL_ERR(_umtx_op) Continuing. Program exited normally. Kostik Belousov wrote: > On Fri, Dec 31, 2010 at 01:35:14PM +0100, John Marino wrote: >> Hi Kostik, >> You're right, that was an oversight. I'm using release 8.1, but I tried >> troubleshooting this months ago on 8.0 and the result was identical. >> >> I'm well above my head here. I don't know what I should be looking for. >> Here's the dissembled _umtx_op_err function, along with the >> backtraces of the other two threads. They didn't look that interesting >> to me the first time. > The instruction counter is right before syscall, so I do think that the > thread was executing the syscall. > > Backtrace for LWP 100073 indeed looks interesting, because the address > 0x00007fffffbfeb19 belongs to the area used for stack(s), including > the thread stacks. > > FreeBSD amd64 currently provides non-executable stacks for non-main > threads, but executable stack for main thread. i386 has no support for > nx bit on non-PAE kernels. > > As a useful experiment, go to src/lib/libthr/thread/thr_stack.c, find > the following fragment > > if ((stackaddr = mmap(stackaddr, stacksize+guardsize, > PROT_READ | PROT_WRITE, MAP_STACK, > -1, 0)) != MAP_FAILED && > > and change the flags from PROT_READ | PROT_WRITE to > PROT_READ | PROT_WRITE | PROT_EXEC. Then recompile and reinstall libthr, > and report back what happens with your test. >