On Sat, Jul 26, 2025 at 09:11:44PM +0200, Nemanja Simonovic wrote:
> 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.

Thank your for reporting back the cause of error.  That will help other
people in the future.

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

I haven't done this before, so no idea if this helps.

gdb has an add-symbol-file command.  And
$OBJDIR/sys/modules/hello/hello/kmod.debug should have symbols.  Note that
that file probably is not installed to /stand.

add-symbol-file needs the address where the .text section was loaded.  I
don't know how to get that. 

However, hello.c has only calls to printf().  Perhaps the references to that
function are not correctly resolved?  Or maybe they are not resolved to the
correct function.  This should be calling the kernel printf which might
have been renamed to rumpns_printf?  But maybe it doesn't make a
difference.

I also don't know what to make of the backtraces you quoted.

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

These cannot be the actual arguments to that function.

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

This looks better.  I was wondering why "/module.mod"?  And discovered
this:
https://nxr.netbsd.org/xref/src/usr.bin/rump_allserver/rump_allserver.c#411

I guess that should be "modarray[i]", otherwise with multiple "-m" it loads
the first module multiple times, doesn't it?

--chris

Reply via email to