lkml.org 
[lkml]   [2015]   [Apr]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] x86/uaccess: Implement get_kernel()
On Fri, Apr 10, 2015 at 01:14:27PM +0200, Ingo Molnar wrote:
> +/*
> + * Simple copy-from-possibly-faulting-kernel-addresses method that
> + * avoids the STAC/CLAC SMAP overhead.
> + *
> + * NOTE: this does not propagate the error code of faulting kernel
> + * addresses properly. You can recover it via uaccess_catch()
> + * if you really need to.
> + */
> +#define get_kernel(dst, src) \
> +do { \
> + typeof(*(src)) __val; \

Should we make that:

typeof(*(src)) __val = (dst);

> + \
> + switch (sizeof(__val)) { \
> + case 1: __get_kernel_asm_ex(__val, src, "b", "b", "=q"); break; \
> + case 2: __get_kernel_asm_ex(__val, src, "w", "w", "=r"); break; \
> + case 4: __get_kernel_asm_ex(__val, src, "l", "k", "=r"); break; \
> + case 8: __get_kernel_asm_ex(__val, src, "q", " ", "=r"); break; \
> + default: __get_kernel_BUILD_ERROR(); \
> + } \
> + (dst) = __val; \
> +} while (0)

Such that when we fault, the value is unmodified? The way it is we'll
assign whatever was on stack for __val, which seems undesirable, no?


\
 
 \ /
  Last update: 2015-04-10 14:01    [W:0.170 / U:29.892 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site