mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@gmail.com>
To: Vegard Nossum <vegardno@ifi.uio.no>
Cc: Ingo Molnar <mingo@elte.hu>, Andi Kleen <andi@firstfloor.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86: fix virt_addr_valid() with CONFIG_DEBUG_VIRTUAL=y
Date: Wed, 01 Oct 2008 13:06:28 +0200	[thread overview]
Message-ID: <48E359B4.7050708@gmail.com> (raw)
In-Reply-To: <20081001104717.GA7925@ben.ifi.uio.no>

On 10/01/2008 12:47 PM, Vegard Nossum wrote:
> Hi,
> 
> Fix for tip/x86/mm-debug (commit 59ea746337c69f6a5f1bc4d5e8544b3cbf12f801).
> I'm not sure if choice of names/structure is entirely correct, comments are
> appreciated.


> From 01613a1949de51c7ab9d0acaaa9a5444722a5cfa Mon Sep 17 00:00:00 2001
> From: Vegard Nossum <vegardno@ben.ifi.uio.no>
> Date: Wed, 1 Oct 2008 12:36:34 +0200
> Subject: [PATCH] x86: fix virt_addr_valid() with CONFIG_DEBUG_VIRTUAL=y
> 
> virt_addr_valid() calls __pa(), which calls __phys_addr(). With
> CONFIG_DEBUG_VIRTUAL=y, __phys_addr() will kill the kernel if the
> address *isn't* valid. That's clearly wrong for virt_addr_valid().
> 
> Cc: Jiri Slaby <jirislaby@gmail.com>
> Cc: Andi Kleen <andi@firstfloor.org>
> Signed-off-by: Vegard Nossum <vegardno@ben.ifi.uio.no>
> ---
> diff --git a/arch/x86/kernel/doublefault_32.c b/arch/x86/kernel/doublefault_32.c
> index 395acb1..1580e0b 100644
> --- a/arch/x86/kernel/doublefault_32.c
> +++ b/arch/x86/kernel/doublefault_32.c
> @@ -66,6 +66,6 @@ struct tss_struct doublefault_tss __cacheline_aligned = {
>  		.ds		= __USER_DS,
>  		.fs		= __KERNEL_PERCPU,
>  
> -		.__cr3		= __phys_addr_const((unsigned long)swapper_pg_dir)
> +		.__cr3	= __phys_addr_nodebug((unsigned long)swapper_pg_dir)

Now, this may be switched back to __pa: __pa_nodebug(swapper_pg_dir);

>  	}
>  };
[...]
> --- a/include/asm-x86/page_64.h
> +++ b/include/asm-x86/page_64.h
> @@ -69,6 +69,7 @@ extern unsigned long max_pfn;
>  extern unsigned long phys_base;
>  
>  extern unsigned long __phys_addr(unsigned long);
> +#define __phys_addr_nodebug(x) __phys_addr(x)
>  #define __phys_reloc_hide(x)	(x)

x86_64 is screwed in the same way, isn't it?

  reply	other threads:[~2008-10-01 11:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-01 10:47 Vegard Nossum
2008-10-01 11:06 ` Jiri Slaby [this message]
2008-10-01 11:07   ` Jiri Slaby
2008-10-01 11:15   ` Vegard Nossum
2008-10-01 11:26     ` Jiri Slaby
2008-10-01 16:42       ` Vegard Nossum
2008-10-01 16:52         ` Andi Kleen
2008-10-01 19:32           ` Jiri Slaby
2008-10-01 19:46             ` Andi Kleen
2008-10-01 20:01               ` Jiri Slaby
2008-10-02  6:18                 ` Vegard Nossum

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=48E359B4.7050708@gmail.com \
    --to=jirislaby@gmail.com \
    --cc=andi@firstfloor.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=vegardno@ifi.uio.no \
    /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

Powered by JetHome