1. 23 10月, 2012 2 次提交
  2. 13 10月, 2012 1 次提交
  3. 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
  4. 07 9月, 2012 2 次提交
  5. 06 9月, 2012 2 次提交
  6. 14 8月, 2012 1 次提交
  7. 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
  8. 18 7月, 2012 1 次提交
  9. 17 7月, 2012 2 次提交
  10. 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
  11. 14 6月, 2012 2 次提交
  12. 03 6月, 2012 1 次提交
    • L
      tty: Revert the tty locking series, it needs more work · f309532b
      Linus Torvalds 提交于
      This reverts the tty layer change to use per-tty locking, because it's
      not correct yet, and fixing it will require some more deep surgery.
      
      The main revert is d29f3ef3 ("tty_lock: Localise the lock"), but
      there are several smaller commits that built upon it, they also get
      reverted here. The list of reverted commits is:
      
        fde86d31 - tty: add lockdep annotations
        8f6576ad - tty: fix ldisc lock inversion trace
        d3ca8b64 - pty: Fix lock inversion
        b1d679af - tty: drop the pty lock during hangup
        abcefe5f - tty/amiserial: Add missing argument for tty_unlock()
        fd11b42e - cris: fix missing tty arg in wait_event_interruptible_tty call
        d29f3ef3 - tty_lock: Localise the lock
      
      The revert had a trivial conflict in the 68360serial.c staging driver
      that got removed in the meantime.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f309532b
  13. 05 5月, 2012 1 次提交
  14. 29 3月, 2012 1 次提交
  15. 03 2月, 2012 1 次提交
  16. 25 1月, 2012 2 次提交
    • K
      tty: rework pty count limiting · e9aba515
      Konstantin Khlebnikov 提交于
      After adding devpts multiple-insrances sysctl kernel.pty.max limit pty count for
      each devpts instance independently, while kernel.pty.nr shows total pty count.
      
      This patch restores sysctl kernel.pty.max as global limit (4096 by default),
      adds pty reseve for main devpts (mounted without "newinstance" argument),
      and new sysctl to tune it: kernel.pty.reserve (1024 by default)
      
      Also it adds devpts mount option "max=%d" to limit pty count for each devpts
      instance independently. (by default NR_UNIX98_PTY_MAX == 2^20)
      
      Thus devpts instances in containers cannot eat up all available pty even if we didn't
      set any limits, while with "max" argument we can adjust limits more precisely.
      
      Plus, now open("/dev/ptmx") return -ENOSPC in case lack of pty indexes,
      this is more informative than -EIO.
      Signed-off-by: NKonstantin Khlebnikov <khlebnikov@openvz.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      e9aba515
    • K
      tty: cleanup prohibition of direct opening for unix98 pty master · 593a27c4
      Konstantin Khlebnikov 提交于
      cleanup hack added in v2.6.27-3203-g15582d36
      
      comment from that patch:
      
      : pty: If the administrator creates a device for a ptmx slave we should not error
      :
      : The open path for ptmx slaves is via the ptmx device. Opening them any
      : other way is not allowed. Vegard Nossum found that previously this was not
      : the case and mknod foo c 128 42; cat foo would produce nasty diagnostics
      :
      : Signed-off-by: Alan Cox <alan@redhat.com>
      : Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
      
      devpts_get_tty() returns non-null only for inodes on devpts, but there is no
      inodes for master-devices, /dev/ptmx (/dev/pts/ptmx) is the only way to open them.
      Thus we can completely forbid lookup for master-devices and eliminate that hack in
      tty_init_dev() because tty_open() will get EIO from tty_driver_lookup_tty().
      Signed-off-by: NKonstantin Khlebnikov <khlebnikov@openvz.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      593a27c4
  17. 19 10月, 2011 2 次提交
    • J
      TTY: make tty_add_file non-failing · fa90e1c9
      Jiri Slaby 提交于
      If tty_add_file fails at the point it is now, we have to revert all
      the changes we did to the tty. It means either decrease all refcounts
      if this was a tty reopen or delete the tty if it was newly allocated.
      
      There was a try to fix this in v3.0-rc2 using tty_release in 0259894c
      (TTY: fix fail path in tty_open). But instead it introduced a NULL
      dereference. It's because tty_release dereferences
      filp->private_data, but that one is set even in our tty_add_file. And
      when tty_add_file fails, it's still NULL/garbage. Hence tty_release
      cannot be called there.
      
      To circumvent the original leak (and the current NULL deref) we split
      tty_add_file into two functions, making the latter non-failing. In
      that case we may do the former early in open, where handling failures
      is easy. The latter stays as it is now. So there is no change in
      functionality.
      
      The original bug (leak) was introduced by f573bd17 (tty: Remove
      __GFP_NOFAIL from tty_add_file()). Thanks Dan for reporting this.
      
      Later, we may split tty_release into more functions and call only some
      of them in this fail path instead. (If at all possible.)
      
      Introduced-in: v2.6.37-rc2
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
      Cc: stable <stable@vger.kernel.org>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Cc: Pekka Enberg <penberg@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      fa90e1c9
    • T
      tty: Support compat_ioctl get/set termios_locked · 8193c429
      Thomas Meyer 提交于
      When running a Fedora 15 (x86) on an x86_64 kernel, in the boot process
      plymouthd complains about those two missing ioctls:
      [    2.581783] ioctl32(plymouthd:186): Unknown cmd fd(10) cmd(00005457){t:'T';sz:0} arg(ffb6a5d0) on /dev/tty1
      [    2.581803] ioctl32(plymouthd:186): Unknown cmd fd(10) cmd(00005456){t:'T';sz:0} arg(ffb6a680) on /dev/tty1
      
      both ioctl functions work on the 'struct termios' resp. 'struct termios2',
      which has the same size (36 bytes resp. 44 bytes) on x86 and x86_64,
      so it's just a matter of converting the pointer from userland.
      Signed-off-by: NThomas Meyer <thomas@m3y3r.de>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: NAndrew Morton <akpm@google.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      8193c429
  18. 26 8月, 2011 1 次提交
  19. 24 8月, 2011 2 次提交
    • J
      TTY: remove tty_locked · 906cbe13
      Jiri Slaby 提交于
      We used it really only serial and ami_serial. The rest of the
      callsites were BUG/WARN_ONs to check if BTM is held. Now that we
      pruned tty_locked from both of the real users, we can get rid of
      tty_lock along with __big_tty_mutex_owner.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Acked-by: NArnd Bergmann <arnd@arndb.de>
      Cc: Alan Cox <alan@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      906cbe13
    • J
      TTY: pty, fix pty counting · 24d406a6
      Jiri Slaby 提交于
      tty_operations->remove is normally called like:
      queue_release_one_tty
       ->tty_shutdown
         ->tty_driver_remove_tty
           ->tty_operations->remove
      
      However 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: NJiri Slaby <jslaby@suse.cz>
      Cc: Alan Cox <alan@linux.intel.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      24d406a6
  20. 08 6月, 2011 1 次提交
  21. 14 5月, 2011 1 次提交
    • J
      n_tracerouter and n_tracesink ldisc additions. · ee4f6b4b
      J Freyensee 提交于
      The n_tracerouter and n_tracesink line discpline drivers use the
      Linux tty line discpline framework to route trace data coming
      from a tty port (say UART for example) to the trace sink line
      discipline driver and to another tty port(say USB).  Those
      these two line discipline drivers can be used together,
      independently from pti.c, they are part of the original
      implementation solution of the MIPI P1149.7, compact JTAG, PTI
      solution for Intel mobile platforms starting with the
      Medfield platform.
      Signed-off-by: NJ Freyensee <james_p_freyensee@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      ee4f6b4b
  22. 20 4月, 2011 1 次提交
  23. 23 3月, 2011 1 次提交
    • L
      tty: stop using "delayed_work" in the tty layer · f23eb2b2
      Linus Torvalds 提交于
      Using delayed-work for tty flip buffers ends up causing us to wait for
      the next tick to complete some actions.  That's usually not all that
      noticeable, but for certain latency-critical workloads it ends up being
      totally unacceptable.
      
      As an extreme case of this, passing a token back-and-forth over a pty
      will take two ticks per iteration, so even just a thousand iterations
      will take 8 seconds assuming a common 250Hz configuration.
      
      Avoiding the whole delayed work issue brings that ping-pong test-case
      down to 0.009s on my machine.
      
      In more practical terms, this latency has been a performance problem for
      things like dive computer simulators (simulating the serial interface
      using the ptys) and for other environments (Alan mentions a CP/M emulator).
      Reported-by: NJef Driesen <jefdriesen@telenet.be>
      Acked-by: NGreg KH <gregkh@suse.de>
      Acked-by: NAlan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f23eb2b2
  24. 18 2月, 2011 3 次提交
  25. 30 11月, 2010 1 次提交
    • J
      TTY: open/hangup race fixup · acfa747b
      Jiri Slaby 提交于
      Like in the "TTY: don't allow reopen when ldisc is changing" patch,
      this one fixes a TTY WARNING as described in the option 1) there:
      1) __tty_hangup from tty_ldisc_hangup to tty_ldisc_enable. During this
      section tty_lock is held. However tty_lock is temporarily dropped in
      the middle of the function by tty_ldisc_hangup.
      
      The fix is to introduce a new flag which we set during the unlocked
      window and check it in tty_reopen too. The flag is TTY_HUPPING and is
      cleared after TTY_HUPPED is set.
      
      While at it, remove duplicate TTY_HUPPED set_bit. The one after
      calling ops->hangup seems to be more correct. But anyway, we hold
      tty_lock, so there should be no difference.
      
      Also document the function it does that kind of crap.
      
      Nicely reproducible with two forked children:
      static void do_work(const char *tty)
      {
      	if (signal(SIGHUP, SIG_IGN) == SIG_ERR) exit(1);
      	setsid();
      	while (1) {
      		int fd = open(tty, O_RDWR|O_NOCTTY);
      		if (fd < 0) continue;
      		if (ioctl(fd, TIOCSCTTY)) continue;
      		if (vhangup()) continue;
      		close(fd);
      	}
      	exit(0);
      }
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Reported-by: <Valdis.Kletnieks@vt.edu>
      Reported-by: NKyle McMartin <kyle@mcmartin.ca>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      acfa747b
  26. 18 11月, 2010 1 次提交
  27. 10 11月, 2010 1 次提交
  28. 30 10月, 2010 1 次提交
    • T
      audit: Call tty_audit_push_task() outside preempt disabled · 3c80fe4a
      Thomas Gleixner 提交于
      While auditing all tasklist_lock read_lock sites I stumbled over the
      following call chain:
      
      audit_prepare_user_tty()
        read_lock(&tasklist_lock);
        tty_audit_push_task();
           mutex_lock(&buf->mutex);
      
           --> buf->mutex is locked with preemption disabled.
      
      Solve this by acquiring a reference to the task struct under
      rcu_read_lock and call tty_audit_push_task outside of the preempt
      disabled region.
      
      Move all code which needs to be protected by sighand lock into
      tty_audit_push_task() and use lock/unlock_sighand as we do not hold
      tasklist_lock.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Eric Paris <eparis@redhat.com>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      3c80fe4a
  29. 23 10月, 2010 2 次提交