NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
kern/48161: kern-config with NFS-server and without NFS-client fails to work correctly
>Number: 48161
>Category: kern
>Synopsis: kern-config with NFS-server and without NFS-client fails to
>work correctly
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Aug 29 11:40:00 +0000 2013
>Originator: Dr. Wolfgang Stukenbrock
>Release: NetBSD 6.1
>Organization:
Dr. Nagler & Company GmbH
>Environment:
System: NetBSD s047 6.1 NetBSD 6.1 (NSW-S047) #2: Thu Aug 29 11:42:05 CEST 2013
root@s047:/usr/src/sys/arch/amd64/compile/NSW-S047 amd64
Architecture: x86_64
Machine: amd64
>Description:
There are two ways to build a kernel taht uses NFS:
- user MODULAR framework to load the NFS parts
- kompile NFS-stuff into kernel
The first case is OK as it is: NFS-client code alway needed, because
server part resues some routines.
If someone is useing dynamic module loading, the security constrains
for such a system are low to medium.
If there is a need for a hihg-secure system, dynamic loading should be
avoided and only the required
parts should be compiled into the kernel.
As far as good.
It is possible to do this with NetBSD. It is possible to setup an
Server that should act as NFS-server but
may never access other systems as NFS-client. ("options NFSSERVER" set,
but no "file-system NFS")
Such a kernel will compile correctly but then fails to initialize the
NFS-server part.
The problem is the code reuse of some NFS-client-routines - e.g.
nfs_init() as far as I've seen.
For the first version of NFS in the kernel, the NFS-server-module must
add NFS-client-code as dependency,
but in for the second case thsi may not be done.
remark: currently there is a comment for a workaround in
sys/kern/kern_module.c function module_do_buildin()
to support this case - dependency of module is missing, but the
module has linked into the kernel.
Accedently such a module is present in the kernel and would be able to
do it's job, but due to the missing
dependency the initialisation is skipped and therefore the
systemcall-function for sys_nfssvc() in this case
is not injected into the table - sys_nomodule() function is still there.
This results e.g. in an error while starting mountd that detects no
NFS-server-support in the kernel.
>How-To-Repeat:
Setup an kernel with "options NFSSERVER" but without NFS client code.
(MODULAR support may be present
or not - this changes nothing.) The resulting kernel has the code in
it, but it is not usable.
>Fix:
The problem is that we need to distinguish between a build inside a
kernel and for a build as module.
Up to now there is no CPP definition to do this.
The following patch adds a new preprocesser definition DO_MODULE_BUILD
that will be set during every
module compilation and the nfsserver-module setup will differenciate
between module and normal kernel
build.
This patch solves the problem in a way that other modules may use this
definition in the future too.
Perhaps it would make sence to modify the MODULE() macro in case of
normal kernel build to ignore the last
parameter instead of changeing nfs_serv.c, because a kernel will fail
to link if a "real" dependency is missing.
It doesn't make lot of sence to check dependencies at run-time, that
have already been enforced at link-time.
patch for src/sys/modules/Makefile.inc:
--- Makefile.inc 2013/08/29 10:13:38 1.1
+++ Makefile.inc 2013/08/29 10:13:57
@@ -1,7 +1,7 @@
# $NetBSD: Makefile.inc,v 1.6 2011/09/11 18:38:02 mbalmer Exp $
S!= cd ${.PARSEDIR}/..;pwd
-CPPFLAGS+= -I${NETBSDSRCDIR}/common/include
+CPPFLAGS+= -I${NETBSDSRCDIR}/common/include -DDO_MODULE_BUILD
USE_FORT= no
WARNS?= 3
patch for src/sys/nfs/nfs_serv.c:
--- nfs_serv.c 2013/08/29 10:12:24 1.1
+++ nfs_serv.c 2013/08/29 10:12:55
@@ -86,7 +86,11 @@
#include <nfs/nfsm_subs.h>
#include <nfs/nfs_var.h>
+#ifdef DO_MODULE_BUILD
MODULE(MODULE_CLASS_MISC, nfsserver, "nfs");
+#else
+MODULE(MODULE_CLASS_MISC, nfsserver, NULL);
+#endif
/* Global vars */
extern u_int32_t nfs_xdrneg1;
>Unformatted:
Home |
Main Index |
Thread Index |
Old Index