History log of /freebsd-10-stable/sys/kern/tty.c
Revision Date Author Comments
# 361358 22-May-2020 hselasky

MFC r361075:
Assign process group of the TTY under the "proctree_lock".

This fixes a race where concurrent calls to doenterpgrp() and
leavepgrp() while TIOCSCTTY is executing may result in tp->t_pgrp
changing value so that tty_rel_pgrp() misses clearing it to NULL. For
more details refer to the use of pgdelete() in the kernel.

No functional change intended.

Panic backtrace:
__mtx_lock_sleep() # page fault due to using destroyed mutex
tty_signal_pgrp()
tty_ioctl()
ptsdev_ioctl()
kern_ioctl()
sys_ioctl()
amd64_syscall()

Sponsored by: Mellanox Technologies


# 302234 27-Jun-2016 bdrewery

MFC r298819:

sys/kern: spelling fixes in comments.


# 295615 14-Feb-2016 kib

MFC r294598:
In tty_dealloc(), clear the queues.

Approved by: re (marius)


# 295393 08-Feb-2016 kib

MFC r294732:
Minor fixes for ddb tty-related commands.

Approved by: re (gjb)


# 295392 08-Feb-2016 kib

MFC r294735:
Don't allow opening the callout device when the callin device is already
open (in disguise as the console device).

Approved by: re (gjb)


# 294977 28-Jan-2016 kib

MFC r293349:
Convert tty common code to use make_dev_s().


# 294959 27-Jan-2016 marius

MFC: r294362, r294414, r294753

- Fix tty_drain() and, thus, TIOCDRAIN of the current tty(4) incarnation
to actually wait until the TX FIFOs of UARTs have be drained before
returning. This is done by bringing the equivalent of the TS_BUSY flag
found in the previous implementation back in an ABI-preserving way.
Reported and tested by: Patrick Powell
- Make the code consistent with itself style-wise and bring it closer
to style(9).
- Mark unused arguments as such.
- Make the ttystates table const.


# 280258 19-Mar-2015 rwatson

Merge r263233 from HEAD to stable/10:

Update kernel inclusions of capability.h to use capsicum.h instead; some
further refinement is required as some device drivers intended to be
portable over FreeBSD versions rely on __FreeBSD_version to decide whether
to include capability.h.

Sponsored by: Google, Inc.


# 276339 28-Dec-2014 marcel

MFC r272789:
Fix draining in ttydev_leave().


# 276338 28-Dec-2014 marcel

MFC r269126 & 272786:
Don't return ERESTART when the device is gone.


# 272726 08-Oct-2014 neel

MFC r272270:

tty_rel_free() can be called more than once for the same tty so make sure
that the tty is dequeued from 'tty_list' only the first time.


# 271773 18-Sep-2014 grehan

MFC tty fixes, r259549 and r259663

Keep tty_makedev as a function to preserve the KBI on 10-stable
(it is a macro in CURRENT). The changes for this are direct
commits to 10-stable.

r259549 (glebius):
- Rename tty_makedev() into tty_makedevf() and make it capable
to fail and return error.
- Use make_dev_p() in tty_makedevf() instead of make_dev_cred().
- Always pass MAKEDEV_CHECKNAME flag.
- Optionally pass MAKEDEV_REF flag.
- Provide macro for compatibility with old API.

This fixes races with simultaneous creation and desctruction of
ttys, and makes it possible to call tty_makedevf() from device
cloners.

A race in tty_watermarks() still exist, since the latter drops
lock for M_WAITOK allocation. This will be addressed in separate
commit.

r259663 (glebius):
Move list of ttys handling from the allocating procedures, to the
device creation stage. A device creation can fail, and in that case
an entry already on the list will be freed.

KBI issue pointed out by: kib
Reviewed by: kib (KBI addition)
Approved by: re (kib)


# 261997 16-Feb-2014 marcel

MFC r259441:
Properly drain the TTY when both revoke(2) and close(2) end up closing
the TTY.


# 280258 19-Mar-2015 rwatson

Merge r263233 from HEAD to stable/10:

Update kernel inclusions of capability.h to use capsicum.h instead; some
further refinement is required as some device drivers intended to be
portable over FreeBSD versions rely on __FreeBSD_version to decide whether
to include capability.h.

Sponsored by: Google, Inc.


# 276339 28-Dec-2014 marcel

MFC r272789:
Fix draining in ttydev_leave().


# 276338 28-Dec-2014 marcel

MFC r269126 & 272786:
Don't return ERESTART when the device is gone.


# 272726 08-Oct-2014 neel

MFC r272270:

tty_rel_free() can be called more than once for the same tty so make sure
that the tty is dequeued from 'tty_list' only the first time.


# 271773 18-Sep-2014 grehan

MFC tty fixes, r259549 and r259663

Keep tty_makedev as a function to preserve the KBI on 10-stable
(it is a macro in CURRENT). The changes for this are direct
commits to 10-stable.

r259549 (glebius):
- Rename tty_makedev() into tty_makedevf() and make it capable
to fail and return error.
- Use make_dev_p() in tty_makedevf() instead of make_dev_cred().
- Always pass MAKEDEV_CHECKNAME flag.
- Optionally pass MAKEDEV_REF flag.
- Provide macro for compatibility with old API.

This fixes races with simultaneous creation and desctruction of
ttys, and makes it possible to call tty_makedevf() from device
cloners.

A race in tty_watermarks() still exist, since the latter drops
lock for M_WAITOK allocation. This will be addressed in separate
commit.

r259663 (glebius):
Move list of ttys handling from the allocating procedures, to the
device creation stage. A device creation can fail, and in that case
an entry already on the list will be freed.

KBI issue pointed out by: kib
Reviewed by: kib (KBI addition)
Approved by: re (kib)


# 261997 16-Feb-2014 marcel

MFC r259441:
Properly drain the TTY when both revoke(2) and close(2) end up closing
the TTY.