All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Meng Xu <mengxu.gatech@gmail.com>
Cc: jslaby@suse.com, kilobyte@angband.pl,
	linux-kernel@vger.kernel.org, meng.xu@gatech.edu,
	sanidhya@gatech.edu, taesoo@gatech.edu
Subject: Re: [PATCH] tty: vt: remove multi-fetch, derive font.height from font.data
Date: Wed, 4 Oct 2017 10:22:31 +0200	[thread overview]
Message-ID: <20171004082231.GA13559@kroah.com> (raw)
In-Reply-To: <1506272382-17815-1-git-send-email-mengxu.gatech@gmail.com>

On Sun, Sep 24, 2017 at 12:59:42PM -0400, Meng Xu wrote:
> In con_font_set(), when we need to guess font height (for
> compat reasons?), the current approach uses multiple userspace
> fetches, i.e., get_user(tmp, &charmap[32*i+h-1]), to derive
> the height. This has two drawbacks:
> 
> 1. performance: accessing userspace memory is less efficient than
> directly de-reference the byte
> 
> 2. security: a more critical problem is that the height derived
> might not match with the actual font.data. This is because a user
> thread might race condition to change the memory of op->data after
> the op->height guessing but before the second fetch: font.data =
> memdup_user(op->data, size). Leaving font.height = 32 while the
> actual height is 1 or vice-versa.
> 
> This patch tries to resolve both issues by re-locating the height
> guessing part after the font.data is fetched in. In this way, the
> userspace data is fetched in one shot and we directly dereference
> the font.data in kernel space to probe for the height.
> 
> Signed-off-by: Meng Xu <mengxu.gatech@gmail.com>
> ---
>  drivers/tty/vt/vt.c | 48 ++++++++++++++++++++++++++++--------------------
>  1 file changed, 28 insertions(+), 20 deletions(-)

Please always run your patches through checkpatch.pl so that you don't
get a grumpy maintainer telling you to use checkpatch.pl :(

Can you fix the obvious issues up and resend?

thanks,

greg k-h

  reply	other threads:[~2017-10-04  8:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-24 16:59 [PATCH] tty: vt: remove multi-fetch, derive font.height from font.data Meng Xu
2017-10-04  8:22 ` Greg KH [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-10-04 14:12 Meng Xu
2017-10-04 14:29 ` Greg KH

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=20171004082231.GA13559@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.com \
    --cc=kilobyte@angband.pl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=meng.xu@gatech.edu \
    --cc=mengxu.gatech@gmail.com \
    --cc=sanidhya@gatech.edu \
    --cc=taesoo@gatech.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.