NetBSD Problem Report #51277

From martin@duskware.de  Sun Jun 26 12:27:14 2016
Return-Path: <martin@duskware.de>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 6D6947A488
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 26 Jun 2016 12:27:14 +0000 (UTC)
From: martin@NetBSD.org
Reply-To: martin@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: compat32 core dumps stopped working
X-Send-Pr-Version: 3.95

>Number:         51277
>Category:       kern
>Synopsis:       compat32 core dumps stopped working
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    christos
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jun 26 12:30:00 +0000 2016
>Closed-Date:    Wed Jun 29 08:03:16 +0000 2016
>Last-Modified:  Wed Jun 29 08:03:16 +0000 2016
>Originator:     Martin Husemann
>Release:        NetBSD 7.99.32
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD night-owl.duskware.de 7.99.32 NetBSD 7.99.32 (NIGHT-OWL) #420: Tue Jun 21 17:31:55 CEST 2016 martin@night-owl.duskware.de:/usr/src/sys/arch/amd64/compile/NIGHT-OWL amd64
Architecture: x86_64
Machine: amd64
>Description:

The addition auf the auxv ELF_NOTE_NETBSD_CORE_AUXV note broke dumping core
files for 32bit compat processes.

See the usage of the native struct ps_strings pss to calculate length
and user address of the auxv, and compare to the similar code in
copyin_psstrings where a struct ps_strings32 is used and converted
after copyin. However, this is bogus as well, as it assumes all 32bit
processes would be compat_netbsd32 processes w/o further testing.

Not sure, however, how important dumping proper cores in other emulated
environments is.

>How-To-Repeat:

$ cat test.c 
#include <stdlib.h>

int main(int argc, char **argv)
{
        abort();
        return 0;
}
$ cc -Wall -O2 -m32 test.c
$ ./a.out
$ ls -l a.out.core 
-rw-------  1 martin  wheel  0 Jun 26 14:19 a.out.core


>Fix:
Move copy-in of the auxv into copyin_psstrings(), where a hack deals with
PK_32 processes - however, the correct fix would be to make this copyin a
per-emulation operation and move it from sys/kern to sys/compat/*

>Release-Note:

>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51277 CVS commit: src/sys/kern
Date: Sun, 26 Jun 2016 21:46:04 -0400

 Module Name:	src
 Committed By:	christos
 Date:		Mon Jun 27 01:46:04 UTC 2016

 Modified Files:
 	src/sys/kern: core_elf32.c

 Log Message:
 PR/51277: Fix compat32 coredumping that broke with the aux vector note
 addition.


 To generate a diff of this commit:
 cvs rdiff -u -r1.46 -r1.47 src/sys/kern/core_elf32.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->feedback
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Tue, 28 Jun 2016 16:40:37 +0000
State-Changed-Why:
fixed?
(does this affect -7?)


Responsible-Changed-From-To: kern-bug-people->christos
Responsible-Changed-By: martin@NetBSD.org
Responsible-Changed-When: Wed, 29 Jun 2016 08:03:16 +0000
Responsible-Changed-Why:
Christos fixed it


State-Changed-From-To: feedback->closed
State-Changed-By: martin@NetBSD.org
State-Changed-When: Wed, 29 Jun 2016 08:03:16 +0000
State-Changed-Why:
Confirmed fixed.


>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-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.