From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Johan MOSSBERG <johan.xx.mossberg@stericsson.com>
Cc: Kyungmin Park <kmpark@infradead.org>,
Michal Nazarewicz <m.nazarewicz@samsung.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
Daniel Walker <dwalker@codeaurora.org>,
Mel Gorman <mel@csn.ul.ie>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Michal Nazarewicz <mina86@mina86.com>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
Ankita Garg <ankita@in.ibm.com>,
Andrew Morton <akpm@linux-foundation.org>,
"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
Marek Szyprowski <m.szyprowski@samsung.com>
Subject: Re: [PATCHv8 00/12] Contiguous Memory Allocator
Date: Tue, 4 Jan 2011 17:19:28 +0000 [thread overview]
Message-ID: <20110104171928.GB24935@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <C832F8F5D375BD43BFA11E82E0FE9FE00829C13EB2@EXDCVYMBSTM005.EQ1STM.local>
On Tue, Jan 04, 2011 at 05:23:37PM +0100, Johan MOSSBERG wrote:
> Russell King wrote:
> > Has anyone addressed my issue with it that this is wide-open for
> > abuse by allocating large chunks of memory, and then remapping
> > them in some way with different attributes, thereby violating the
> > ARM architecture specification?
>
> I seem to have missed the previous discussion about this issue.
> Where in the specification (preferably ARMv7) can I find
> information about this?
Here's the extracts from the architecture reference manual:
* If the same memory locations are marked as having different
cacheability attributes, for example by the use of aliases in a
virtual to physical address mapping, behavior is UNPREDICTABLE.
A3.5.7 Memory access restrictions
Behavior is UNPREDICTABLE if the same memory location:
* is marked as Shareable Normal and Non-shareable Normal
* is marked as having different memory types (Normal, Device, or
Strongly-ordered)
* is marked as having different cacheability attributes
* is marked as being Shareable Device and Non-shareable Device memory.
Such memory marking contradictions can occur, for example, by the use of
aliases in a virtual to physical address mapping.
Glossary:
UNPREDICTABLE
Means the behavior cannot be relied upon. UNPREDICTABLE behavior must not
represent security holes. UNPREDICTABLE behavior must not halt or hang
the processor, or any parts of the system. UNPREDICTABLE behavior must not
be documented or promoted as having a defined effect.
> Is the problem that it is simply
> forbidden to map an address multiple times with different cache
> setting and if this is done the hardware might start failing? Or
> is the problem that having an address mapped cached means that
> speculative pre-fetch can read it into the cache at any time,
> possibly causing problems if an un-cached mapping exists? In my
> opinion option number two can be handled and I've made an attempt
> at doing that in hwmem (posted on linux-mm a while ago), look in
> cache_handler.c. Hwmem currently does not use cma but the next
> version probably will.
Given the extract from the architecture reference manual, do you want
to run a system where you can't predict what the behaviour will be if
you have two mappings present, one which is cacheable and one which is
non-cacheable, and you're relying on the non-cacheable mapping to never
return data from the cache?
What if during your testing, it appears to work correctly, but out in
the field, someone's loaded a different application to your setup
resulting in different memory access patterns, causing cache lines to
appear in the non-cacheable mapping, and then the CPU hits them on
subsequent accesses corrupting data...
You can't say that will never happen if you're relying on this
unpredictable behaviour.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2011-01-04 17:20 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-15 20:34 [PATCHv8 00/12] Contiguous Memory Allocator Michal Nazarewicz
2010-12-15 20:34 ` [PATCHv8 01/12] mm: migrate.c: fix compilation error Michal Nazarewicz
2010-12-15 20:34 ` [PATCHv8 02/12] lib: bitmap: Added alignment offset for bitmap_find_next_zero_area() Michal Nazarewicz
2010-12-15 20:34 ` [PATCHv8 03/12] lib: genalloc: Generic allocator improvements Michal Nazarewicz
2010-12-15 20:34 ` [PATCHv8 04/12] mm: move some functions from memory_hotplug.c to page_isolation.c Michal Nazarewicz
2010-12-15 20:34 ` [PATCHv8 05/12] mm: alloc_contig_freed_pages() added Michal Nazarewicz
2010-12-15 20:34 ` [PATCHv8 06/12] mm: alloc_contig_range() added Michal Nazarewicz
2010-12-15 20:34 ` [PATCHv8 07/12] mm: cma: Contiguous Memory Allocator added Michal Nazarewicz
2011-02-02 12:43 ` Ankita Garg
2011-02-02 14:58 ` Michal Nazarewicz
2010-12-15 20:34 ` [PATCHv8 08/12] mm: MIGRATE_CMA migration type added Michal Nazarewicz
2010-12-15 20:34 ` [PATCHv8 09/12] mm: MIGRATE_CMA isolation functions added Michal Nazarewicz
2010-12-15 20:34 ` [PATCHv8 10/12] mm: MIGRATE_CMA support added to CMA Michal Nazarewicz
2010-12-15 20:34 ` [PATCHv8 11/12] mm: cma: Test device and application added Michal Nazarewicz
2010-12-15 20:34 ` [PATCHv8 12/12] ARM: cma: Added CMA to Aquila, Goni and c210 universal boards Michal Nazarewicz
2010-12-23 9:30 ` [PATCHv8 00/12] Contiguous Memory Allocator Kyungmin Park
2010-12-23 10:06 ` Russell King - ARM Linux
2010-12-23 10:58 ` Marek Szyprowski
2010-12-23 12:19 ` Russell King - ARM Linux
2010-12-23 13:09 ` Marek Szyprowski
2010-12-23 13:44 ` Russell King - ARM Linux
2011-01-12 18:49 ` Marek Szyprowski
2011-01-12 19:04 ` Nicolas Pitre
2011-01-13 7:01 ` Marek Szyprowski
2010-12-23 13:35 ` Tomasz Fujak
2010-12-23 13:48 ` Russell King - ARM Linux
2010-12-23 14:04 ` Tomasz Fujak
2010-12-23 14:16 ` Russell King - ARM Linux
2010-12-23 14:42 ` Felipe Contreras
2010-12-23 15:02 ` Michal Nazarewicz
2010-12-23 18:04 ` David Brown
2010-12-23 13:41 ` Michal Nazarewicz
2010-12-23 13:51 ` Russell King - ARM Linux
2010-12-23 14:08 ` Tomasz Fujak
2010-12-23 14:20 ` Russell King - ARM Linux
2010-12-23 15:35 ` Tomasz Fujak
2011-01-04 23:12 ` Jamie Lokier
2011-01-04 16:23 ` Johan MOSSBERG
2011-01-04 16:59 ` Michał Nazarewicz
2011-01-04 17:19 ` Russell King - ARM Linux [this message]
2011-01-04 17:31 ` Santosh Shilimkar
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=20110104171928.GB24935@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=akpm@linux-foundation.org \
--cc=ankita@in.ibm.com \
--cc=dwalker@codeaurora.org \
--cc=johan.xx.mossberg@stericsson.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=kmpark@infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=m.nazarewicz@samsung.com \
--cc=m.szyprowski@samsung.com \
--cc=mel@csn.ul.ie \
--cc=mina86@mina86.com \
/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;
as well as URLs for NNTP newsgroup(s).