Re: rump_server, "panic: uvm_km_alloc failed" on module load

Nemanja Simonovic <[email protected]>
Newsgroups gmane.os.netbsd.devel.kernel
Message-ID <[email protected]>
Thank you for replying, I am new to the system so any direction
means a lot.

I've tracked down uvm_km_alloc failed to PaX mprotect restrictions
for underlying mmap. t_modautoload passes as it has +a +m paxctl
flags.

Now I am hitting following problem: any module which calls functions
from modcmd segfaults. For instance des.kmod wihtout any calls from
modcmd loads fine, while examples/hello.kmod crashes.

Here is back trace. gdb doesn't see symbols for loaded module.


--------------------------------
./rump_server -s -v -m 
/stand/amd64/10.99.14/modules/examples/hello/hello.kmod   unix://sock

(gdb) bt
#0  0x00000000680d696c in ?? ()
#1  0x000000007fffe039 in ?? ()
#2  0x00007f7fffebb300 in ?? ()
#3  0x0000796168125c87 in module_do_load (name=0x79616814f602 
<mutex_exit+108> 
"\220H\211\354]\303UH\211\345H\203\354\bH\211}\370\270\001", isdep=127, 
flags=-149928913, props=0x796168151d54 <uvm_km_protect>,
     modp=0x7f7ff7109a55 <_rtld_shared_exit+51>, modclass=31073, 
autoload=152) at 
/home/nemanja/source/src/lib/librump/../../sys/rump/../kern/kern_module.c:1420
Backtrace stopped: frame did not save the PC

...

1417            module_load_evcnt(mod);         /* Attach any static 
evcnt needed */
(gdb) bt
#0  module_do_load (name=0x7a53c3b525c0 "/module.mod", isdep=false, 
flags=0, props=0x0, modp=0x0, modclass=MODULE_CLASS_ANY, autoload=false) 
at 
/home/nemanja/source/src/lib/librump/../../sys/rump/../kern/kern_module.c:1417
#1  0x00007a53c42b3187 in module_load (filename=0x7a53c3b525c0 
"/module.mod", flags=0, props=0x0, modclass=MODULE_CLASS_ANY) at 
/home/nemanja/source/src/lib/librump/../../sys/rump/../kern/kern_module.c:713
#2  0x00007a53c4228146 in handle_modctl_load (ml_filename=0xf1fb73 
"/module.mod", ml_flags=0, ml_props=0x0, ml_propslen=0) at 
/home/nemanja/source/src/lib/librump/../../sys/rump/../kern/sys_module.c:99
#3  0x00007a53c42288ec in sys_modctl (l=0x7a53c3b52180, 
uap=0x7f7fff7bb878, retval=0x7f7fff7bb868) at 
/home/nemanja/source/src/lib/librump/../../sys/rump/../kern/sys_module.c:285
#4  0x00007a53c42e8f88 in sy_call (sy=0x7a53c433c750 
<rumpns_sysent+5904>, l=0x7a53c3b52180, uap=0x7f7fff7bb878, 
rval=0x7f7fff7bb868) at 
/home/nemanja/source/src/lib/librump/../../sys/rump/../sys/syscallvar.h:65
#5  0x00007a53c42e9057 in sy_invoke (sy=0x7a53c433c750 
<rumpns_sysent+5904>, l=0x7a53c3b52180, uap=0x7f7fff7bb878, 
rval=0x7f7fff7bb868, code=246) at 
/home/nemanja/source/src/lib/librump/../../sys/rump/../sys/syscallvar.h:94
#6  0x00007a53c42ea601 in rump_syscall (num=246, data=0x7f7fff7bb878, 
dlen=16, retval=0x7f7fff7bb868) at 
/home/nemanja/source/src/lib/librump/../../sys/rump/librump/rumpkern/rump.c:782
#7  0x00007a53c42d8a08 in rump___sysimpl_modctl (cmd=0, 
arg=0x7f7fff7bb920) at 
/home/nemanja/source/src/lib/librump/../../sys/rump/librump/rumpkern/rump_syscalls.c:2716
#8  0x0000000000f1e5b4 in main (argc=<optimized out>, argv=<optimized 
out>) at 
/home/nemanja/source/src/usr.bin/rump_server/../rump_allserver/rump_allserver.c:420
--------------------------------



On 7/10/25 23:43, Christoph Badura wrote:
> On Thu, Jul 10, 2025 at 06:27:59PM +0200, Nemanja Simonovic wrote:
>> I tried asking this on users list but got no reply.
> 
> I saw it but didn't have time to reply yet.
> 
>> When trying to load modules to rump_server I am getting kernel
>> "panic: uvm_km_alloc failed". Both with -m parameter and with
>> rump.modload.
> 
> That message comes from:
> https://nxr.netbsd.org/xref/src/sys/rump/librump/rumpkern/vm.c#888
> 
>> I not sure if I am doing something wrong or hitting a bug?
> 
> We do have 3 ATF tests that deal with rump module loading:
> 
> src/tests/rump/modautoload/t_modautoload.c
> src/tests/rump/rumpkern/t_modcmd.c
> src/tests/rump/rumpkern/t_modlinkset.c
> 
> These tests pass OK:
> https://releng.netbsd.org/b5reports/amd64/2025/2025.07.10.11.44.12/test.log
> 
> But the use neither -m nor rump.modload.  Could be the implementation for
> -m or rump.modload has bitrotted.  I don't know.
> Could be you are doing something wrong.
> 
> Have you tried debugging this with gdb?
> 
> Set a break point in rumpkern/vmc line 878, the call to rumpuser_anonmap(),
> and step through that function and see where it fails.
> 
> --chris
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.