NetBSD Problem Report #46632

From ignatios@cs.uni-bonn.de  Wed Jun 27 09:57:35 2012
Return-Path: <ignatios@cs.uni-bonn.de>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id 2B99163B85F
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 27 Jun 2012 09:57:35 +0000 (UTC)
Message-Id: <1340790942.503413.7248.nullmailer@jaguar-alpha.cs.uni-bonn.de>
Date: Wed, 27 Jun 2012 11:55:42 +0200
From: ignatios@cs.uni-bonn.de
Reply-To: ignatios@cs.uni-bonn.de
To: gnats-bugs@gnats.NetBSD.org
Subject: i386 emacs can't be build in 32bit emulation on amd64
X-Send-Pr-Version: 3.95

>Number:         46632
>Category:       pkg
>Synopsis:       i386 emacs can't be build in 32bit emulation on amd64
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jun 27 10:00:00 +0000 2012
>Last-Modified:  Thu Sep 20 01:10:02 +0000 2012
>Originator:     Ignatios Souvatzis
>Release:        NetBSD 6.0_BETA2
>Organization:
computer science department, university of Bonn, Germany
>Environment:


System:
(Host) NetBSD random84.cs.uni-bonn.de 6.0_BETA NetBSD 6.0_BETA (GENERIC) #0: Fri Mar  9 13:21:26 CET 2012  ignatios@random84.cs.uni-bonn.de:/var/itch/sources/6.0/oamd64/sys/arch/amd64/compile/GENERIC amd64
Architecture: amd64
Machine: amd64

(pkg building chroot) NetBSD random84.cs.uni-bonn.de 6.0_BETA NetBSD 6.0_BETA (GENERIC) #0: Fri Mar  9 13:21:26 CET 2012  ignatios@random84.cs.uni-bonn.de:/var/itch/sources/6.0/oamd64/sys/arch/amd64/compile/GENERIC i386

Architecture: i386
Machine: i386

>Description:

	I'm building all packages needed for amd64 and i386 on a designated
amd64 machine, using various build directories set up with pkg_comp.

So far, this worked fine (with the exception of Ooo). However, with
netbsd-6.0beta2 environment and 2011Q1, the created emacs (which still
works fine inside that environment) doesn't work on either a physical
32bit machine running NetBSD/i386 or a XEN DOMU running a 32bit PAE
kernel.

I've checked nearly all available emacs and emacs-nox11 and xemacs
packages.

ktrace/kdump shows:

 28292      1 emacs    CALL  __sigprocmask14(1,0xbf7fe990,0xbf7fea10)
 28292      1 emacs    RET   __sigprocmask14 0
 28292      1 emacs    CALL  __sigprocmask14(3,0xbf7fea10,0)
 28292      1 emacs    RET   __sigprocmask14 0
 28292      1 emacs    PSIG  SIGSEGV SIG_DFL: code=SEGV_MAPERR, addr=0xffffeff4, trap=6)
 28292      1 emacs    NAMI  "emacs.core"

The address (ffffeff4) is always the same, for all emacs versions; I note
it is one page minus 3 longwords below 0x100000000.

Speculation:

I suspect that in this environment, either

- temacs'  memory allocator uses 0 as the upper base of heap allocation,
  and thusly allocated memory is later unexec()d to the final emacs binary

or maybe
- temacs' unexec() itself, for some reason, created those addresses (but
  it wouldn't arrange memory itself, would it?)

The memory allocator might be either in emacs, or (given that all emacsen
stopped working at the same time) one of ours, maybe indirectly called.

The problem might be that our 32bit emulation environment allows for more 
address space to be used than available on real NetBSD/i386; I think the 
latter reserves the upper 2^24 or 2^28 bytes for the kernel?

>How-To-Repeat:
	pkg_comp makeroot; pkg_comp chroot; cd /usr/pkgsrc/editors/emacs; 
	make package
	...
	pkg_add emacs*tgz; emacs
>Fix:
	workaround: build on a real 32bit system, or a 32bit PAE XEN DomU

>Audit-Trail:
From: David Holland <dholland-pbugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/46632: i386 emacs can't be build in 32bit emulation on amd64
Date: Thu, 28 Jun 2012 08:12:49 +0000

 On Wed, Jun 27, 2012 at 10:00:01AM +0000, ignatios@cs.uni-bonn.de wrote:
  > The problem might be that our 32bit emulation environment allows for more 
  > address space to be used than available on real NetBSD/i386; I think the 
  > latter reserves the upper 2^24 or 2^28 bytes for the kernel?

 That is a good bet. Does nm -n on the dumped emacs show anything
 suggestive?

 -- 
 David A. Holland
 dholland@netbsd.org

From: Mark Davies <mark@ecs.vuw.ac.nz>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/46632: i386 emacs can't be build in 32bit emulation on amd64
Date: Thu, 13 Sep 2012 22:19:09 +1200

 (second attempt to send this)

 I think I'm striking a different variant of this bug (or a related 
 one).

 emacs built on real 5.99.59/i386, runs fine on that machine.  runs 
 fine on real 6.0_RC1/i386.  segfaults on 6.0_RC1 XEN3PAE_DOMU i386.

 emacs built on 6.0_RC1 XEN3PAE_DOMU i386, runs fine on that machine 
 segfaults on 6.0_RC1/i386.

 cheers
 mark

From: David Holland <dholland-pbugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/46632: i386 emacs can't be build in 32bit emulation on amd64
Date: Sat, 15 Sep 2012 17:16:53 +0000

 On Thu, Sep 13, 2012 at 10:20:06AM +0000, Mark Davies wrote:
  >  I think I'm striking a different variant of this bug (or a related 
  >  one).
  >  
  >  emacs built on real 5.99.59/i386, runs fine on that machine.  runs 
  >  fine on real 6.0_RC1/i386.  segfaults on 6.0_RC1 XEN3PAE_DOMU i386.
  >  
  >  emacs built on 6.0_RC1 XEN3PAE_DOMU i386, runs fine on that machine 
  >  segfaults on 6.0_RC1/i386.

 If you get a chance, can you try two things:

 (1) run nm -n on both binaries and check how (if at all) the memory
 layout differs;

 (2) check if the pre-dump temacs generated during the build has the
 same problem.

 -- 
 David A. Holland
 dholland@netbsd.org

From: Mark Davies <mark@ecs.vuw.ac.nz>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/46632: i386 emacs can't be build in 32bit emulation on amd64
Date: Thu, 20 Sep 2012 13:07:18 +1200

 On Sun, 16 Sep 2012, you wrote:
 >  If you get a chance, can you try two things:
 > 
 >  (1) run nm -n on both binaries and check how (if at all) the
 > memory layout differs;

 turakirae# diff /tmp/emacs-i386.nm-n /tmp/emacs-xen.nm-n
 7541,7542c7541,7542
 < 0884c000 A _edata
 < 0884c000 A _end
 ---
 > 08843000 A _edata
 > 08843000 A _end


 >  (2) check if the pre-dump temacs generated during the build has
 > the same problem.

 temacs built on either, runs on either.

 cheers
 mark

>Unformatted:


 	2011Q1

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.