linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicolas Pitre <nicolas.pitre@linaro.org>
To: Kees Cook <keescook@chromium.org>
Cc: Nicolas Pitre <nicolas.pitre@linaro.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Dave Mielke <Dave@mielke.cc>,
	Samuel Thibault <samuel.thibault@ens-lyon.org>,
	Adam Borowski <kilobyte@angband.pl>,
	Alan Cox <gnomes@lxorguk.ukuu.org.uk>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-console@vger.kernel.org
Subject: Re: [PATCH v3 1/3] vt: preserve unicode values corresponding to screen characters
Date: Tue, 10 Jul 2018 23:39:39 -0400	[thread overview]
Message-ID: <79334C7E-6E76-4B5C-9A32-C6DA40D8E88E@linaro.org> (raw)
In-Reply-To: <CAGXu5j+KLvJ-n_QRrfq15E8iO_rqfpp+K7PDAZHZMHcemy9y7g@mail.gmail.com>

I am on vacation away from an actual keyboard until next week. Will look at it then. 

> Le 10 juill. 2018 à 20:52, Kees Cook <keescook@chromium.org> a écrit :
> 
>> On Tue, Jun 26, 2018 at 8:56 PM, Nicolas Pitre <nicolas.pitre@linaro.org> wrote:
>> 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: Nicolas Pitre <nico@linaro.org>
>> Tested-by: Dave Mielke <Dave@mielke.cc>
>> Acked-by: Adam Borowski <kilobyte@angband.pl>
>> ---
>> drivers/tty/vt/vt.c            | 220 +++++++++++++++++++++++++++++++--
>> include/linux/console_struct.h |   2 +
>> 2 files changed, 211 insertions(+), 11 deletions(-)
>> 
>> diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
>> index 1eb1a376a0..7b636638b3 100644
>> --- a/drivers/tty/vt/vt.c
>> +++ b/drivers/tty/vt/vt.c
>> [...]
>> +static void vc_uniscr_scroll(struct vc_data *vc, unsigned int t, unsigned int b,
>> +                            enum con_scroll dir, unsigned int nr)
>> +{
>> +       struct uni_screen *uniscr = get_vc_uniscr(vc);
>> +
>> +       if (uniscr) {
>> +               unsigned int s, d, rescue, clear;
>> +               char32_t *save[nr];
> 
> Can you adjust this to avoid the VLA here? I've almost gotten all VLAs
> removed from the kernel[1], and this is introducing a new one. :)
> 
> Thanks!
> 
> -Kees
> 
> [1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qPXydAacU1RqZWA@mail.gmail.com
> 
>> +
>> +               s = clear = t;
>> +               d = t + nr;
>> +               rescue = b - nr;
>> +               if (dir == SM_UP) {
>> +                       swap(s, d);
>> +                       swap(clear, rescue);
>> +               }
>> +               memcpy(save, uniscr->lines + rescue, nr * sizeof(*save));
>> +               memmove(uniscr->lines + d, uniscr->lines + s,
>> +                       (b - t - nr) * sizeof(*uniscr->lines));
>> +               memcpy(uniscr->lines + clear, save, nr * sizeof(*save));
>> +               vc_uniscr_clear_lines(vc, clear, nr);
>> +       }
>> +}
> 
> 
> -- 
> Kees Cook
> Pixel Security

  reply	other threads:[~2018-07-11  3:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-27  3:56 [PATCH v3 0/3] have the vt console preserve unicode characters Nicolas Pitre
2018-06-27  3:56 ` [PATCH v3 1/3] vt: preserve unicode values corresponding to screen characters Nicolas Pitre
2018-07-11  0:52   ` Kees Cook
2018-07-11  3:39     ` Nicolas Pitre [this message]
2018-07-11 20:40       ` Kees Cook
2018-07-11  9:18     ` Greg Kroah-Hartman
2018-07-11 20:39       ` Kees Cook
2018-07-11 21:29         ` Adam Borowski
2018-06-27  3:56 ` [PATCH v3 2/3] vt: introduce unicode mode for /dev/vcs Nicolas Pitre
2018-06-29  8:15   ` Geert Uytterhoeven
2018-06-27  3:56 ` [PATCH v3 3/3] vt: unicode fallback for scrollback Nicolas Pitre
2018-06-28 12:38 ` [PATCH v3 0/3] have the vt console preserve unicode characters Greg Kroah-Hartman
2018-07-18  1:00   ` Nicolas Pitre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=79334C7E-6E76-4B5C-9A32-C6DA40D8E88E@linaro.org \
    --to=nicolas.pitre@linaro.org \
    --cc=Dave@mielke.cc \
    --cc=gnomes@lxorguk.ukuu.org.uk \
    --cc=gregkh@linuxfoundation.org \
    --cc=keescook@chromium.org \
    --cc=kilobyte@angband.pl \
    --cc=linux-console@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=samuel.thibault@ens-lyon.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).