tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Enhanced usability of syscall_{,disestablish}



Currently, the syscall_autoload capability (sys_nomodule() routine in
kern/kern_syscall.h) works only with the default emulation, even though
syscall_{,dis}establish() can handle addition (or removal) of syscall
packages to other emulations.

Because of this restriction in sys_nomodule(), non-default emulations
can only be "enhanced" by manually loaded modules.

This leads to the current practice of having "everything including the
kitchen sink" included in non-default emulations, e.g. compat_netbsd32.

When the module is built-in to the kernel, either all of the potential
dependencies must also be built-in (and the module header must identify
the list of dependencies), or the module must be built with some of the
functionality omitted.  (Dependencies for built-in modules cannot be
resolved through the auto-load mechanism.)  Neither approach is optimal.

Including everything in kernel results in "bloat" (and sort of defeats
the purpose of modularity) for things that are not intended to be used.

Building the built-in compat module with reduced content precludes the
ability to use the omitted features, _even_if_ the underlying features
are later loaded into the kernel.

As an example, compat_netbsd32 currently includes the possibility of
translating the posix mqueue syscalls from 32-bit to 64-bit mode.  If
you include the compat_netbsd32 built-in module in your kernel, you
must also include mqueue.  Perhaps not a big deal, but the same is
true for nfsserver (due to translation of the nfssrv syscall) as
reported in PRs kern/50410 and kern/50468

I've opened a change-request PR kern/50489 to document this, and I have
proposed the following implementation:

	* 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 (inclusion of) 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 (probably are) additional details that will be needed,
but I think this is a reasonable approach.  It would enable us to load
a "basic" compat_netbsd32 module, and if (for example) the user were to
execute a 32-bit version of nfsd(8) or mountd(8), the invocation of the
nfssvc syscall would trigger auto-loading of a compat_netbsd32_nfssrv
module (and if not already present, the "requires" would auto-load the
native nfsserver module), which would be able to syscall_establish()
its own package of syscalls.

Comments?  Suggestion?


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


Home | Main Index | Thread Index | Old Index