NetBSD Problem Report #50410

From martin@aprisoft.de  Fri Nov  6 17:01:54 2015
Return-Path: <martin@aprisoft.de>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(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 ED190A5674
	for <gnats-bugs@gnats.NetBSD.org>; Fri,  6 Nov 2015 17:01:54 +0000 (UTC)
Message-Id: <20151106170144.614F0ED0E4F@emmas.aprisoft.de>
Date: Fri,  6 Nov 2015 18:01:44 +0100 (CET)
From: martin@NetBSD.org
Reply-To: martin@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: no netbsd32 compat w/o nfsserver
X-Send-Pr-Version: 3.95

>Number:         50410
>Category:       kern
>Synopsis:       no netbsd32 compat w/o nfsserver
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pgoyette
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Nov 06 17:05:00 +0000 2015
>Closed-Date:    Mon Jan 11 02:16:59 +0000 2016
>Last-Modified:  Mon Jan 11 02:16:59 +0000 2016
>Originator:     Martin Husemann
>Release:        NetBSD 7.99.21
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD nelly.aprisoft.de 7.99.21 NetBSD 7.99.21 (NELLY) #2: Fri Nov 6 17:32:48 CET 2015 martin@seven-days-to-the-wolves.aprisoft.de:/ssd/src/sys/arch/sparc64/compile/NELLY sparc
Architecture: sparc
Machine: sparc
>Description:

Booting a sparc64 machine with 64bit kernel and 32bit userland fails, if the
non-modular kernel does not have options NFSSERVER.

At boot I get the message:

WARNING: module error: can't find builtin dependency `nfsserver'

and exec'ing /sbin/init fails.

Adding the option to the kernel makes the machine boot, and modstat shows:

NAME             CLASS      SOURCE     REFS  ADDRESS          SIZE     REQUIRES 
compat_netbsd32  exec       builtin    0     0                -        compat,compat_sysv,nfsserver,mqueue,exec_elf32


>How-To-Repeat:
s/a

>Fix:
Make the module dependency #ifdef NFSSERVER for the builtin (or at least 
non-MODULAR) case?

>Release-Note:

>Audit-Trail:
From: Paul Goyette <paul@vps1.whooppee.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/50410 no netbsd32 compat w/o nfsserver
Date: Sat, 28 Nov 2015 07:27:10 +0800 (PHT)

 > >Fix:
 > Make the module dependency #ifdef NFSSERVER for the builtin (or at
 > least non-MODULAR) case?

 The real issue is that the compat_netbsd32 code references do_nfssvc 
 from object file netbsd32_nfssvc.o (which in turn resolves other 
 references to netbsd32_nfssvc (a compat syscall entry point).

 The compat_netbsd32 module unconditionally includes these references to 
 nfs.

 So to remove the dependency, you have to rebuild the module without nfs 
 support.  Removing netbsd32_nfssvc.c from the list of source files, as 
 well as updating source files netbsd32_syscalls.c and netbsd32_sysent.c, 
 would be required.

 Making these changes would prevent use of the nfssvc sys-call in 32-bit 
 images.  So, if you have a 64-bit system and only 32-bit userland, you 
 would lose the ability to run the /usr/sbin/nfsd or /usr/sbin/mountd 
 32-bit images.

 I suspect we could split the NFS-related stuff into a separate module 
 (compat_netbsd32_nfs) ...


 +------------------+--------------------------+-------------------------+
 | Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:       |
 | (Retired)        | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com    |
 | Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd.org  |
 +------------------+--------------------------+-------------------------+

From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/50410 no netbsd32 compat w/o nfsserver
Date: Sat, 28 Nov 2015 17:08:44 +0100

 Please note that my original case was a custom kernel w/o any module
 support and everything build in (but no NFS server).

 I agree that the module is hard to fix (and may not be worth to try),
 but the non-MODULAR case should either fail to build or just work.

 Martin

From: Paul Goyette <paul@vps1.whooppee.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: PR/50410 no netbsd32 compat w/o nfsserver
Date: Mon, 30 Nov 2015 10:20:42 +0800 (PHT)

 (resend since first time doesn't seem to have gone through)

 > Please note that my original case was a custom kernel w/o any module
 > support and everything build in (but no NFS server).
 > 
 > I agree that the module is hard to fix (and may not be worth to try),
 > but the non-MODULAR case should either fail to build or just work.

 The problem is actually wider than just nfsserver.

 The compat_netbsd32 module also assumes other optional components are
 available in the base kernel, for example SYSV{SEM,SHM,MSG}.  If you
 try to load the current compat_netbsd32 module on a kernel which does
 not include the SYSV options, you get undefined symbol errors.  This
 would generally mean that the module needs to depend on some other
 module which provides those symbols.

 However, adding "sysv_ipc" to the list of required modules for compat_netbsd32 
 will prevent a built-in variant of the compat_netbsd32 module from 
 initializing.

 The general problem is that the compat_netbsd32 module assumes that all of the 
 required non-compat code is built-in to the kernel, rather than being 
 optionally loaded.  There are two possible solutions:

 * Reduce the granularity of modularity for the base kernel, or
 * Split the compat_netbsd32 module into corresponding multiple modules which 
 can be individually loaded (ie, compat_netbsd32_sysv_ipc, 
 compat_netbsd32_nfsserver, etc.)

 I'm working on the latter approach.  It will take some time to implement and 
 test.


 +------------------+--------------------------+-------------------------+
 | Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:       |
 | (Retired)        | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com    |
 | Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd.org  |
 +------------------+--------------------------+-------------------------+

Responsible-Changed-From-To: kern-bug-people->pgoyette
Responsible-Changed-By: pgoyette@NetBSD.org
Responsible-Changed-When: Sat, 05 Dec 2015 05:18:03 +0000
Responsible-Changed-Why:
I'm fixing it.


State-Changed-From-To: open->feedback
State-Changed-By: pgoyette@NetBSD.org
State-Changed-When: Sat, 05 Dec 2015 05:18:03 +0000
State-Changed-Why:
This should have been fixed by my recent reorg of the compat_netbsd code.

Please confirm so we can close the PR.


State-Changed-From-To: feedback->closed
State-Changed-By: pgoyette@NetBSD.org
State-Changed-When: Mon, 11 Jan 2016 02:16:59 +0000
State-Changed-Why:
The bug is gone.


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