NetBSD Problem Report #48518

From reinoud@aspire.localdomain  Mon Jan 13 19:58:58 2014
Return-Path: <reinoud@aspire.localdomain>
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" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 0F0A2A5678
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 13 Jan 2014 19:58:58 +0000 (UTC)
Message-Id: <20140113195904.E8A74842E12@aspire.localdomain>
Date: Mon, 13 Jan 2014 20:59:04 +0100 (CET)
From: reinoud@NetBSD.org
Reply-To: reinoud@NetBSD.org
To: gnats-bugs@gnats.NetBSD.org
Subject: compat_linux_common bug
X-Send-Pr-Version: 3.95

>Number:         48518
>Category:       kern
>Synopsis:       Linux programs won't run correctly
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    chs
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jan 13 20:00:00 +0000 2014
>Closed-Date:    Mon Sep 22 12:03:55 +0000 2014
>Last-Modified:  Mon Sep 22 12:03:55 +0000 2014
>Originator:     Reinoud Zandijk
>Release:        NetBSD 6.99.28
>Organization:
NetBSD

>Environment:


System: NetBSD aspire 6.99.28 NetBSD 6.99.28 (GENERIC) #28: Mon Jan 13 12:50:44 CET 2014 reinoud@aspire:/usr/sources/cvs.netbsd.org/src-clean/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386

Runing a Linux binary: ELF 32-bit LSB executable, Intel 80386, version 1
(SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.2.5, stripped

>Description:

When trying to run Linux binaries on a -current kernel the programs start
correctly but are given unreliable argv, argc and environment vars. This
results in programs failing due to run correctly due to them missing command
line arguments like their name or running in a corrupted environment resulting
in odd things like not being able to read their home directory.

The programs used to run fine on the netbsd-6 branch.


>How-To-Repeat:
Run a Linux binary and see that the results are not the same as they used to
be, programs not printing their names correctly, complaining about missing
argument, excess garbage at the end of command line processing or just plainly
not being able to find things like their home directory.


>Fix:
Revert sys/compat/linux/common/linux_exec_elf32.c back to v1.86:

/* $NetBSD: linux_exec_elf32.c,v 1.86 2012/02/12 16:34:10 matt Exp $ */

and see that the programs run again as expected.



>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: kern-bug-people->chs
Responsible-Changed-By: chs@NetBSD.org
Responsible-Changed-When: Tue, 14 Jan 2014 14:43:07 +0000
Responsible-Changed-Why:
looks like my bug


From: "Chuck Silvers" <chs@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/48518 CVS commit: src/sys/compat
Date: Sun, 9 Feb 2014 16:41:43 +0000

 Module Name:	src
 Committed By:	chs
 Date:		Sun Feb  9 16:41:42 UTC 2014

 Modified Files:
 	src/sys/compat/linux/arch/alpha: linux_exec.h
 	src/sys/compat/linux/arch/arm: linux_exec.h
 	src/sys/compat/linux/arch/i386: linux_exec.h
 	src/sys/compat/linux/arch/m68k: linux_exec.h
 	src/sys/compat/linux/arch/mips: linux_exec.h
 	src/sys/compat/linux/arch/powerpc: linux_exec.h
 	src/sys/compat/linux/common: linux_exec.h linux_exec_elf32.c
 	src/sys/compat/linux32/arch/amd64: linux32_exec.h
 	src/sys/compat/linux32/common: linux32_exec_elf32.c

 Log Message:
 account for the 16 bytes of AT_RANDOM data in the stack setup.  fixes PR 48518.
 use cprng_strong32() instead of random().  add AT_RANDOM support for linux32.


 To generate a diff of this commit:
 cvs rdiff -u -r1.11 -r1.12 src/sys/compat/linux/arch/alpha/linux_exec.h
 cvs rdiff -u -r1.8 -r1.9 src/sys/compat/linux/arch/arm/linux_exec.h
 cvs rdiff -u -r1.11 -r1.12 src/sys/compat/linux/arch/i386/linux_exec.h
 cvs rdiff -u -r1.10 -r1.11 src/sys/compat/linux/arch/m68k/linux_exec.h
 cvs rdiff -u -r1.14 -r1.15 src/sys/compat/linux/arch/mips/linux_exec.h
 cvs rdiff -u -r1.22 -r1.23 src/sys/compat/linux/arch/powerpc/linux_exec.h
 cvs rdiff -u -r1.49 -r1.50 src/sys/compat/linux/common/linux_exec.h
 cvs rdiff -u -r1.87 -r1.88 src/sys/compat/linux/common/linux_exec_elf32.c
 cvs rdiff -u -r1.4 -r1.5 src/sys/compat/linux32/arch/amd64/linux32_exec.h
 cvs rdiff -u -r1.13 -r1.14 src/sys/compat/linux32/common/linux32_exec_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: chs@NetBSD.org
State-Changed-When: Mon, 10 Feb 2014 00:16:22 +0000
State-Changed-Why:
can you confirm that this problem is fixed now?


State-Changed-From-To: feedback->closed
State-Changed-By: reinoud@NetBSD.org
State-Changed-When: Mon, 22 Sep 2014 12:03:55 +0000
State-Changed-Why:
Problem is fixed and found to work fine in 7.0_BETA


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