14 Jan, 2011

1 commit

  • For string without format specifiers, use seq_puts().
    For seq_printf("\n"), use seq_putc('\n').

    text data bss dec hex filename
    61866 488 112 62466 f402 fs/proc/proc.o
    61729 488 112 62329 f379 fs/proc/proc.o
    ----------------------------------------------------
    -139

    Signed-off-by: Alexey Dobriyan
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     

23 Oct, 2010

2 commits

  • This reverts commit f4a3e0bceb57466c31757f25e4e0ed108d1299ec. Jiri
    Sladby points out that the tty structure we're using may already be
    gone, and Al Viro doesn't hold back in complaining about the random
    loading of 'filp->private_data' which doesn't have to be a pointer at
    all, nor does checking the magic field for TTY_MAGIC prove anything.

    Belated review by Al:

    "a) global variable depending on stdin of the last opener? Affecting
    output of read(2)? Really?

    b) iterator is broken; list should be locked in ->start(), unlocked in
    ->stop() and *NOT* unlocked/relocked in ->next()

    c) ->show() ought to do nothing in case of ->device == NULL, instead
    of skipping those in ->next()/->start()

    d) regardless of the merits of the bright idea about asterisk at that
    line in output *and* regardless of (a), the implementation is not
    only atrociously ugly, it's actually very likely to be a roothole.
    Verifying that Cthulhu knows what number happens to be address of a
    tty_struct by blindly dereferencing memory at that address...
    Ouch.

    Please revert that crap."

    And Christoph pipes in and NAK's the approach of walking fd tables etc
    too. So it's pretty unanimous.

    Noticed-by: Jri Slaby
    Requested-by: Al Viro
    Cc: Greg Kroah-Hartman
    Cc: Werner Fink
    Cc: Alan Cox
    Cc: Christoph Hellwig
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     
  • Add a new file /proc/tty/consoles to be able to determine the registered
    system console lines. If the reading process holds /dev/console open at
    the regular standard input stream the active device will be marked by an
    asterisk. Show possible operations and also decode the used flags of
    the listed console lines.

    Signed-off-by: Werner Fink
    Cc: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Dr. Werner Fink
     

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

    Alexey Dobriyan
     
  • 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

    Alexey Dobriyan
     

31 Mar, 2009

1 commit

  • Setting ->owner as done currently (pde->owner = THIS_MODULE) is racy
    as correctly noted at bug #12454. Someone can lookup entry with NULL
    ->owner, thus not pinning enything, and release it later resulting
    in module refcount underflow.

    We can keep ->owner and supply it at registration time like ->proc_fops
    and ->data.

    But this leaves ->owner as easy-manipulative field (just one C assignment)
    and somebody will forget to unpin previous/pin current module when
    switching ->owner. ->proc_fops is declared as "const" which should give
    some thoughts.

    ->read_proc/->write_proc were just fixed to not require ->owner for
    protection.

    rmmod'ed directories will be empty and return "." and ".." -- no harm.
    And directories with tricky enough readdir and lookup shouldn't be modular.
    We definitely don't want such modular code.

    Removing ->owner will also make PDE smaller.

    So, let's nuke it.

    Kudos to Jeff Layton for reminding about this, let's say, oversight.

    http://bugzilla.kernel.org/show_bug.cgi?id=12454

    Signed-off-by: Alexey Dobriyan

    Alexey Dobriyan
     

21 Jul, 2008

1 commit

  • Move the line disciplines towards a conventional ->ops arrangement. For
    the moment the actual 'tty_ldisc' struct in the tty is kept as part of
    the tty struct but this can then be changed if it turns out that when it
    all settles down we want to refcount ldiscs separately to the tty.

    Pull the ldisc code out of /proc and put it with our ldisc code.

    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Alan Cox
     

30 Apr, 2008

1 commit

  • - Operations are now a shared const function block as with most other Linux
    objects

    - Introduce wrappers for some optional functions to get consistent behaviour

    - Wrap put_char which used to be patched by the tty layer

    - Document which functions are needed/optional

    - Make put_char report success/fail

    - Cache the driver->ops pointer in the tty as tty->ops

    - Remove various surplus lock calls we no longer need

    - Remove proc_write method as noted by Alexey Dobriyan

    - Introduce some missing sanity checks where certain driver/ldisc
    combinations would oops as they didn't check needed methods were present

    [akpm@linux-foundation.org: fix fs/compat_ioctl.c build]
    [akpm@linux-foundation.org: fix isicom]
    [akpm@linux-foundation.org: fix arch/ia64/hp/sim/simserial.c build]
    [akpm@linux-foundation.org: fix kgdb]
    Signed-off-by: Alan Cox
    Acked-by: Greg Kroah-Hartman
    Cc: Jason Wessel
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alan Cox
     

29 Apr, 2008

2 commits


09 Feb, 2008

2 commits


17 Jul, 2007

1 commit


09 May, 2007

1 commit

  • Additions and removal from tty_drivers list were just done as well as
    iterating on it for /proc/tty/drivers generation.

    testing: modprobe/rmmod loop of simple module which does nothing but
    tty_register_driver() vs cat /proc/tty/drivers loop

    BUG: unable to handle kernel paging request at virtual address 6b6b6b6b
    printing eip:
    c01cefa7
    *pde = 00000000
    Oops: 0000 [#1]
    PREEMPT
    last sysfs file: devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bInterfaceProtocol
    Modules linked in: ohci_hcd af_packet e1000 ehci_hcd uhci_hcd usbcore xfs
    CPU: 0
    EIP: 0060:[] Not tainted VLI
    EFLAGS: 00010297 (2.6.21-rc4-mm1 #4)
    EIP is at vsnprintf+0x3a4/0x5fc
    eax: 6b6b6b6b ebx: f6cb50f2 ecx: 6b6b6b6b edx: fffffffe
    esi: c0354700 edi: f6cb6000 ebp: 6b6b6b6b esp: f31f5e68
    ds: 007b es: 007b fs: 00d8 gs: 0033 ss: 0068
    Process cat (pid: 31864, ti=f31f4000 task=c1998030 task.ti=f31f4000)
    Stack: 00000000 c0103f20 c013003a c0103f20 00000000 f6cb50da 0000000a 00000f0e
    f6cb50f2 00000010 00000014 ffffffff ffffffff 00000007 c0354753 f6cb50f2
    f73e39dc f73e39dc 00000001 c0175416 f31f5ed8 f31f5ed4 0ee00000 f32090bc
    Call Trace:
    [] restore_nocheck+0x12/0x15
    [] mark_held_locks+0x6d/0x86
    [] restore_nocheck+0x12/0x15
    [] seq_printf+0x2e/0x52
    [] show_tty_range+0x35/0x1f3
    [] seq_printf+0x2e/0x52
    [] show_tty_driver+0x8a/0x1d9
    [] seq_read+0x70/0x2ba
    [] seq_read+0x0/0x2ba
    [] proc_reg_read+0x63/0x9f
    [] vfs_read+0x7d/0xb5
    [] proc_reg_read+0x0/0x9f
    [] sys_read+0x41/0x6a
    [] sysenter_past_esp+0x5f/0x99
    =======================
    Code: 00 8b 4d 04 e9 44 ff ff ff 8d 4d 04 89 4c 24 50 8b 6d 00 81 fd ff 0f 00 00 b8 a4 c1 35 c0 0f 46 e8 8b 54 24 2c 89 e9 89 c8 eb 06 38 00 74 07 40 4a 83 fa ff 75 f4 29 c8 89 c6 8b 44 24 28 89
    EIP: [] vsnprintf+0x3a4/0x5fc SS:ESP 0068:f31f5e68

    Signed-off-by: Alexey Dobriyan
    Cc: Alan Cox
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     

13 Feb, 2007

1 commit

  • Many struct file_operations in the kernel can be "const". Marking them const
    moves these to the .rodata section, which avoids false sharing with potential
    dirty data. In addition it'll catch accidental writes at compile time to
    these shared resources.

    Signed-off-by: Arjan van de Ven
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arjan van de Ven
     

17 Apr, 2005

1 commit

  • Initial git repository build. I'm not bothering with the full history,
    even though we have it. We can create a separate "historical" git
    archive of that later if we want to, and in the meantime it's about
    3.2GB when imported into git - space that would just make the early
    git days unnecessarily complicated, when we don't have a lot of good
    infrastructure for it.

    Let it rip!

    Linus Torvalds