1. 16 3月, 2020 2 次提交
  2. 13 3月, 2020 1 次提交
  3. 28 2月, 2020 1 次提交
  4. 21 2月, 2020 1 次提交
  5. 11 2月, 2020 1 次提交
  6. 14 1月, 2020 3 次提交
  7. 25 7月, 2019 1 次提交
  8. 13 6月, 2019 2 次提交
  9. 24 5月, 2019 2 次提交
    • G
      vt/fbcon: deinitialize resources in visual_init() after failed memory allocation · a1ad1cc9
      Grzegorz Halat 提交于
      After memory allocation failure vc_allocate() doesn't clean up data
      which has been initialized in visual_init(). In case of fbcon this
      leads to divide-by-0 in fbcon_init() on next open of the same tty.
      
      memory allocation in vc_allocate() may fail here:
      1097:     vc->vc_screenbuf = kzalloc(vc->vc_screenbuf_size, GFP_KERNEL);
      
      on next open() fbcon_init() skips vc_font.data initialization:
      1088:     if (!p->fontdata) {
      
      division by zero in fbcon_init() happens here:
      1149:     new_cols /= vc->vc_font.width;
      
      Additional check is needed in fbcon_deinit() to prevent
      usage of uninitialized vc_screenbuf:
      
      1251:        if (vc->vc_hi_font_mask && vc->vc_screenbuf)
      1252:                set_vc_hi_font(vc, false);
      
      Crash:
      
       #6 [ffffc90001eafa60] divide_error at ffffffff81a00be4
          [exception RIP: fbcon_init+463]
          RIP: ffffffff814b860f  RSP: ffffc90001eafb18  RFLAGS: 00010246
      ...
       #7 [ffffc90001eafb60] visual_init at ffffffff8154c36e
       #8 [ffffc90001eafb80] vc_allocate at ffffffff8154f53c
       #9 [ffffc90001eafbc8] con_install at ffffffff8154f624
      ...
      Signed-off-by: NGrzegorz Halat <ghalat@redhat.com>
      Reviewed-by: NOleksandr Natalenko <oleksandr@redhat.com>
      Acked-by: NBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a1ad1cc9
    • G
      vt/fbcon: deinitialize resources in visual_init() after failed memory allocation · 5e309c6c
      Grzegorz Halat 提交于
      After memory allocation failure vc_allocate() doesn't clean up data
      which has been initialized in visual_init(). In case of fbcon this
      leads to divide-by-0 in fbcon_init() on next open of the same tty.
      
      memory allocation in vc_allocate() may fail here:
      1097:     vc->vc_screenbuf = kzalloc(vc->vc_screenbuf_size, GFP_KERNEL);
      
      on next open() fbcon_init() skips vc_font.data initialization:
      1088:     if (!p->fontdata) {
      
      division by zero in fbcon_init() happens here:
      1149:     new_cols /= vc->vc_font.width;
      
      Additional check is needed in fbcon_deinit() to prevent
      usage of uninitialized vc_screenbuf:
      
      1251:        if (vc->vc_hi_font_mask && vc->vc_screenbuf)
      1252:                set_vc_hi_font(vc, false);
      
      Crash:
      
       #6 [ffffc90001eafa60] divide_error at ffffffff81a00be4
          [exception RIP: fbcon_init+463]
          RIP: ffffffff814b860f  RSP: ffffc90001eafb18  RFLAGS: 00010246
      ...
       #7 [ffffc90001eafb60] visual_init at ffffffff8154c36e
       #8 [ffffc90001eafb80] vc_allocate at ffffffff8154f53c
       #9 [ffffc90001eafbc8] con_install at ffffffff8154f624
      ...
      Signed-off-by: NGrzegorz Halat <ghalat@redhat.com>
      Reviewed-by: NOleksandr Natalenko <oleksandr@redhat.com>
      Acked-by: NBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5e309c6c
  10. 19 4月, 2019 1 次提交
  11. 17 4月, 2019 1 次提交
    • M
      vt: fix cursor when clearing the screen · b2ecf006
      Mikulas Patocka 提交于
      The patch a6dbe442 ("vt: perform safe console erase in the right
      order") introduced a bug. The conditional do_update_region() was
      replaced by a call to update_region() that does contain the conditional
      already, but with unwanted extra side effects such as restoring the cursor
      drawing.
      
      In order to reproduce the bug:
      - use framebuffer console with the AMDGPU driver
      - type "links" to start the console www browser
      - press 'q' and space to exit links
      
      Now the cursor will be permanently visible in the center of the
      screen. It will stay there until something overwrites it.
      
      The bug goes away if we change update_region() back to the conditional
      do_update_region().
      
      [ nico: reworded changelog ]
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Reviewed-by: NNicolas Pitre <nico@fluxnic.net>
      Cc: stable@vger.kernel.org
      Fixes: a6dbe442 ("vt: perform safe console erase in the right order")
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2ecf006
  12. 28 3月, 2019 1 次提交
    • Y
      tty: vt.c: Fix TIOCL_BLANKSCREEN console blanking if blankinterval == 0 · 75ddbc1f
      Yifeng Li 提交于
      Previously, in the userspace, it was possible to use the "setterm" command
      from util-linux to blank the VT console by default, using the following
      command.
      
      According to the man page,
      
      > The force option keeps the screen blank even if a key is pressed.
      
      It was implemented by calling TIOCL_BLANKSCREEN.
      
      	case BLANKSCREEN:
      		ioctlarg = TIOCL_BLANKSCREEN;
      		if (ioctl(STDIN_FILENO, TIOCLINUX, &ioctlarg))
      			warn(_("cannot force blank"));
      		break;
      
      However, after Linux 4.12, this command ceased to work anymore, which is
      unexpected. By inspecting the kernel source, it shows that the issue was
      triggered by the side-effect from commit a4199f5e ("tty: Disable
      default console blanking interval").
      
      The console blanking is implemented by function do_blank_screen() in vt.c:
      "blank_state" will be initialized to "blank_normal_wait" in con_init() if
      AND ONLY IF ("blankinterval" > 0). If "blankinterval" is 0, "blank_state"
      will be "blank_off" (== 0), and a call to do_blank_screen() will always
      abort, even if a forced blanking is required from the user by calling
      TIOCL_BLANKSCREEN, the console won't be blanked.
      
      This behavior is unexpected from a user's point-of-view, since it's not
      mentioned in any documentation. The setterm man page suggests it will
      always work, and the kernel comments in uapi/linux/tiocl.h says
      
      > /* keep screen blank even if a key is pressed */
      > #define TIOCL_BLANKSCREEN 14
      
      To fix it, we simply remove the "blank_state != blank_off" check, as
      pointed out by Nicolas Pitre, this check doesn't logically make sense
      and it's safe to remove.
      Suggested-by: NNicolas Pitre <nicolas.pitre@linaro.org>
      Fixes: a4199f5e ("tty: Disable default console blanking interval")
      Signed-off-by: NYifeng Li <tomli@tomli.me>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      75ddbc1f
  13. 12 2月, 2019 1 次提交
  14. 18 1月, 2019 9 次提交
  15. 08 11月, 2018 1 次提交
  16. 11 9月, 2018 1 次提交
  17. 21 7月, 2018 3 次提交
  18. 28 6月, 2018 4 次提交
    • N
      vt: unicode fallback for scrollback · 708d0bff
      Nicolas Pitre 提交于
      There is currently no provision for scrollback content in the core code,
      leaving that to backend video drivers where this can be highly optimized.
      There is currently no common method for those drivers to tell the core
      what part of the scrollback is actually displayed and what size the
      scrollback buffer is either. Because of that, the unicode screen buffer
      has no provision for any scrollback.
      
      At least we can provide backtranslated glyph values when the scrollback
      is active which should be plenty good enough for now.
      Signed-off-by: NNicolas Pitre <nico@linaro.org>
      Tested-by: NDave Mielke <Dave@mielke.cc>
      Acked-by: NAdam Borowski <kilobyte@angband.pl>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      708d0bff
    • N
      vt: introduce unicode mode for /dev/vcs · d21b0be2
      Nicolas Pitre 提交于
      Now that the core vt code knows how to preserve unicode values for each
      displayed character, it is then possible to let user space access it via
      /dev/vcs*.
      
      Unicode characters are presented as 32 bit values in native endianity
      via the /dev/vcsu* devices, mimicking the simple /dev/vcs* devices.
      Unicode with attributes (similarly to /dev/vcsa*) is not supported at
      the moment.
      
      Data is available only as long as the console is in UTF-8 mode. ENODATA
      is returned otherwise.
      
      This was tested with the latest development version (to become
      version 5.7) of BRLTTY. Amongst other things, this allows ⠋⠕⠗ ⠞⠓⠊⠎
      ⠃⠗⠁⠊⠇⠇⠑⠀⠞⠑⠭⠞⠀to appear directly on braille displays regardless of the
      console font being used.
      Signed-off-by: NNicolas Pitre <nico@linaro.org>
      Tested-by: NDave Mielke <Dave@mielke.cc>
      Acked-by: NAdam Borowski <kilobyte@angband.pl>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d21b0be2
    • N
      vt: preserve unicode values corresponding to screen characters · d8ae7242
      Nicolas Pitre 提交于
      The vt code translates UTF-8 strings into glyph index values and stores
      those glyph values directly in the screen buffer. Because there can only
      be at most 512 glyphs, it is impossible to represent most unicode
      characters, in which case a default glyph (often '?') is displayed
      instead. The original unicode value is then lost.
      
      This patch implements the basic screen buffer handling to preserve unicode
      values alongside corresponding display glyphs.  It is not activated by
      default, meaning that people not relying on that functionality won't get
      the implied overhead.
      Signed-off-by: NNicolas Pitre <nico@linaro.org>
      Tested-by: NDave Mielke <Dave@mielke.cc>
      Acked-by: NAdam Borowski <kilobyte@angband.pl>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d8ae7242
    • A
      vt: prevent leaking uninitialized data to userspace via /dev/vcs* · 21eff69a
      Alexander Potapenko 提交于
      KMSAN reported an infoleak when reading from /dev/vcs*:
      
        BUG: KMSAN: kernel-infoleak in vcs_read+0x18ba/0x1cc0
        Call Trace:
        ...
         kmsan_copy_to_user+0x7a/0x160 mm/kmsan/kmsan.c:1253
         copy_to_user ./include/linux/uaccess.h:184
         vcs_read+0x18ba/0x1cc0 drivers/tty/vt/vc_screen.c:352
         __vfs_read+0x1b2/0x9d0 fs/read_write.c:416
         vfs_read+0x36c/0x6b0 fs/read_write.c:452
        ...
        Uninit was created at:
         kmsan_save_stack_with_flags mm/kmsan/kmsan.c:279
         kmsan_internal_poison_shadow+0xb8/0x1b0 mm/kmsan/kmsan.c:189
         kmsan_kmalloc+0x94/0x100 mm/kmsan/kmsan.c:315
         __kmalloc+0x13a/0x350 mm/slub.c:3818
         kmalloc ./include/linux/slab.h:517
         vc_allocate+0x438/0x800 drivers/tty/vt/vt.c:787
         con_install+0x8c/0x640 drivers/tty/vt/vt.c:2880
         tty_driver_install_tty drivers/tty/tty_io.c:1224
         tty_init_dev+0x1b5/0x1020 drivers/tty/tty_io.c:1324
         tty_open_by_driver drivers/tty/tty_io.c:1959
         tty_open+0x17b4/0x2ed0 drivers/tty/tty_io.c:2007
         chrdev_open+0xc25/0xd90 fs/char_dev.c:417
         do_dentry_open+0xccc/0x1440 fs/open.c:794
         vfs_open+0x1b6/0x2f0 fs/open.c:908
        ...
        Bytes 0-79 of 240 are uninitialized
      
      Consistently allocating |vc_screenbuf| with kzalloc() fixes the problem
      
      Reported-by: syzbot+17a8efdf800000@syzkaller.appspotmail.com
      Signed-off-by: NAlexander Potapenko <glider@google.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      21eff69a
  19. 26 5月, 2018 1 次提交
  20. 26 3月, 2018 1 次提交
  21. 15 3月, 2018 1 次提交
    • M
      vt: change SGR 21 to follow the standards · 65d9982d
      Mike Frysinger 提交于
      ECMA-48 [1] (aka ISO 6429) has defined SGR 21 as "doubly underlined"
      since at least March 1984.  The Linux kernel has treated it as SGR 22
      "normal intensity" since it was added in Linux-0.96b in June 1992.
      Before that, it was simply ignored.  Other terminal emulators have
      either ignored it, or treat it as double underline now.  xterm for
      example added support in its 304 release (May 2014) [2] where it was
      previously ignoring it.
      
      Changing this behavior shouldn't be an issue:
      - It isn't a named capability in ncurses's terminfo database, so no
        script is using libtinfo/libcurses to look this up, or using tput
        to query & output the right sequence.
      - Any script assuming SGR 21 will reset intensity in all terminals
        already do not work correctly on non-Linux VTs (including running
        under screen/tmux/etc...).
      - If someone has written a script that only runs in the Linux VT, and
        they're using SGR 21 (instead of SGR 22), the output should still
        be readable.
      
      imo it's important to change this as the Linux VT's non-conformance
      is sometimes used as an argument for other terminal emulators to not
      implement SGR 21 at all, or do so incorrectly.
      
      [1]: https://www.ecma-international.org/publications/standards/Ecma-048.htm
      [2]: https://github.com/ThomasDickey/xterm-snapshots/commit/2fd29cb98d214cb536bcafbee00bc73b3f1eeb9dSigned-off-by: NMike Frysinger <vapier@chromium.org>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      65d9982d
  22. 22 11月, 2017 1 次提交
    • K
      treewide: Switch DEFINE_TIMER callbacks to struct timer_list * · 24ed960a
      Kees Cook 提交于
      This changes all DEFINE_TIMER() callbacks to use a struct timer_list
      pointer instead of unsigned long. Since the data argument has already been
      removed, none of these callbacks are using their argument currently, so
      this renames the argument to "unused".
      
      Done using the following semantic patch:
      
      @match_define_timer@
      declarer name DEFINE_TIMER;
      identifier _timer, _callback;
      @@
      
       DEFINE_TIMER(_timer, _callback);
      
      @change_callback depends on match_define_timer@
      identifier match_define_timer._callback;
      type _origtype;
      identifier _origarg;
      @@
      
       void
      -_callback(_origtype _origarg)
      +_callback(struct timer_list *unused)
       { ... }
      Signed-off-by: NKees Cook <keescook@chromium.org>
      24ed960a