NetBSD Problem Report #39012

From root@quince.wongs.net  Sun Jun 22 06:07:10 2008
Return-Path: <root@quince.wongs.net>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id F310C63B89F
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 22 Jun 2008 06:07:09 +0000 (UTC)
Message-Id: <20080622041859.697D721CB7@quince.wongs.net>
Date: Sun, 22 Jun 2008 04:09:10 +0000 (UTC)
From: ben@wongs.net
Reply-To: ben@wongs.net
To: gnats-bugs@gnats.NetBSD.org
Subject: boehm-gc coredumps on GC_INIT under hpcmips (mipsel)
X-Send-Pr-Version: 3.95

>Number:         39012
>Category:       pkg
>Synopsis:       boehm-gc coredumps on GC_INIT under hpcmips (mipsel)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jun 22 06:10:00 +0000 2008
>Closed-Date:    
>Last-Modified:  Sun Aug 09 23:21:17 +0000 2015
>Originator:     Ben Wong
>Release:        NetBSD 4.0
>Organization:

>Environment:


System: NetBSD quince.wongs.net 4.0 NetBSD 4.0 (GENERIC) #0: Sat Dec 15 22:00:07 PST 2007 builds@wb46:/home/builds/ab/netbsd-4-0-RELEASE/hpcmips/200712160005Z-obj/home/builds/ab/netbsd-4-0-RELEASE/src/sys/arch/hpcmips/compile/GENERIC hpcmips
Architecture: mipsel
Machine: hpcmips
>Description:

Any C program that uses the binary pkg build of the Boehm garbage
collection dumps core. I believe this is a problem with the package,
as I have, in the past, compiled boehm-gc by hand and used it with no
problems on my NetBSD/hpcmips (mipsel) machine.


>How-To-Repeat:

Install boehm-gc binary package using 'pkg_add -v boehm-gc'

Compile this program and watch it core dump.


    #include <stdlib.h>
    #include <gc.h>

    int
    main(int argc, char *argv[], char **envp)
    {
	GC_INIT();
	exit(0);
    }

    /*  Compile with:

    gcc -g -R/usr/pkg/lib -I/usr/pkg/include -I/usr/pkg/include/gc -L/usr/pkg/lib gctest.c -lgc

    */

Here is the gdb backtrace:

    Program received signal SIGSEGV, Segmentation fault.
    0x7df4549c in GC_find_limit_with_bound () from /usr/pkg/lib/libgc.so.1
    (gdb) bt
    #0  0x7df4549c in GC_find_limit_with_bound () from /usr/pkg/lib/libgc.so.1
    #1  0x7df45658 in GC_init_netbsd_elf () from /usr/pkg/lib/libgc.so.1
    #2  0x7df442c8 in GC_init_inner () from /usr/pkg/lib/libgc.so.1
    #3  0x00400adc in main (argc=1, argv=0x7fffdd34, envp=0x7fffdd3c) at gctest.c:7
    (gdb) 




>Fix:

None known. Probably the package is just being compiled with the wrong options.

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: pkg-manager->recht
Responsible-Changed-By: wiz@NetBSD.org
Responsible-Changed-When: Tue, 24 Jun 2008 06:45:18 +0000
Responsible-Changed-Why:
Over to maintainer.


State-Changed-From-To: open->feedback
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Tue, 24 Jun 2008 06:47:57 +0000
State-Changed-Why:
Which version of boehm-gc is that, exactly?
(pkg_info -e boehm-gc)


From: "Ben Wong" <ben@wongs.net>
To: gnats-bugs@netbsd.org
Cc: recht@netbsd.org, pkgsrc-bugs@netbsd.org, gnats-admin@netbsd.org, 
	wiz@netbsd.org
Subject: Re: pkg/39012 (boehm-gc coredumps on GC_INIT under hpcmips (mipsel))
Date: Mon, 7 Jul 2008 03:59:37 -0700

 $ pkg_info -e boehm-gc
 boehm-gc-7.0nb1

 I believe that is the current version in pkgsrc.

 ---Ben


 On Mon, Jun 23, 2008 at 11:48 PM,  <wiz@netbsd.org> wrote:
 > Synopsis: boehm-gc coredumps on GC_INIT under hpcmips (mipsel)
 >
 > State-Changed-From-To: open->feedback
 > State-Changed-By: wiz@NetBSD.org
 > State-Changed-When: Tue, 24 Jun 2008 06:47:57 +0000
 > State-Changed-Why:
 > Which version of boehm-gc is that, exactly?
 > (pkg_info -e boehm-gc)
 >
 >
 >
 >

State-Changed-From-To: feedback->open
State-Changed-By: obache@NetBSD.org
State-Changed-When: Mon, 07 Jul 2008 12:01:54 +0000
State-Changed-Why:
Feedback provided.


Responsible-Changed-From-To: recht->pkg-manager
Responsible-Changed-By: wiz@NetBSD.org
Responsible-Changed-When: Mon, 28 Feb 2011 15:03:51 +0000
Responsible-Changed-Why:
Reset responsible field for retired developer.


From: David Holland <dholland-pbugs@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/39012 (boehm-gc coredumps on GC_INIT under hpcmips (mipsel))
Date: Wed, 31 Oct 2012 20:04:52 +0000

 These two mails were never entered into gnats:

    ------

 From: ben@wongs.net
 To: recht@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org,
 	ben@wongs.net
 Subject: Re: pkg/39012 (boehm-gc coredumps on GC_INIT under hpcmips (mipsel))
 Date: Mon, 7 Jul 2008 06:15:42 -0700

 Additional information:

 I have tried building boehm-gc from the latest pkgsrc and can now
 provide a more precise backtrace.

   Script started on Mon Jul  7 05:30:12 2008
   bash-3.2# gdb ./a.out
   GNU gdb 5.3nb1
   Copyright 2002 Free Software Foundation, Inc.
   This GDB was configured as "mipsel--netbsd"...
   (gdb) run
   Starting program: /usr/pkgsrc/devel/boehm-gc/work/gc-7.0/a.out

   Program received signal SIGSEGV, Segmentation fault.
   0x7df456e8 in GC_find_limit_with_bound () at os_dep.c:917
   917			GC_noop1((word)(*result));
   (gdb) c
   Continuing.

   Program received signal SIGSEGV, Segmentation fault.
   0x7df456e8 in GC_find_limit_with_bound () at os_dep.c:917
   917			GC_noop1((word)(*result));
   (gdb) c
   Continuing.

   Program received signal SIGSEGV, Segmentation fault.
   0x7df3b920 in GC_FirstDLOpenedLinkMap () at dyn_load.c:455
   455	                        = ((struct r_debug *)(dp->d_un.d_ptr))->r_map;

   (gdb) list
   450	    if( cachedResult == 0 ) {
   451	        int tag;
   452	        for( dp = _DYNAMIC; (tag = dp->d_tag) != 0; dp++ ) {
   453	            if( tag == DT_DEBUG ) {
   454	                struct link_map *lm
   455	                        = ((struct r_debug *)(dp->d_un.d_ptr))->r_map;
   456	                if( lm != 0 ) cachedResult = lm->l_next; /*
 might be NIL */
   457	                break;
   458	            }
   459	        }

   (gdb) bt
   #0  0x7df3b920 in GC_FirstDLOpenedLinkMap () at dyn_load.c:455
   #1  0x7df3b9f0 in GC_register_dynamic_libraries () at dyn_load.c:475
   #2  0x7df42cd0 in GC_push_roots () from ./.libs/libgc.so.1
   #3  0x7df422d4 in GC_mark_some () from ./.libs/libgc.so.1
   #4  0x7df3809c in GC_stopped_mark () from ./.libs/libgc.so.1
   #5  0x7df384d8 in GC_try_to_collect_inner () from ./.libs/libgc.so.1
   #6  0x00400adc in main (argc=1, argv=0x7fffdca4, envp=0x7fffdcac) at
 gctest.c:7
   (gdb) quit
   The program is running.  Exit anyway? (y or n) y
   bash-3.2# exit

   Script done on Mon Jul  7 05:31:04 2008

 Note that the first two segfaults are red herrings. Apparently some
 OSes (including NetBSD?) do not have a native way to find the
 beginning and end of the main data segment, so boehm-gc must perform a
 search at startup which causes segmentation faults.

 The true bug appears to be releated to the dynamic library tracing
 routines in dyn_load.c. The following page has helpful information
 about the porting changes necessary to enable dynamic library support:

   http://www.hpl.hp.com/personal/Hans_Boehm/gc/porting.html

 The page also mentions that if DYNAMIC_LOADING is undefined in
 gcconfig.h, tracing of dynamic library data will be disabled. This
 might be a quick, if rather unsatisfying, way to get boehm-gc
 "working" in NetBSD/mipsel.

 --Ben


 From: ben@wongs.net
 To: recht@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org,
 	ben@wongs.net
 Subject: Re: pkg/39012 (boehm-gc coredumps on GC_INIT under hpcmips (mipsel))
 Date: Sun, 20 Jul 2008 05:36:54 -0700

 As I suspected, a quick work around is to simply disable
 DYNAMIC_LOADING in the Boehm garbage collector. I have recompiled
 gc-7.0 and verified that libgc works as expected (or, at least, it
 doesn't dump core like the one currently available in pkgsrc).

 I have a patch (below) which skips the #define of DYNAMIC_LOADING when
 NETBSD and MIPSEL are defined. While this is not the optimal solution,
 it is more correct then what is currently shipping. By the way, this
 patch to boehm-gc will make the w3m package, and perhaps others,
 compile cleanly instead of breaking.

 	--Ben

 --- include/private/gcconfig.h.orig     2007-06-28 17:00:09.000000000 -0700
 +++ include/private/gcconfig.h  2008-07-20 05:25:28.000000000 -0700
 @@ -1397,7 +1397,13 @@
          extern int etext[];
  #       define DATASTART GC_data_start
  #       define NEED_FIND_LIMIT
 -#       define DYNAMIC_LOADING
 +/* Sadly, DYNAMIC_LOADING is broken for NetBSD/mipsel as of July 2008 */
 +#      ifdef __MIPSEL__
 +#        warning "DYNAMIC_LOADING support is broken for little endian MIPS"
 +#        undef DYNAMIC_LOADING
 +#      else
 +#         define DYNAMIC_LOADING
 +#      endif /* __MIPSEL__ */
  #     else
  #       define DATASTART ((ptr_t) 0x10000000)
  #       define STACKBOTTOM ((ptr_t) 0x7ffff000)


 On 7/7/08, ben@wongs.net <ben@wongs.net> wrote:
 > Additional information:
 > [[snipped by dholland]]

State-Changed-From-To: open->feedback
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Wed, 31 Oct 2012 20:08:19 +0000
State-Changed-Why:
Is that patch still required (a) for boehm-gc 7.2d (currently in pkgsrc)
and (b) for netbsd-5 or up?


State-Changed-From-To: feedback->open
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sun, 09 Aug 2015 23:21:17 +0000
State-Changed-Why:
Feedback timeout. Can someone with a mips setup test this please?


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.