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

rinato: Warnings related to USB serial gadget #25

Open
casept opened this issue Jan 23, 2025 · 2 comments
Open

rinato: Warnings related to USB serial gadget #25

casept opened this issue Jan 23, 2025 · 2 comments

Comments

@casept
Copy link
Owner

casept commented Jan 23, 2025

Kernel splat:

Oct 11 07:05:45 rinato kernel: ------------[ cut here ]------------
Oct 11 07:05:45 rinato kernel: WARNING: CPU: 1 PID: 233 at drivers/usb/gadget/function/u_serial.c:695 gs_close (drivers/usb/gadget/function/u_serial.c:695 (discriminator 3)) 
Oct 11 07:05:45 rinato kernel: Modules linked in:
Oct 11 07:05:45 rinato kernel: Tainted: [W]=WARN
Oct 11 07:05:45 rinato kernel: Hardware name: Samsung Exynos (Flattened Device Tree)
Oct 11 07:05:45 rinato kernel: Call trace: 
Oct 11 07:05:45 rinato kernel: (unwind_backtrace) from show_stack (arch/arm/kernel/traps.c:259) 
Oct 11 07:05:45 rinato kernel: (show_stack) from dump_stack_lvl (lib/dump_stack.c:122) 
Oct 11 07:05:45 rinato kernel: (dump_stack_lvl) from __warn (./arch/arm/include/asm/current.h:30 kernel/panic.c:753) 
Oct 11 07:05:45 rinato kernel: (__warn) from warn_slowpath_fmt (./include/linux/context_tracking.h:159 kernel/panic.c:777) 
Oct 11 07:05:45 rinato kernel: (warn_slowpath_fmt) from gs_close (drivers/usb/gadget/function/u_serial.c:695 (discriminator 3)) 
Oct 11 07:05:45 rinato kernel: (gs_close) from tty_release (drivers/tty/tty_io.c:1791) 
Oct 11 07:05:45 rinato kernel: (tty_release) from __fput (fs/file_table.c:451 (discriminator 1)) 
Oct 11 07:05:45 rinato kernel: (__fput) from sys_close (fs/open.c:1582 fs/open.c:1564) 
Oct 11 07:05:45 rinato kernel: (sys_close) from ret_fast_syscall (arch/arm/kernel/entry-common.S:68) 
Oct 11 07:05:45 rinato kernel: Exception stack(0xe091dfa8 to 0xe091dff0)
Oct 11 07:05:45 rinato kernel: dfa0:                   00000000 b63da828 00000004 0002b448 00000000 00000001
Oct 11 07:05:45 rinato kernel: dfc0: 00000000 b63da828 00000003 00000006 00000003 be8e75d4 be8e7778 be8e772c
Oct 11 07:05:45 rinato kernel: dfe0: b6d5cc90 be8e7448 b6be6b68 b69d779c
Oct 11 07:05:45 rinato kernel: irq event stamp: 11790
Oct 11 07:05:45 rinato kernel: hardirqs last enabled at (11789): finish_task_switch (./arch/arm/include/asm/irqflags.h:39 kernel/sched/sched.h:1533 kernel/sched/core.c:5129 kernel/sched/core.c:5247) 
Oct 11 07:05:46 rinato kernel: hardirqs last disabled at (11790): _raw_spin_lock_irq (./include/linux/spinlock_api_smp.h:117 (discriminator 1) kernel/locking/spinlock.c:170 (discriminator 1)) 
Oct 11 07:05:46 rinato kernel: softirqs last enabled at (11622): vfp_support_entry (arch/arm/vfp/vfpmodule.c:781) 
Oct 11 07:05:46 rinato kernel: softirqs last disabled at (11620): vfp_support_entry (./include/linux/bottom_half.h:20 arch/arm/vfp/vfpmodule.c:73 arch/arm/vfp/vfpmodule.c:717) 
Oct 11 07:05:46 rinato kernel: ---[ end trace 0000000000000000 ]---
@casept
Copy link
Owner Author

casept commented Jan 23, 2025

u_serial.c:695 should only be reachable if gs_open() is called while gs_close() is in progress, in a narrow window where gs_close() releases the lock to permit data to be drained. According to commit c6561082b833a this shouldn't be possible, as the portmaster should itself be holding a lock to prevent this.

next step: Figure out what the portmaster is in our case and inspect it. Also add some printk's in the serial gadget driver to confirm our theory.

@casept
Copy link
Owner Author

casept commented Jan 23, 2025

This theory seems wrong, as the warning is not actually triggered as a result of the goto jump, but rather because gs_close is called one time too many from the tty subsystem.

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

1 participant