lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 29 Oct 2023 20:21:21 +0200
From:   ariel marcovitch <arielmarcovitch@...il.com>
To:     johan@...nel.org
Cc:     gregkh@...uxfoundation.org, linux-usb@...r.kernel.org,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Gaps in logs while using usb-serial as a console

Greetings!

While using a usb-serial device as console, I've noticed some
significant gaps in the kernel logs it receives.

The problem can be reproduced in qemu like this (the kernel is a
x86_64_defconfig with usb-serial enabled and with the ftdi_sio driver
enabled):
qemu-system-x86_64 -m 4G -kernel arch/x86_64/boot/bzImage -usb -device
usb-serial,chardev=ser -chardev pty,id=ser -append 'console=ttyUSB0'
(this will create a `pts` device that will connect to the other end of
the emulated usb-serial)

Then the logs look something like this:
[    1.006459] SELinux:  Initializing.
[    1.011620] Mount-cache hash table entries: 8192 (order: 4, 65536
bytes, li[    2.315341] ACPI: \_SB_.LNKD: Enabled at IRQ 11

This probably happens because of the code in
`usb_serial_generic_write` which tries to insert the data into the
fifo:
count = kfifo_in_locked(&port->write_fifo, buf, count, &port->lock);
Because added indications for when the result is less than expected
and it showed significant losses.
The return value is silently ignored in `usb_console_write`
Also making the fifo bigger in `setup_port_bulk_out` helped (I made it
10 times bigger and there were no losses)

The reason so much data is written at a short time is because
usb-serial is initialized rather late, and when it is registered as a
console, all the logs until this point are written to it.

I'm not sure what the solution should be. Maybe we need to check
whether the write in `console_emit_next_record` was successful and not
increase the seq counter in this case.

Any suggestions?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ