[lkml]   [2017]   [Oct]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] tty: vt: remove multi-fetch, derive font.height from
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 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: =
> 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 is fetched in. In this way, the
> userspace data is fetched in one shot and we directly dereference
> the in kernel space to probe for the height.
> Signed-off-by: Meng Xu <>
> ---
> drivers/tty/vt/vt.c | 48 ++++++++++++++++++++++++++++--------------------
> 1 file changed, 28 insertions(+), 20 deletions(-)

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

Can you fix the obvious issues up and resend?


greg k-h

 \ /
  Last update: 2017-10-04 10:23    [W:0.029 / U:4.000 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site