1

I am porting the driver for a USB device to Rocky Linux 9.3. Once the module is inserted, new logins by ssh are unresponsive. Blacklisting the module and rebooting restores normal functionality.

https://github.com/izot/lon-driver


With the module inserted, lsmod|grep u50 "Used By" goes from 0 to 1 about every 7 secs. Then, when an SSH login is attempted, Used By goes between 3 and 2.

Stop the SSH login, modprobe -r u50, try again... Now SSH gets motd but no prompt and says "PTY allocation request failed on channel 0."

ssh SITE "/bin/bash -i" (login succeeds) (same with module inserted)

modinfo u50

filename:       /lib/modules/5.14.0-362.18.1.el9_3.x86_64/kernel/drivers/lon/u50.ko
description:    U50 SMIP Driver 1.4 L2
alias:          tty-ldisc-28
license:        GPL
rhelversion:    9.3
srcversion:     311B898EC0CC268466EA85B
depends:
retpoline:      Y
name:           u50
vermagic:       5.14.0-362.18.1.el9_3.x86_64 SMP preempt mod_unload modversions

With the module removed, journalctl shows "error: openpty: Cannot allocate memory" and "error: session_pty_req: session 0 alloc failed."

With the module inserted again and an SSH attempt, journalctl shows "NetworkManager ... manager: (lon10): new Generic device (/org/freedesktop/NetworkManager/Devices/743)" and "NetworkManager ... manager: (lon11): new Generic device (/org/freedesktop/NetworkManager/Devices/744)."

When the SSH attempt is canceled, journalctl shows "Removing a network device that was not added" twice.


I finally have gdb setup to remotely debug. I copied the src to the host running gdb. I can break at a function in the loadable module but that is too late. I need to break when the module is loaded and it kills new ssh logins. This module is for USB and is not related to ssh.

I can break at do_init_module() and step until exit_to_user_mode_loop() then it says "Cannot find bounds of current function." Setting a breakpoint at module_init() for a future load does not break.

5
  • Porting also means debugging.
    – Bib
    Feb 9 at 10:38
  • Can I use VirtualBox for debugging this? I tried QEMU but haven't gotten the network setup correctly. Feb 12 at 19:26
  • Do I need to move this to stackoverflow? I am not getting any help here. Feb 20 at 16:32
  • Why not just do copious amount of kernel print statements? It's what most of us do. If you cannot login to the system when debugging, then make sure you have other shells already ssh'd into the system under test. Lastly, strip the code back so that you only have the start & end parts, test & verify, then gradually return elements of the code & continue testing & verifying until you find the problem. Porting is not an easy thing to do and is unlikely to be answered here. It can only be answered by your own endeavours. Remember, it is unlikely any of us have that particular device.
    – Bib
    Feb 20 at 17:07
  • Thanks for the suggestions. I was hoping to step through module init but I'll try removing sections. I haven't plugged in the device. I need to fix ssh first. Feb 20 at 17:25

1 Answer 1

2

I didn't port this line properly and it failed to set the .num field in struct tty_ldisc_ops.

        //FIXME err = tty_register_ldisc(N_U50, &u50_ldisc);
        err = tty_register_ldisc(&u50_ldisc);

The other part of my question (breaking at module_init()) was solved by setting a breakpoint in rtnl_link_register().

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .