public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Kees Cook <keescook@chromium.org>
Cc: linux-kernel@vger.kernel.org, Baoquan He <bhe@redhat.com>,
	Vivek Goyal <vgoyal@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>,
	x86@kernel.org, "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Wei Yongjun <yongjun_wei@trendmicro.com.cn>,
	Pavel Machek <pavel@ucw.cz>
Subject: Re: [PATCH] x86, kaslr: avoid setup_data when picking location
Date: Wed, 01 Oct 2014 11:01:27 -0700	[thread overview]
Message-ID: <542C4177.6060409@zytor.com> (raw)
In-Reply-To: <20140911161931.GA12001@www.outflux.net>

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


  parent reply	other threads:[~2014-10-01 18:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-11 16:19 [PATCH] x86, kaslr: avoid setup_data when picking location Kees Cook
2014-09-19 11:49 ` [tip:x86/urgent] x86/kaslr: Avoid the setup_data area " tip-bot for Kees Cook
2014-10-01 18:01 ` H. Peter Anvin [this message]
2014-10-01 18:08   ` [PATCH] x86, kaslr: avoid setup_data " Kees Cook
2014-10-01 18:13     ` H. Peter Anvin

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=542C4177.6060409@zytor.com \
    --to=hpa@zytor.com \
    --cc=bhe@redhat.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pavel@ucw.cz \
    --cc=rafael.j.wysocki@intel.com \
    --cc=tglx@linutronix.de \
    --cc=vgoyal@redhat.com \
    --cc=x86@kernel.org \
    --cc=yongjun_wei@trendmicro.com.cn \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox