02 Nov, 2017
1 commit
-
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.By default all files without license information are under the default
license of the kernel, which is GPL version 2.Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if
Reviewed-by: Philippe Ombredanne
Reviewed-by: Thomas Gleixner
Signed-off-by: Greg Kroah-Hartman
29 Aug, 2017
1 commit
-
This patch adds "tty-index" field to /proc/PID/fdinfo/N if N
specifies /dev/ptmx. The field shows the index of associative
slave pts.Though a minor number is given for each pts instance, ptmx is not.
It means there is no way in user-space to know the association between
file descriptors for pts/n and ptmx. (n = 0, 1, ...)This is different from pipe. About pipe such association can be solved
by inode of pipefs.Providing the way to know the association between pts/n and ptmx helps
users understand the status of running system. lsof can utilize this field.Signed-off-by: Masatake YAMATO
Signed-off-by: Greg Kroah-Hartman
01 Jul, 2017
1 commit
-
This marks many critical kernel structures for randomization. These are
structures that have been targeted in the past in security exploits, or
contain functions pointers, pointers to function pointer tables, lists,
workqueues, ref-counters, credentials, permissions, or are otherwise
sensitive. This initial list was extracted from Brad Spengler/PaX Team's
code in the last public patch of grsecurity/PaX based on my understanding
of the code. Changes or omissions from the original code are mine and
don't reflect the original grsecurity/PaX code.Left out of this list is task_struct, which requires special handling
and will be covered in a subsequent patch.Signed-off-by: Kees Cook
27 Apr, 2016
1 commit
-
This is more prep-work for the upcoming pty changes. Still just code
cleanup with no actual semantic changes.This removes a bunch pointless complexity by just having the slave pty
side remember the dentry associated with the devpts slave rather than
the inode. That allows us to remove all the "look up the dentry" code
for when we want to remove it again.Together with moving the tty pointer from "inode->i_private" to
"dentry->d_fsdata" and getting rid of pointless inode locking, this
removes about 30 lines of code. Not only is the end result smaller,
it's simpler and easier to understand.The old code, for example, depended on the d_find_alias() to not just
find the dentry, but also to check that it is still hashed, which in
turn validated the tty pointer in the inode.That is a _very_ roundabout way to say "invalidate the cached tty
pointer when the dentry is removed".The new code just does
dentry->d_fsdata = NULL;
in devpts_pty_kill() instead, invalidating the tty pointer rather more
directly and obviously. Don't do something complex and subtle when the
obvious straightforward approach will do.The rest of the patch (ie apart from code deletion and the above tty
pointer clearing) is just switching the calling convention to pass the
dentry or file pointer around instead of the inode.Cc: Eric Biederman
Cc: Peter Anvin
Cc: Andy Lutomirski
Cc: Al Viro
Cc: Peter Hurley
Cc: Serge Hallyn
Cc: Willy Tarreau
Cc: Aurelien Jarno
Cc: Alan Cox
Cc: Jann Horn
Cc: Greg KH
Cc: Jiri Slaby
Cc: Florian Weimer
Signed-off-by: Linus Torvalds
04 Aug, 2015
1 commit
-
Avoid usb reset crashes by making tty_io cdevs truly dynamic
Signed-off-by: Richard Watts
Reported-by: Duncan Mackintosh
Signed-off-by: Greg Kroah-Hartman
24 Sep, 2014
1 commit
-
Without serialization, the flow control state can become inverted
wrt. the actual hardware state. For example,CPU 0 | CPU 1
stop_tty() |
lock ctrl_lock |
tty->stopped = 1 |
unlock ctrl_lock |
| start_tty()
| lock ctrl_lock
| tty->stopped = 0
| unlock ctrl_lock
| driver->start()
driver->stop() |In this case, the flow control state now indicates the tty has
been started, but the actual hardware state has actually been stopped.Introduce tty->flow_lock spinlock to serialize tty flow control changes.
Split out unlocked __start_tty()/__stop_tty() flavors for use by
ioctl(TCXONC) in follow-on patch.Signed-off-by: Peter Hurley
Signed-off-by: Greg Kroah-Hartman
11 Jul, 2014
1 commit
-
The tty core calls the tty driver's open, close and hangup
methods holding the tty lock.Signed-off-by: Peter Hurley
Signed-off-by: Greg Kroah-Hartman
05 Feb, 2013
1 commit
-
If the tty driver open() fails, the tty driver close() is still
called during the resultant tty release.Signed-off-by: Peter Hurley
Signed-off-by: Greg Kroah-Hartman
14 Aug, 2012
3 commits
-
We need the /dev/ node not to be available before we call
tty_register_device. Otherwise we might race with open and
tty_struct->port might not be available at that time.This is not an issue now, but would be a problem after "TTY: use
tty_port_register_device" is applied.Signed-off-by: Jiri Slaby
Acked-by: Alan Cox
Signed-off-by: Greg Kroah-Hartman -
This allows drivers like ttyprintk to avoid hacks to create an
unnumbered node in /dev. It used to set TTY_DRIVER_DYNAMIC_DEV in
flags and call device_create on its own. That is incorrect, because
TTY_DRIVER_DYNAMIC_DEV may be set only if tty_register_device is
called explicitly.Signed-off-by: Jiri Slaby
Acked-by: Alan Cox
Signed-off-by: Greg Kroah-Hartman -
Switch to the new driver allocation interface, as this is one of the
special call-sites. Here, we need TTY_DRIVER_DYNAMIC_ALLOC to not
allocate tty_driver->ports, cdevs and potentially other structures
because we reserve too many lines in pty. Instead, it provides the
tty_porttty_struct link in tty->ops->install already.Signed-off-by: Jiri Slaby
Acked-by: Alan Cox
Signed-off-by: Greg Kroah-Hartman
11 Aug, 2012
1 commit
-
We need to allow drivers that use neither tty_port_install nor
tty_port_register_device to link a tty_port to a tty somehow. To
avoid a race with open, this has to be performed before
tty_register_device. But currently tty_driver->ports is allocated even
in tty_register_device because we do not know whether this is the PTY
driver. The PTY driver is special here due to an excessive count of
lines it declares to handle. We cannot handle tty_ports there this
way.To circumvent this, we start passing tty_driver flags to
alloc_tty_driver already and we create tty_alloc_driver for this
purpose. There we can allocate tty_driver->ports and do all the magic
between tty_alloc_driver and tty_register_device. Later we will
introduce tty_port_link_device function for that purpose.All drivers should eventually switch to this new tty driver allocation
interface.Signed-off-by: Jiri Slaby
Signed-off-by: Greg Kroah-Hartman
18 Jul, 2012
1 commit
-
Now that we don't have tty->termios tied to drivers->tty we can untangle
the logic here. In addition we can push the removal logic out of the
destructor path.At that point we can think about sorting out tty_port and console and all
the other ugly hangovers.Signed-off-by: Alan Cox
Signed-off-by: Greg Kroah-Hartman
14 Jun, 2012
1 commit
-
It will hold tty_port structures for all drivers which do not want to
define tty->ops->install hook.We ignore PTY here because it wants 1 million lines and it installs
tty_port in ->install anyway.Signed-off-by: Jiri Slaby
Signed-off-by: Greg Kroah-Hartman
09 Mar, 2012
3 commits
-
Note that tty->ops->shutdown is called from whatever context the user
drops the last tty reference from. E.g. if one takes a reference in
an ISR, tty close happens on other CPU and the final tty put is from
the ISR, tty->ops->shutdown will be called from that hard irq context.We would have a problem in vt if we start using tty refcounting from
other contexts than user there. It is because vt's shutdown uses
mutexes. This is yet to be fixed.Signed-off-by: Jiri Slaby
Reported-by: Al Viro
Signed-off-by: Greg Kroah-Hartman -
It was added back in 2004 and never used for anything real. Remove the
only assignment in the tree as well.Signed-off-by: Jiri Slaby
Signed-off-by: Greg Kroah-Hartman -
Like the rest of the kernel, make a stub from alloc_tty_driver which
calls __alloc_tty_driver with proper owner. This will save us one more
assignment on the driver side.Also this fixes some drivers which didn't set the owner. This allowed
user to remove the module from the system even though a tty from the
driver is still open.Signed-off-by: Jiri Slaby
Signed-off-by: Greg Kroah-Hartman
18 Jan, 2012
1 commit
-
This field is unused since 2.6.28 (commit fe6e29fdb1a7: "tty: simplify
ktermios allocation", to be exact)Signed-off-by: Konstantin Khlebnikov
Signed-off-by: Linus Torvalds
24 Aug, 2011
1 commit
-
tty_operations->remove is normally called like:
queue_release_one_tty
->tty_shutdown
->tty_driver_remove_tty
->tty_operations->removeHowever tty_shutdown() is called from queue_release_one_tty() only if
tty_operations->shutdown is NULL. But for pty, it is not.
pty_unix98_shutdown() is used there as ->shutdown.So tty_operations->remove of pty (i.e. pty_unix98_remove()) is never
called. This results in invalid pty_count. I.e. what can be seen in
/proc/sys/kernel/pty/nr.I see this was already reported at:
https://lkml.org/lkml/2009/11/5/370
But it was not fixed since then.This patch is kind of a hackish way. The problem lies in ->install. We
allocate there another tty (so-called tty->link). So ->install is
called once, but ->remove twice, for both tty and tty->link. The fix
here is to count both tty and tty->link and divide the count by 2 for
user.And to have ->remove called, let's make tty_driver_remove_tty() global
and call that from pty_unix98_shutdown() (tty_operations->shutdown).While at it, let's document that when ->shutdown is defined,
tty_shutdown() is not called.Signed-off-by: Jiri Slaby
Cc: Alan Cox
Cc: "H. Peter Anvin"
Cc: stable
Signed-off-by: Greg Kroah-Hartman
18 Feb, 2011
3 commits
-
Only oddities here are a couple of drivers that bogusly called the ldisc
helpers instead of returning -ENOIOCTLCMD. Fix the bug and the rest goes
away.Signed-off-by: Alan Cox
Signed-off-by: Greg Kroah-Hartman -
Doing tiocmget was such fun we should do tiocmset as well for the same
reasonsSigned-off-by: Alan Cox
Signed-off-by: Greg Kroah-Hartman -
We don't actually need this and it causes problems for internal use of
this functionality. Currently there is a single use of the FILE * pointer.
That is the serial core which uses it to check tty_hung_up_p. However if
that is true then IO_ERROR is also already set so the check may be removed.Signed-off-by: Alan Cox
Signed-off-by: Greg Kroah-Hartman
17 Dec, 2010
1 commit
-
Fix various typos and other errors in comments of tty_driver.h. The most
significant is the wrong name of a function for the description of
TTY_DRIVER_DYNAMIC_DEV.Signed-off-by: Timur Tabi
Signed-off-by: Greg Kroah-Hartman
17 Nov, 2010
1 commit
-
We reference termios and termiox in tty_driver.h, but we do not include
linux/termios.h where these are defined. Add the #include properly.Otherwise when we include tty_driver.h, we get compile errors.
Signed-off-by: Jiri Slaby
Cc: Alan Cox
Cc: Greg KH
Signed-off-by: Greg Kroah-Hartman
23 Oct, 2010
1 commit
-
Dan Rosenberg noted that various drivers return the struct with uncleared
fields. Instead of spending forever trying to stomp all the drivers that
get it wrong (and every new driver) do the job in one place.This first patch adds the needed operations and hooks them up, including
the needed USB midlayer and serial core plumbing.Signed-off-by: Alan Cox
Signed-off-by: Greg Kroah-Hartman
28 Sep, 2009
1 commit
-
The following commit made console open fails while booting:
commit b50989dc444599c8b21edc23536fc305f4e9b7d5
Author: Alan Cox
Date: Sat Sep 19 13:13:22 2009 -0700tty: make the kref destructor occur asynchronously
Due to tty release routines run in a workqueue now, error like the
following will be reported while booting:INIT open /dev/console Input/output error
It also causes hibernation regression to appear as reported at
http://bugzilla.kernel.org/show_bug.cgi?id=14229The reason is that now there's latency issue with closing, but when
we open a "closing not finished" tty, -EIO will be returned.Fix it as per the following Alan's suggestion:
Fun but it's actually not a bug and the fix is wrong in itself as
the port may be closing but not yet being destructed, in which case
it seems to do the wrong thing. Opening a tty that is closing (and
could be closing for long periods) is supposed to return -EIO.I suspect a better way to deal with this and keep the old console
timing is to split tty->shutdown into two functions.tty->shutdown() - called synchronously just before we dump the tty
onto the waitqueue for destructiontty->cleanup() - called when the destructor runs.
We would then do the shutdown part which can occur in IRQ context
fine, before queueing the rest of the release (from tty->magic = 0
... the end) to occur asynchronouslyThe USB update in -next would then need a call like
if (tty->cleanup)
tty->cleanup(tty);at the top of the async function and the USB shutdown to be split
between shutdown and cleanup as the USB resource cleanup and final
tidy cannot occur synchronously as it needs to sleep.In other words the logic becomes
final kref put
make object unfindableasync
clean it upSigned-off-by: Dave Young
[ rjw: Rebased on top of 2.6.31-git, reworked the changelog. ]
Signed-off-by: "Rafael J. Wysocki"
[ Changed serial naming to match new rules, dropped tty_shutdown as per
comments from Alan Stern - Linus ]
Signed-off-by: Linus Torvalds
11 Jun, 2009
1 commit
-
The tty throttling code can race due to the lock drops. It takes very high
loads but this has been observed and verified by Rob Duncan.The basic problem is that on an SMP box we can go
CPU #1 CPU #2
need to throttle ?
suppose we should buffer space cleared
are we throttled
yes ? - unthrottle
call throttle methodThis changeet take the termios lock to protect against this. The termios
lock isn't the initial obvious candidate but many implementations of throttle
methods already need to poke around their own termios structures (and nobody
really locks them against a racing change of flow control).This does mean that anyone who is setting tty->low_latency = 1 and then
calling tty_flip_buffer_push from their unthrottle method is going to end up
collapsing in a pile of locks. However we've removed all the known bogus
users of low_latency = 1 and such use isn't safe anyway for other reasons so
catching it would be an improvement.Signed-off-by: Alan Cox
Signed-off-by: Linus Torvalds
07 Apr, 2009
1 commit
-
tty_driver_kref_get() should be static inline and not extern inline
(the latter even changed it's semantics in gcc >= 4.3).Signed-off-by: Adrian Bunk
Signed-off-by: Alan Cox
Signed-off-by: Linus Torvalds
01 Apr, 2009
2 commits
-
struct tty_operations::proc_fops took it's place and there is one less
create_proc_read_entry() user now!Signed-off-by: Alexey Dobriyan
Cc: Alan Cox
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Used for gradual switch of TTY drivers from using ->read_proc which helps
with gradual switch from ->read_proc for the whole tree.As side effect, fix possible race condition when ->data initialized after
PDE is hooked into proc tree.->proc_fops takes precedence over ->read_proc.
Signed-off-by: Alexey Dobriyan
Cc: Alan Cox
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
03 Jan, 2009
1 commit
-
We have special case logic for resizing pty/tty pairs. We also have a per
driver resize method so for the pty case we should use it.Signed-off-by: Alan Cox
Signed-off-by: Linus Torvalds
14 Oct, 2008
6 commits
-
Pass-in 'inode' or 'tty' parameter to devpts interfaces. With multiple
devpts instances, these parameters will be used in subsequent patches
to identify the instance of devpts mounted. The parameters also help
simplify devpts implementation.Changelog[v3]:
- minor changes due to merge with ttydev updates
- rename parameters to emphasize they are ptmx or pts inodes
- pass-in tty_struct * to devpts_pty_kill() (this will help
cleanup the get_node() call in a subsequent patch)Signed-off-by: Sukadev Bhattiprolu
Signed-off-by: Alan Cox
Signed-off-by: Linus Torvalds -
We have the lookup operation abstracted which is nice for pty cleanup but
we really want to abstract the add/remove entries as well so that we can
pull the pty code out of the tty core and create a clear defined interface
for the tty driver table.Signed-off-by: Alan Cox
Signed-off-by: Linus Torvalds -
Signed-off-by: Alan Cox
Signed-off-by: Linus Torvalds -
Fix up the naming, style and extract some bits of code into the driver
specific codeSigned-off-by: Alan Cox
Signed-off-by: Linus Torvalds -
Right now there are various drivers that try to use tty->count to know when
they get the final close. Aristeau Rozanski showed while debugging the vt
sysfs race that this isn't entirely safe.Instead of driver side tricks to work around this introduce a shutdown which
is called when the tty is being destructed. This also means that the shutdown
method is tied into the refcounting.Use this to rework the console close/sysfs logic.
Remove lots of special case code from the tty core code. The pty code can now
have a shutdown() method that replaces the special case hackery in the tree
free up paths.Signed-off-by: Alan Cox
Signed-off-by: Linus Torvalds -
We need a way to describe the various additional modes and flow control
features that random weird hardware shows up and software such as wine
wants to emulate as Windows supports them.TCGETX/TCSETX and the termiox ioctl are a SYS5 extension that we might as
well adopt. This patches adds the structures and the basic ioctl interfaces
when the TCGETX etc defines are added for an architecture. Drivers wishing
to use this stuff need to add new methods.Signed-off-by: Alan Cox
Signed-off-by: Linus Torvalds
16 Aug, 2008
1 commit
-
This moves it to being a tty operation. That removes special cases and now
also means that resize can be picked up by um and other non vt consoles
which may have a resize operation.Signed-off-by: Alan Cox
Signed-off-by: Linus Torvalds
23 Jul, 2008
1 commit
-
Some hardware needs to do break handling itself and may have partial
support only. Make break_ctl return an error code. Add a tty driver flag
so you can indicate driver hardware side break support.Signed-off-by: Alan Cox
Signed-off-by: Linus Torvalds
24 Jun, 2008
1 commit
-
Some of the requirement rules are now more relaxed. Also correct a
contradiction in the previous updateSigned-off-by: Alan Cox
Signed-off-by: Linus Torvalds