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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <927f2d40-1004-4738-a1bc-0000d4d3e179@zytor.com>
Date: Wed, 16 Jul 2025 10:30:28 -0700
From: "H. Peter Anvin" <hpa@...or.com>
To: Oliver Neukum <oneukum@...e.com>
Cc: linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
        gregkh@...uxfoundation.org, Jiri Slaby <jirislaby@...nel.org>,
        linux-serial@...r.kernel.org
Subject: Re: USB cdc-acm driver: break and command

On 2025-07-16 09:17, Oliver Neukum wrote:
> 
> If you really wanted to use that API as it is right now, you'd
> have breaks racing with each other and, worse, with open()
> and close().
> Are you sure POSIX says nothing about how to handle such cases?
> 

This is the POSIX definition for tcsendbreak():

NAME

    tcsendbreak — send a break for a specific duration

SYNOPSIS

    #include <termios.h>

    int tcsendbreak(int fildes, int duration);

DESCRIPTION

    If the terminal is using asynchronous serial data transmission,
tcsendbreak() shall cause transmission of a continuous stream of
zero-valued bits for a specific duration. If duration is 0, it shall
cause transmission of zero-valued bits for at least 0.25 seconds, and
not more than 0.5 seconds. If duration is not 0, it shall send
zero-valued bits for an implementation-defined period of time.

    The fildes argument is an open file descriptor associated with a
terminal.

    If the terminal is not using asynchronous serial data transmission,
it is implementation-defined whether tcsendbreak() sends data to
generate a break condition or returns without taking any action.

    Attempts to use tcsendbreak() from a process which is a member of a
background process group on a fildes associated with its controlling
terminal shall cause the process group to be sent a SIGTTOU signal. If
the calling thread is blocking SIGTTOU signals or the process is
ignoring SIGTTOU signals, the process shall be allowed to perform the
operation, and no signal is sent.

RETURN VALUE

    Upon successful completion, 0 shall be returned. Otherwise, -1 shall
be returned and errno set to indicate the error.

ERRORS

    The tcsendbreak() function shall fail if:

    [EBADF]
        The fildes argument is not a valid file descriptor.
    [EIO]
        The process group of the writing process is orphaned, the
calling thread is not blocking SIGTTOU, and the process is not ignoring
SIGTTOU.
    [ENOTTY]
        The file associated with fildes is not a terminal.

--- ---

The only other mentions of BREAK I can find are the BRKINT and IGNBRK
flags, respectively.

>
> You'd probably have to start a timer in the driver in send_break().
> That timer would need to be properly handled in disconnect(),
> pre/post_reset() and suspend()
> That API is really not nice to use.
> 

That's why I said if that is what is needed, it really belongs in the
tty core.  That's where the current internal delay is, after all.

	-hpa


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ