NetBSD-Bugs archive

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

port-sun3/54869: nfsserver module load failure on NetBSD/sun3



>Number:         54869
>Category:       port-sun3
>Synopsis:       nfsserver module load failure on NetBSD/sun3
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    port-sun3-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jan 18 06:15:00 +0000 2020
>Originator:     Izumi Tsutsui
>Release:        NetBSD 9.0_RC1
>Organization:
>Environment:
System: NetBSD mirage 9.0_RC1 NetBSD 9.0_RC1 (GENERIC) #13: Fri Jan 17 21:38:33 JST 2020 tsutsui@mirage:/s/netbsd-9/src/sys/arch/i386/compile/GENERIC i386
Architecture: m68k
Machine: sun3
>Description:
"modload nfsserver" on NetBSD/sun3 9.0_RC1 (GENERIC+MODULAR kernel) fails:
---
# uname -a
NetBSD  9.0_RC1 NetBSD 9.0_RC1 (MODULAR) #0: Tue Jan 14 23:20:20 JST 2020  tsutsui@mirage:/s/netbsd-9/src/sys/arch/sun3/compile/MODULAR sun3
# modload nfsserver
[ 361.3700220] kobj_checksyms, 988: [nfsserver]: linker error: symbol `pmap_update' not found
[ 361.4200220] WARNING: module error: unable to affix module `nfsserver', error 8
modload: nfsserver: Exec format error
# modload msdos
# modload ext2fs
# 
---

>How-To-Repeat:
- Build NetBSD/sun3 kernel with GENERIC + MODULAR
- Use netboot to boot NetBSD/sun3 9.0_RC1 to singleuser
(symbol table is not loaded properly via ufsboot; I'll file another PR.)
- modload nfsserver

>Fix:
Actually src/sys/nfs/nfs_serv.c has pmap_update() in nfsrv_read():
 https://nxr.netbsd.org/xref/src/sys/nfs/nfs_serv.c?r=1.177#747
---
    740 			/* map pages */
    741 			for (i = 0; i < npages; i++) {
    742 				pmap_kenter_pa(lva, VM_PAGE_TO_PHYS(pgpp[i]),
    743 				    VM_PROT_READ, 0);
    744 				lva += PAGE_SIZE;
    745 			}
    746 
    747 			pmap_update(pmap_kernel());
    748 
    749 			mb->m_next = m;
    750 			mb = m;
    751 			error = 0;
    752 			uiop->uio_resid = 0;
---

On the other hand, all m68k ports define pmap_update() as no-op:
---
% grep pmap_update sys/arch/*/include/*.h
sys/arch/m68k/include/pmap_motorola.h:#define   pmap_update(pmap)               /* nothing (yet) */

 :

sys/arch/sun2/include/pmap.h:#define    pmap_update(pmap)               /* nothing (yet) */
sys/arch/sun3/include/pmap3.h:#define   pmap_update(pmap)               /* nothing (yet) */
sys/arch/sun3/include/pmap3x.h:#define  pmap_update(pmap)               /* nothing (yet) */
---

sys/arch/sun3/include/pmap3.h is included from sys/arch/sun3/include/pmap.h
by _SUN3_ or _SUN3X_:
 https://nxr.netbsd.org/xref/src/sys/arch/sun3/include/pmap.h?r=1.32#32
---
     32 #ifdef	_SUN3_
     33 #include <machine/pmap3.h>
     34 #endif	/* SUN3 */
     35 #ifdef	_SUN3X_
     36 #include <machine/pmap3x.h>
     37 #endif	/* SUN3X */
     38 
     39 #ifdef _KERNEL
     40 void pmap_procwr(struct proc *, vaddr_t, size_t);
     41 #endif
---

On module builds, neither _SUN3_ or _SUN3X_ is defined,
so pmap_update() is not defined then it causes the undefined refernece.

Which is better to solve this issue?
(1) move pmap_update() definition to sun3/include/pmap.h
(2) implicitly include pmap3.h on module builds
    (not sure if modules require pmap details that are defferent
     between sun3 and sun3x)

sun3/include/param.h and sun3/include/vmparam.h had the same problem,
but IIRC I changed all references of KERNBASE, KERN_END, USRSTACK etc.
to use variables:
 http://www.nerv.org/netbsd/?q=id:20101015T155554Z.478e44a7b8b76dcff1653a7bb0611ea28e9b4a46

---
Izumi Tsutsui



Home | Main Index | Thread Index | Old Index