[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4E29A20C.70402@zytor.com>
Date: Fri, 22 Jul 2011 09:15:08 -0700
From: "H. Peter Anvin" <hpa@...or.com>
To: Michal Hocko <mhocko@...e.cz>
CC: Venki Pallipadi <venkatesh.pallipadi@...el.com>, x86@...nel.org,
linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...e.hu>
Subject: Re: [PATCH] x86, PAT: honor CONFIG_STRICT_DEVMEM if pat is disable]
On 07/22/2011 02:11 AM, Michal Hocko wrote:
> Hi,
> I have just come across a strange behavior of /dev/[k]mem when PAT is
> configured while STRICT_DEVMEM is disabled.
> One would expect that /dev/kmem would allow to access also the
> system RAM in that configuration but that is not obviously true as pat
> code defines range_is_allowed to protect from accessing that memory.
>
> AFAICS this behavior was introduced in 0124cecf (x86, PAT: disable
> /dev/mem mmap RAM with PAT) which says that it disables [k]mem with PAT
> because it is safer. There is no explanation why it allows to access
> that memory if CONFIG_NONPROMISC_DEVMEM (CONFIG_STRICT_DEVMEM now).
>
> The thing is even more complicated by the fact that the access is
> allowed when nopat kernel parameter is specified because
> range_is_allowed just does't call devmem_is_allowed in that case.
>
> While I do agree that the feature is not safe in general we should honor
> STRICT_DEVMEM setting in some way IMO.
>
> What do you think about the following fix? I have tried to preserve
> "disabled for PAT" by default behavior.
The reason it is disabled for PAT is that it is very hard to track maps
of that memory that are created by mapping /dev/[k]mem, since those maps
don't have a defined PAT type and really should be transparently
tracking the consensus caching type; this is a facility that *could* be
created but has no other user.
-hpa
--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists