lkml.org 
[lkml]   [2016]   [May]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v8 1/4] x86/KASLR: Clarify identity map interface

* Kees Cook <keescook@chromium.org> wrote:

> On Tue, May 10, 2016 at 11:24 PM, Ingo Molnar <mingo@kernel.org> wrote:
> >
> > * Kees Cook <keescook@chromium.org> wrote:
> >
> >> +/*
> >> + * Mapping information structure passed to kernel_ident_mapping_init().
> >> + * Due to relocation, pointers must be assigned at run time not build time.
> >> + */
> >> +static struct x86_mapping_info mapping_info = {
> >> + .pmd_flag = __PAGE_KERNEL_LARGE_EXEC,
> >> +};
> >
> >> +void initialize_identity_maps(void)
> >> {
> >> + /* Init mapping_info with run-time function/buffer pointers. */
> >> + mapping_info.alloc_pgt_page = alloc_pgt_page;
> >> + mapping_info.context = &pgt_data;
> >
> > Could you please outline the precise failure mode? What gets executed when, which
> > pointer gets relocated and which not, and exactly when does it pose a problem,
> > etc.
>
> It's the issue described at the top of misc.c:
>
> /*
> * WARNING!!
> * This code is compiled with -fPIC and it is relocated dynamically at
> * run time, but no relocation processing is performed. This means that
> * it is not safe to place pointers in static structures.
> */

Btw., is there any way to detect such invalid pointers during build-time somehow?
This is not the first such bug and I suspect it won't be the last one either.

Thanks,

Ingo

\
 
 \ /
  Last update: 2016-05-12 10:41    [W:1.466 / U:0.276 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site