NetBSD Problem Report #50489

From paul@pokey.whooppee.com  Mon Nov 30 02:14:53 2015
Return-Path: <paul@pokey.whooppee.com>
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 475D6A6551
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 30 Nov 2015 02:14:53 +0000 (UTC)
Message-Id: <20151130021301.50D3116E7D@pokey.whooppee.com>
Date: Mon, 30 Nov 2015 10:13:01 +0800 (PHT)
From: paul@whooppee.com
Reply-To: paul@whooppee.com
To: gnats-bugs@NetBSD.org
Subject: non-default emulations lack extensability via syscall_establish
X-Send-Pr-Version: 3.95

>Number:         50489
>Category:       kern
>Synopsis:       non-default emulations lack extensability via syscall_establish
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pgoyette
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Nov 30 02:15:00 +0000 2015
>Closed-Date:    Sat Dec 05 05:20:44 +0000 2015
>Last-Modified:  Sat Dec 05 05:20:44 +0000 2015
>Originator:     paul@whooppee.com
>Release:        NetBSD 7.99.21
>Organization:
+------------------+--------------------------+-------------------------+
| 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  |
+------------------+--------------------------+-------------------------+
>Environment:


System: NetBSD pokey.whooppee.com 7.99.21 NetBSD 7.99.21 (POKEY 2015-11-22 01:39:12) #1: Sun Nov 22 11:03:58 PHT 2015 paul@pokey.whooppee.com:/build/netbsd-local/obj/amd64/sys/arch/amd64/compile/POKEY amd64
Architecture: x86_64
Machine: amd64
>Description:

	Currently, the capabilities of the default emulation can be
	enhanced by dynamic loading of modules which install new
	syscalls (via syscall_{,dis}establish in kern/kern_syscall.c).

	But this extensibility feature is only available in the default
	emulation.  For other emulations, particularly compat_netbsd32,
	the emulation's cabilities need to be built-in to the relevant
	module, so the module becomes an all-or-nothing.

	Additionally, the compat_netbsd32 module ends up with potentially
	lots of dependencies on other modules, and convoluted #ifdef
	blocks to determine availability of the dependencies in built-in
	version.  This also restricts the ability of the compat module
	to gain capabilities if underlying default-emulation modules are
	loaded to provide the back-end capabilities.
>How-To-Repeat:

>Fix:

	* Modify the 'struct emul' to contain a pointer to a per-emulation
	  list of syscalls which can be resolved by a module auto-load
	  (currently, only the default emulation has such a list)
	* Modify the sys_nomodule() routine (in kern/kern_syscall.h) to
	  reference the per-emulation list, and remove the restriction on
	  (em == &emul_netbsd)
	* Move the current list of autoloadable syscalls to kern/kern_exec.c
	  where it can be included in the initialization of the default
	  emulations' 'struct emul emul_netbsd'
	* Update the syscall list(s) in the various compat modules to have
	  their own list of autoloadable syscalls
	* Split the existing compat modules into multiple modules, and
	  update the new modules to call syscall_{,dis}establish as
	  appropriate

	(There might be other details I haven't included above, but this
	should be a pretty good start on design spec.)

>Release-Note:

>Audit-Trail:
From: "Paul Goyette" <pgoyette@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/50489 CVS commit: src/distrib/sets/lists/modules
Date: Tue, 1 Dec 2015 09:15:58 +0000

 Module Name:	src
 Committed By:	pgoyette
 Date:		Tue Dec  1 09:15:58 UTC 2015

 Modified Files:
 	src/distrib/sets/lists/modules: ad.arm ad.mips md.amd64

 Log Message:
 Finish up with the new compat_netbsd32_nfssrv module by adding it to
 the sets lists.

 This set of commits together should address PRs kern/50410 and kern/50486.

 This is also the first of several new modules to be created in response to
 PR kern/50489


 To generate a diff of this commit:
 cvs rdiff -u -r1.5 -r1.6 src/distrib/sets/lists/modules/ad.arm \
     src/distrib/sets/lists/modules/ad.mips
 cvs rdiff -u -r1.63 -r1.64 src/distrib/sets/lists/modules/md.amd64

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

From: "Paul Goyette" <pgoyette@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/50489 CVS commit: src/sys/compat/netbsd32
Date: Tue, 1 Dec 2015 23:56:44 +0000

 Module Name:	src
 Committed By:	pgoyette
 Date:		Tue Dec  1 23:56:44 UTC 2015

 Modified Files:
 	src/sys/compat/netbsd32: netbsd32_compat_50.c netbsd32_mod.c
 	    netbsd32_mqueue.c syscalls.master

 Log Message:
 Prepare for new compat_netbsd32_mqueue module to be split out of
 compat_netbsd32.  Refactor the COMPAT_50 code related to mqueue,
 and update the syscall definitions.  Remove dependency on mqueue
 from the compat_netbsd32 module (the new module will gain this
 dependency).

 Continuation of work on PR kern/50489


 To generate a diff of this commit:
 cvs rdiff -u -r1.30 -r1.31 src/sys/compat/netbsd32/netbsd32_compat_50.c
 cvs rdiff -u -r1.11 -r1.12 src/sys/compat/netbsd32/netbsd32_mod.c
 cvs rdiff -u -r1.5 -r1.6 src/sys/compat/netbsd32/netbsd32_mqueue.c
 cvs rdiff -u -r1.110 -r1.111 src/sys/compat/netbsd32/syscalls.master

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

Responsible-Changed-From-To: kern-bug-people->pgoyette
Responsible-Changed-By: pgoyette@NetBSD.org
Responsible-Changed-When: Sat, 05 Dec 2015 05:20:44 +0000
Responsible-Changed-Why:
I did the work.


State-Changed-From-To: open->closed
State-Changed-By: pgoyette@NetBSD.org
State-Changed-When: Sat, 05 Dec 2015 05:20:44 +0000
State-Changed-Why:
syscall_{,dis}establish() now deals with non-default emulations.

compat_netbsd32 modules have been adapted/created to take advantage.


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