NetBSD Problem Report #48041

From martin@duskware.de  Wed Jul 10 10:35:04 2013
Return-Path: <martin@duskware.de>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 61FBB716C1
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 10 Jul 2013 10:35:04 +0000 (UTC)
From: martin@NetBSD.org
Reply-To: martin@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: after updating vax to new CSU stuff, various binaries get SIGSEGV on exit
X-Send-Pr-Version: 3.95

>Number:         48041
>Category:       port-vax
>Synopsis:       various binaries get SIGSEGV on exit
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    port-vax-maintainer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jul 10 10:40:00 +0000 2013
>Closed-Date:    Thu Jul 11 10:14:14 +0000 2013
>Last-Modified:  Thu Jul 11 10:14:14 +0000 2013
>Originator:     Martin Husemann
>Release:        NetBSD 6.99.23
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD dead-to-the-world.duskware.de 6.99.23 NetBSD 6.99.23 (DEAD) #25: Tue Jul 9 06:02:37 CEST 2013 martin@night-porter.duskware.de:/usr/src/sys/arch/vax/compile/DEAD vax
Architecture: vax
Machine: vax
>Description:

After recently upgrading my VAX to -current (as of a few days ago), several
(old and new) binaries started to segfault on program exit.

This includes important ones: sshd[1085]: fatal: privsep_preauth: preauth child terminated by signal 11

but is also reproducable with simpler to debug ones, like mini_sendmail
from pkgsrc (old, unchanged binary):

Starting program: /usr/pkg/sbin/mini_sendmail < /dev/null
/usr/pkg/sbin/mini_sendmail: could not open SMTP socket: Connection refused
Program received signal SIGSEGV, Segmentation fault.
0x7f6e8baf in __do_global_dtors_aux () from /usr/lib/libc.so.12
(gdb) bt
#0  0x7f6e8baf in __do_global_dtors_aux () from /usr/lib/libc.so.12
#1  0x7f787ce9 in _fini () from /usr/lib/libc.so.12
#2  0x7f7d684a in _rtld_call_fini_functions (2147469816, 1)
   from /usr/libexec/ld.elf_so
#3  0x7f7d6fc9 in _rtld_exit () from /usr/libexec/ld.elf_so
#4  0x7f77544b in __cxa_finalize (0) from /usr/lib/libc.so.12
#5  0x7f775318 in exit (1) from /usr/lib/libc.so.12
#6  0x00010ebf in ?? (74047)
#7  0x00011a09 in ?? (1, 2147478836, 2147478844)
#8  0x00010d26 in ??
    (1, 2147478836, 2147478844, 2138927022, 2138873856, 2147483632)
#9  0x00010c9b in ?? ()
(gdb) x/i 0x7f6e8baf
=> 0x7f6e8baf <__do_global_dtors_aux+67>:       calls $0x0,(r0)
(gdb) info reg
r0             0x0      0
r1             0x0      0


>How-To-Repeat:
s/a

>Fix:
Skipp NULL ctor/dtor pointers?

>Release-Note:

>Audit-Trail:
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: port-vax/48041: after updating vax to new CSU stuff, various binaries get SIGSEGV on exit
Date: Wed, 10 Jul 2013 12:43:02 +0200

 --AhhlLboLdkugWU4S
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline

 If NULL ctor/dtor pointers are allowd, this might fix it.
 If they are not allowed, I have no clue how they happen.

 Martin

 --AhhlLboLdkugWU4S
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename=patch

 Index: crtbegin.c
 ===================================================================
 RCS file: /cvsroot/src/lib/csu/common/crtbegin.c,v
 retrieving revision 1.3
 diff -c -u -r1.3 crtbegin.c
 --- crtbegin.c	27 Jun 2013 21:24:39 -0000	1.3
 +++ crtbegin.c	10 Jul 2013 10:39:47 -0000
 @@ -84,8 +84,9 @@
  		Jv_RegisterClasses(__JCR_LIST__);

  #if !defined(HAVE_INITFINI_ARRAY)
 -	for (const fptr_t *p = __CTOR_LIST_END__; p > __CTOR_LIST__ + 1; ) {
 -		(*(*--p))();
 +	for (const fptr_t *p = __CTOR_LIST_END__ -1; p > __CTOR_LIST__; p--) {
 +		if (p)
 +			(*(*p))();
  	}
  #endif
  }
 @@ -116,8 +117,9 @@
  #endif

  #if !defined(HAVE_INITFINI_ARRAY)
 -	for (const fptr_t *p = __DTOR_LIST__ + 1; p < __DTOR_LIST_END__; ) {
 -		(*(*p++))();
 +	for (const fptr_t *p = __DTOR_LIST__ + 1; p < __DTOR_LIST_END__; p++) {
 +		if (p)
 +			(*(*p))();
  	}
  #endif


 --AhhlLboLdkugWU4S--

From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: port-vax/48041: after updating vax to new CSU stuff, various
 binaries get SIGSEGV on exit
Date: Wed, 10 Jul 2013 16:46:47 +0000

 On Wed, Jul 10, 2013 at 10:45:01AM +0000, Martin Husemann wrote:
  >  If NULL ctor/dtor pointers are allowd, this might fix it.
  >  If they are not allowed, I have no clue how they happen.

 I vaguely recall that on other platforms they are, but I haven't
 actually looked.

 -- 
 David A. Holland
 dholland@netbsd.org

State-Changed-From-To: open->closed
State-Changed-By: martin@NetBSD.org
State-Changed-When: Thu, 11 Jul 2013 10:14:14 +0000
State-Changed-Why:
Matt fixed it


>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.