[Toybox] Vm for lkmpg
Rob Landley
rob at landley.net
Sun Jan 19 12:26:30 PST 2025
On 1/19/25 02:45, Berkem Dincman wrote:
> I'm using System Images for building and executing examples from the Linux
> Kernel Module Guide if I insert a modüle via
> insmod procfs1.ko
> I get the first result
> toybox insmod hello-5.ko
> without the error messages
> just out of curiosity
Try running it under strace? The insmod.c insmod_main() code is
basically doing:
rc = syscall(SYS_finit_module, fd, toybuf, 0);
if (rc && blah) rc = syscall(SYS_init_module, buf, len, toybuf);
if (rc) perror_exit("failed to load %s", toys.optargs[0]);
Which should print an error if both syscalls fail. The only way NOT to
print an error is for one or the other syscall to return 0.
Your attached screenshots show dmesg complaining about tainting the
kernel and ignoring unrecognized parameters, but neither is actually an
error preventing the module from loading.
Are you sure that's the exact command line you called? It seems weird
that your second screen shot has parameters winding up in toybuf when
the command is "<1" requiring at least one argument and then loops
through from entry 1 of a NULL terminated list (where 0 was the module
name). If you didn't provide more command line arguments, it should hit
null the first time through the loop and leave toybox completely
null-filled...
Although two screenshots being attached with different results is
already a bit confusing to me...
Rob
P.S. I should really go do more work in the toybox strace in pending.
There's ancient static strace binaries for various architectures at
https://landley.net/aboriginal/downloads/old/binaries/1.4.3/extras/ but
that old system builder project never supported arm64 because the
compiler went gplv3...
More information about the Toybox
mailing list