Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1685955

Re: [patch 0/3] Re: tty contention resulting from tty_open_by_device export

From Alan Cox <gnomes@lxorguk.ukuu.org.uk>
Newsgroups linux.kernel
Subject Re: [patch 0/3] Re: tty contention resulting from tty_open_by_device export
Date 2017-07-12 20:30 +0200
Message-ID <u2uyB-3hF-7@gated-at.bofh.it> (permalink)
References <u0Trr-8hs-9@gated-at.bofh.it> <u1iSR-7ch-3@gated-at.bofh.it> <u1Fw5-4xw-9@gated-at.bofh.it> <u1G8O-53s-29@gated-at.bofh.it>
Organization Intel Corporation

Show all headers | View raw


> When opening from kernel, we don't use file pointer. The count mismatch
> is between tty->count and #fd's. So opening from kernel leads to #fd's
> being less than tty->count. I thought this difference is relevant to
> user-space opening of tty, and not to kernel opening of tty. Can you
> suggest how to address this mismatch?

Your kernel reference is the same as having a file open reference so I
think this actually needs addressing in the maths. In other words count
the number of kernel references and also add that into the test for
check_tty_count (kernel references + #fds == count).

I'd really like to keep this right because that check has a long history
of catching really nasty race conditions in the tty code. The
open/close/hangup code is really fragile so worth the debugability.

> Ah may be I didn't notice the active bit. Is it one of the #defines in
> tty.h? Can usage count and active bit be used to differentiate between
> whether the tty was opened by kernel or user?

It only tells you whether the port is currently active for some purpose,
not which. If you still want to implement exclusivity between kernel and
user then it needs another flag, but I think that flag should be in
port->flags as it is a property of the physical interface.

(Take a look at tty_port_open for example)

Alan

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

tty contention resulting from tty_open_by_device export Okash Khawaja <okash.khawaja@gmail.com> - 2017-07-07 22:30 +0200
  Re: tty contention resulting from tty_open_by_device export Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-08 10:40 +0200
    Re: tty contention resulting from tty_open_by_device export Okash Khawaja <okash.khawaja@gmail.com> - 2017-07-08 11:10 +0200
    [patch 3/3] tty: undo export of tty_open_by_driver Okash Khawaja <okash.khawaja@gmail.com> - 2017-07-09 13:50 +0200
    [patch 0/3] Re: tty contention resulting from tty_open_by_device export Okash Khawaja <okash.khawaja@gmail.com> - 2017-07-09 13:50 +0200
      [patch 2/3] staging: speakup: use tty_kopen instead of tty_open_by_driver Okash Khawaja <okash.khawaja@gmail.com> - 2017-07-09 13:50 +0200
        Re: [patch 2/3] staging: speakup: use tty_kopen instead of  tty_open_by_driver Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-09 14:00 +0200
          Re: [patch 2/3] staging: speakup: use tty_kopen instead of  tty_open_by_driver Okash Khawaja <okash.khawaja@gmail.com> - 2017-07-09 14:30 +0200
      [patch 1/3] tty: resolve tty contention between kernel and user space Okash Khawaja <okash.khawaja@gmail.com> - 2017-07-09 13:50 +0200
        Re: [patch 1/3] tty: resolve tty contention between kernel and user  space Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-09 14:00 +0200
        Re: [patch 1/3] tty: resolve tty contention between kernel and user space Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-07-09 17:10 +0200
          Re: [patch 1/3] tty: resolve tty contention between kernel and user  space Okash Khawaja <okash.khawaja@gmail.com> - 2017-07-09 21:10 +0200
          Re: [patch 1/3] tty: resolve tty contention between kernel and user  space Okash Khawaja <okash.khawaja@gmail.com> - 2017-07-10 10:40 +0200
            Re: [patch 1/3] tty: resolve tty contention between kernel and user space Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-07-10 17:30 +0200
              Re: [patch 1/3] tty: resolve tty contention between kernel and user  space Okash Khawaja <okash.khawaja@gmail.com> - 2017-07-10 18:20 +0200
      Re: [patch 0/3] Re: tty contention resulting from tty_open_by_device  export Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-09 14:00 +0200
      [patch 4/3] tty: make tty_kopen return ENODEV in case of no TTY Okash Khawaja <okash.khawaja@gmail.com> - 2017-07-09 14:40 +0200
      Re: [patch 0/3] Re: tty contention resulting from  tty_open_by_device export Alan Cox <gnomes@lxorguk.ukuu.org.uk> - 2017-07-10 14:00 +0200
        Re: [patch 0/3] Re: tty contention resulting from tty_open_by_device  export Okash Khawaja <okash.khawaja@gmail.com> - 2017-07-10 14:40 +0200
          Re: [patch 0/3] Re: tty contention resulting from tty_open_by_device  export Okash Khawaja <okash.khawaja@gmail.com> - 2017-07-10 18:30 +0200
          Re: [patch 0/3] Re: tty contention resulting from  tty_open_by_device export Alan Cox <gnomes@lxorguk.ukuu.org.uk> - 2017-07-12 20:30 +0200
            Re: [patch 0/3] Re: tty contention resulting from tty_open_by_device  export Okash Khawaja <okash.khawaja@gmail.com> - 2017-07-13 13:40 +0200
              Re: [patch 0/3] Re: tty contention resulting from tty_open_by_device  export Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-17 14:40 +0200
                Re: [patch 0/3] Re: tty contention resulting from tty_open_by_device export Okash Khawaja <okash.khawaja@gmail.com> - 2017-07-17 15:30 +0200
                Re: [patch 0/3] Re: tty contention resulting from  tty_open_by_device export Alan Cox <gnomes@lxorguk.ukuu.org.uk> - 2017-07-18 00:10 +0200
                [patch v2 1/3] tty: resolve tty contention between kernel and user space Okash Khawaja <okash.khawaja@gmail.com> - 2017-07-17 23:10 +0200
                [patch v2 3/3] tty: undo export of tty_open_by_driver Okash Khawaja <okash.khawaja@gmail.com> - 2017-07-17 23:10 +0200
                [patch v2 0/3] tty contention resulting from tty_open_by_driver export Okash Khawaja <okash.khawaja@gmail.com> - 2017-07-17 23:10 +0200
                [patch v2 2/3] staging: speakup: use tty_kopen instead of tty_open_by_driver Okash Khawaja <okash.khawaja@gmail.com> - 2017-07-17 23:10 +0200

csiph-web