lkml.org 
[lkml]   [2014]   [Oct]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] x86, kaslr: avoid setup_data when picking location
On 09/11/2014 09:19 AM, Kees Cook wrote:
> --- a/arch/x86/boot/compressed/aslr.c
> +++ b/arch/x86/boot/compressed/aslr.c
> @@ -183,12 +183,27 @@ static void mem_avoid_init(unsigned long input, unsigned long input_size,
> static bool mem_avoid_overlap(struct mem_vector *img)
> {
> int i;
> + struct setup_data *ptr;
>
> for (i = 0; i < MEM_AVOID_MAX; i++) {
> if (mem_overlaps(img, &mem_avoid[i]))
> return true;
> }
>
> + /* Avoid all entries in the setup_data linked list. */
> + ptr = (struct setup_data *)(unsigned long)real_mode->hdr.setup_data;
> + while (ptr) {
> + struct mem_vector avoid;
> +
> + avoid.start = (u64)ptr;
> + avoid.size = sizeof(*ptr) + ptr->len;
> +
> + if (mem_overlaps(img, &avoid))
> + return true;
> +
> + ptr = (struct setup_data *)(unsigned long)ptr->next;
> + }
> +
> return false;
> }
>
>

The use of (u64) in the assignment to avoid.start gives a nuisance
warning on 32 bits.

-hpa



\
 
 \ /
  Last update: 2014-10-01 20:41    [W:0.127 / U:0.396 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site