mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Vegard Nossum" <vegard.nossum@gmail.com>
To: "Jiri Slaby" <jirislaby@gmail.com>
Cc: "Andi Kleen" <andi@firstfloor.org>,
	"Vegard Nossum" <vegardno@ifi.uio.no>,
	"Ingo Molnar" <mingo@elte.hu>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86: fix virt_addr_valid() with CONFIG_DEBUG_VIRTUAL=y
Date: Thu, 2 Oct 2008 08:18:03 +0200	[thread overview]
Message-ID: <19f34abd0810012318p75bd3773s97b999b9f1ffcae9@mail.gmail.com> (raw)
In-Reply-To: <48E3D6FC.7070709@gmail.com>

On Wed, Oct 1, 2008 at 10:01 PM, Jiri Slaby <jirislaby@gmail.com> wrote:
> On 10/01/2008 09:46 PM, Andi Kleen wrote:
>>> Anyway virt_addr_valid() is IMHO wrong. E.g. first modules VM address
>>> 0xffffffffa0000000 is after __pa() 200M which is valid pfn after the shift even
>>> on the flatmem model with enough memory.
>>>
>>> Am I missing something? What's the exact purpose of the virt_addr_valid()?
>>
>> I think it's supposed to be only used on direct mapping anyways (judging
>> from a quick look a the users)
>
> Then kmemcheck assumes something else. Citing:
>  * We need to be extremely careful not to follow any invalid pointers,
>  * because this function can be called for *any* possible address.
> and the very first check is !virt_addr_valid(address).

The purpose of this call was to make sure that the page behind the
virtual address has an associated struct page. That is the assumption:
virt_to_page() will return something meaningful if and only if
virt_addr_valid().

>
>> So not handling text mapping is ok, but don't panic on it.
>
> It doesn't handle properly anything but text and direct mapping. Now it
> oopses/causes BUG on that wrong cases.
>
> I think we should set it down there that it was intended to be used only on
> text/direct mapping and only for checking if there is a physical memory page
> behind this kind of virtual address.


Vegard

-- 
"The animistic metaphor of the bug that maliciously sneaked in while
the programmer was not looking is intellectually dishonest as it
disguises that the error is the programmer's own creation."
	-- E. W. Dijkstra, EWD1036

      reply	other threads:[~2008-10-02  6:18 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
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 [this message]

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=19f34abd0810012318p75bd3773s97b999b9f1ffcae9@mail.gmail.com \
    --to=vegard.nossum@gmail.com \
    --cc=andi@firstfloor.org \
    --cc=jirislaby@gmail.com \
    --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

all inboxes | Powered by JetHome®