Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loadable kernel modules #63

Open
docbrown opened this issue Feb 5, 2016 · 7 comments
Open

Loadable kernel modules #63

docbrown opened this issue Feb 5, 2016 · 7 comments

Comments

@docbrown
Copy link

docbrown commented Feb 5, 2016

Is it possible to support loadable kernel modules in LKL and, if so, what sort of changes would have to be made to get that working? I would like to create a USB host controller driver that delegates to the host system's USB API and it would be great if I could test it without rebuilding and redeploying my entire application every time.

@docbrown
Copy link
Author

docbrown commented Feb 5, 2016

I got a chance to look at this a little deeper and it appears the module loading code is pretty architecture-specific. Relocations have to be done differently depending on which architecture the ELF module was built for. I guess it will be easier to just build the driver along with the kernel.

thehajime pushed a commit to libos-nuse/lkl-linux that referenced this issue May 15, 2016
…er()

When unexpected situation happened (e.g. tx/rx irq happened while
DMAC is used), the usbhsf_pkt_handler() was possible to cause NULL
pointer dereference like the followings:

Unable to handle kernel NULL pointer dereference at virtual address 00000000
pgd = c0004000
[00000000] *pgd=00000000
Internal error: Oops: 80000007 [#1] SMP ARM
Modules linked in: usb_f_acm u_serial g_serial libcomposite
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.5.0-rc6-00842-gac57066-dirty lkl#63
Hardware name: Generic R8A7790 (Flattened Device Tree)
task: c0729c00 ti: c0724000 task.ti: c0724000
PC is at 0x0
LR is at usbhsf_pkt_handler+0xac/0x118
pc : [<00000000>]    lr : [<c03257e0>]    psr: 60000193
sp : c0725db8  ip : 00000000  fp : c0725df4
r10: 00000001  r9 : 00000193  r8 : ef3ccab4
r7 : ef3cca10  r6 : eea4586c  r5 : 00000000  r4 : ef19ceb4
r3 : 00000000  r2 : 0000009c  r1 : c0725dc4  r0 : ef19ceb4

This patch adds a condition to avoid the dereference.

Fixes: e73a989 ("usb: renesas_usbhs: add DMAEngine support")
Cc: <[email protected]> # v3.1+
Signed-off-by: Yoshihiro Shimoda <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
@allientneko
Copy link

Is this going to be implemented? Although module loading code is pretty architecture-specific, sometimes this still can be fixed ( in a hard way). This feature is useful for me as I have some kernel module which only supports kernel 3.10. I would like to try the module on my new machine.

@tavip
Copy link
Member

tavip commented Apr 27, 2017

@allientneko If you have the sources of the module you can stitch it in the kernel build, it is pretty easy to do.

@copumpkin
Copy link

Also related to #347

@allientneko
Copy link

@tavip
That's the problem. I do not have the source code.
The company stops maintaining the module.
However, I do agree that it may take a lot of effort to run the module even if LKL support this feather.

@tavip
Copy link
Member

tavip commented Apr 27, 2017

@allientneko Without source code it would be difficult to make the module work since that would require LKL to be compiled with the same options as the module, which might not be be even possible.

@allientneko
Copy link

allientneko commented Apr 27, 2017

@tavip
The only flags the module requires are SMP(Symmetric multiprocessing) and x64.
The module symbol of the kernel module needs to be remapping to avoid "disagrees about version of symbol struct_module."

I tried it on UML. Almost there.
However, UML does not support SMP.
Hmm.....
I should give up the obsolete kernel module and move on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants