1. 24 7月, 2013 3 次提交
    • P
      tty: Convert termios_mutex to termios_rwsem · 6a1c0680
      Peter Hurley 提交于
      termios is commonly accessed unsafely (especially by N_TTY)
      because the existing mutex forces exclusive access.
      Convert existing usage.
      Signed-off-by: NPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6a1c0680
    • P
      tty: Make ldisc input flow control concurrency-friendly · 24a89d1c
      Peter Hurley 提交于
      Although line discipline receiving is single-producer/single-consumer,
      using tty->receive_room to manage flow control creates unnecessary
      critical regions requiring additional lock use.
      
      Instead, introduce the optional .receive_buf2() ldisc method which
      returns the # of bytes actually received. Serialization is guaranteed
      by the caller.
      
      In turn, the line discipline should schedule the buffer work item
      whenever space becomes available; ie., when there is room to receive
      data and receive_room() previously returned 0 (the buffer work
      item stops processing if receive_buf2() returns 0). Note the
      'no room' state need not be atomic despite concurrent use by two
      threads because only the buffer work thread can set the state and
      only the read() thread can clear the state.
      
      Add n_tty_receive_buf2() as the receive_buf2() method for N_TTY.
      Provide a public helper function, tty_ldisc_receive_buf(), to use
      when directly accessing the receive_buf() methods.
      
      Line disciplines not using input flow control can continue to set
      tty->receive_room to a fixed value and only provide the receive_buf()
      method.
      Signed-off-by: NPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      24a89d1c
    • P
      tty: Replace ldisc locking with ldisc_sem · 36697529
      Peter Hurley 提交于
      Line discipline locking was performed with a combination of
      a mutex, a status bit, a count, and a waitqueue -- basically,
      a rw semaphore.
      
      Replace the existing combination with an ld_semaphore.
      
      Fixes:
       1) the 'reference acquire after ldisc locked' bug
       2) the over-complicated halt mechanism
       3) lock order wrt. tty_lock()
       4) dropping locks while changing ldisc
       5) previously unidentified deadlock while locking ldisc from
          both linked ttys concurrently
       6) previously unidentified recursive deadlocks
      
      Adds much-needed lockdep diagnostics.
      Signed-off-by: NPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      36697529
  2. 18 6月, 2013 1 次提交
    • P
      n_tty: Encapsulate minimum_to_wake within N_TTY · f6c8dbe6
      Peter Hurley 提交于
      minimum_to_wake is unique to N_TTY processing, and belongs in
      per-ldisc data.
      
      Add the ldisc method, ldisc_ops::fasync(), to notify line disciplines
      when signal-driven I/O is enabled or disabled. When enabled for N_TTY
      (by fcntl(F_SETFL, O_ASYNC)), blocking reader/polls will be woken
      for any readable input. When disabled, blocking reader/polls are not
      woken until the read buffer is full.
      
      Canonical mode (L_ICANON(tty), n_tty_data::icanon) is not affected by
      the minimum_to_wake setting.
      Signed-off-by: NPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f6c8dbe6
  3. 21 5月, 2013 1 次提交
  4. 02 5月, 2013 1 次提交
  5. 01 5月, 2013 2 次提交
  6. 19 3月, 2013 6 次提交
  7. 19 1月, 2013 1 次提交
    • J
      tty: Added a CONFIG_TTY option to allow removal of TTY · 4f73bc4d
      Joe Millenbach 提交于
      The option allows you to remove TTY and compile without errors. This
      saves space on systems that won't support TTY interfaces anyway.
      bloat-o-meter output is below.
      
      The bulk of this patch consists of Kconfig changes adding "depends on
      TTY" to various serial devices and similar drivers that require the TTY
      layer.  Ideally, these dependencies would occur on a common intermediate
      symbol such as SERIO, but most drivers "select SERIO" rather than
      "depends on SERIO", and "select" does not respect dependencies.
      
      bloat-o-meter output comparing our previous minimal to new minimal by
      removing TTY.  The list is filtered to not show removed entries with awk
      '$3 != "-"' as the list was very long.
      
      add/remove: 0/226 grow/shrink: 2/14 up/down: 6/-35356 (-35350)
      function                                     old     new   delta
      chr_dev_init                                 166     170      +4
      allow_signal                                  80      82      +2
      static.__warned                              143     142      -1
      disallow_signal                               63      62      -1
      __set_special_pids                            95      94      -1
      unregister_console                           126     121      -5
      start_kernel                                 546     541      -5
      register_console                             593     588      -5
      copy_from_user                                45      40      -5
      sys_setsid                                   128     120      -8
      sys_vhangup                                   32      19     -13
      do_exit                                     1543    1526     -17
      bitmap_zero                                   60      40     -20
      arch_local_irq_save                          137     117     -20
      release_task                                 674     652     -22
      static.spin_unlock_irqrestore                308     260     -48
      Signed-off-by: NJoe Millenbach <jmillenbach@gmail.com>
      Reviewed-by: NJamey Sharp <jamey@minilop.net>
      Reviewed-by: NJosh Triplett <josh@joshtriplett.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4f73bc4d
  8. 16 1月, 2013 2 次提交
    • J
      TTY: switch tty_flip_buffer_push · 2e124b4a
      Jiri Slaby 提交于
      Now, we start converting tty buffer functions to actually use
      tty_port. This will allow us to get rid of the need of tty in many
      call sites. Only tty_port will needed and hence no more
      tty_port_tty_get in those paths.
      
      Now, the one where most of tty_port_tty_get gets removed:
      tty_flip_buffer_push.
      
      IOW we also closed all the races in drivers not using tty_port_tty_get
      at all yet.
      
      Also we move tty_flip_buffer_push declaration from include/linux/tty.h
      to include/linux/tty_flip.h to all others while we are changing it
      anyway.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2e124b4a
    • J
      TTY: move low_latency to tty_port · d6c53c0e
      Jiri Slaby 提交于
      One point is to have less places where we actually need tty pointer.
      The other is that low_latency is bound to buffer processing and
      buffers are now in tty_port. So it makes sense to move low_latency to
      tty_port too.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d6c53c0e
  9. 16 11月, 2012 1 次提交
    • J
      TTY: introduce tty_port_destroy · de274bfe
      Jiri Slaby 提交于
      After commit "TTY: move tty buffers to tty_port", the tty buffers are
      not freed in some drivers. This is because tty_port_destructor is not
      called whenever a tty_port is freed. This was an assumption I counted
      with but was unfortunately untrue.
      
      Those using refcounting are safe now, but for those which do not we
      introduce a function to be called right before the tty_port is freed
      by the drivers.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      de274bfe
  10. 23 10月, 2012 8 次提交
  11. 13 10月, 2012 1 次提交
  12. 18 9月, 2012 1 次提交
    • E
      userns: Convert the audit loginuid to be a kuid · e1760bd5
      Eric W. Biederman 提交于
      Always store audit loginuids in type kuid_t.
      
      Print loginuids by converting them into uids in the appropriate user
      namespace, and then printing the resulting uid.
      
      Modify audit_get_loginuid to return a kuid_t.
      
      Modify audit_set_loginuid to take a kuid_t.
      
      Modify /proc/<pid>/loginuid on read to convert the loginuid into the
      user namespace of the opener of the file.
      
      Modify /proc/<pid>/loginud on write to convert the loginuid
      rom the user namespace of the opener of the file.
      
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Eric Paris <eparis@redhat.com>
      Cc: Paul Moore <paul@paul-moore.com> ?
      Cc: David Miller <davem@davemloft.net>
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      e1760bd5
  13. 07 9月, 2012 2 次提交
  14. 06 9月, 2012 2 次提交
  15. 14 8月, 2012 1 次提交
  16. 11 8月, 2012 1 次提交
    • A
      tty: localise the lock · 89c8d91e
      Alan Cox 提交于
      The termios and other changes mean the other protections needed on the driver
      tty arrays should be adequate. Turn it all back on.
      
      This contains pieces folded in from the fixes made to the original patches
      
      | From: Geert Uytterhoeven <geert@linux-m68k.org>	(fix m68k)
      | From: Paul Gortmaker <paul.gortmaker@windriver.com>	(fix cris)
      | From: Jiri Kosina <jkosina@suze.cz>			(lockdep)
      | From: Eric Dumazet <eric.dumazet@gmail.com>		(lockdep)
      Signed-off-by: NAlan Cox <alan@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      89c8d91e
  17. 18 7月, 2012 1 次提交
  18. 17 7月, 2012 2 次提交
  19. 07 7月, 2012 1 次提交
    • A
      tty: localise the lock · f5e3bcc5
      Alan Cox 提交于
      The termios and other changes mean the other protections needed on the driver
      tty arrays should be adequate. Turn it all back on.
      
      This contains pieces folded in from the fixes made to the original patches
      
      | From: Geert Uytterhoeven <geert@linux-m68k.org>	(fix m68k)
      | From: Paul Gortmaker <paul.gortmaker@windriver.com>	(fix cris)
      | From: Jiri Kosina <jkosina@suze.cz>			(lockdep)
      | From: Eric Dumazet <eric.dumazet@gmail.com>		(lockdep)
      Signed-off-by: NAlan Cox <alan@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f5e3bcc5
  20. 14 6月, 2012 2 次提交