All of lore.kernel.org
 help / color / mirror / Atom feed
From: qiuxishi@huawei.com (Xishi Qiu)
To: linux-arm-kernel@lists.infradead.org
Subject: Have any influence on set_memory_** about below patch ??
Date: Wed, 27 Jan 2016 09:18:57 +0800	[thread overview]
Message-ID: <56A81B01.7010104@huawei.com> (raw)
In-Reply-To: <20160113112813.GE23370@leverpostej>

On 2016/1/13 19:28, Mark Rutland wrote:

> On Wed, Jan 13, 2016 at 01:02:31PM +0800, Xishi Qiu wrote:
>> Hi Mark,
>>
>> If I do like this, does it have the problem too?
>>
>> kmalloc a size
>> no access
>> flush tlb
>> call set_memory_ro to change the page table flag
>> flush tlb
>> start access
> 
> This is broken.
> 
> The kmalloc will give you memory form the linear mapping. Even if you
> allocate a page, that page could have been mapped with a section at the
> PMD/PUD/PGD level.
> 
> Other data could fall within that section (e.g. a kernel stack,
> perhaps).

Hi Mark,

If nobody use that whole section before(however it is almost impossible),
flush tlb is safe, right?

Thanks,
Xishi Qiu

> 
> Additional TLB flushees do not help. There's still a race against the
> asynchronous TLB logic. The TLB can allocate or destroy entries at any
> tim. If there were no page table changes prior to the invalidate, the
> TLB could re-allocate all existing entries immediately after the TLB
> invalidate, leaving you in the same state as before.
> 
> Thanks,
> Mark.
> 
> .
> 

WARNING: multiple messages have this Message-ID (diff)
From: Xishi Qiu <qiuxishi@huawei.com>
To: Mark Rutland <mark.rutland@arm.com>
Cc: zhong jiang <zhongjiang@huawei.com>,
	Laura Abbott <labbott@fedoraproject.org>,
	Hanjun Guo <guohanjun@huawei.com>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: Have any influence on set_memory_** about below patch ??
Date: Wed, 27 Jan 2016 09:18:57 +0800	[thread overview]
Message-ID: <56A81B01.7010104@huawei.com> (raw)
In-Reply-To: <20160113112813.GE23370@leverpostej>

On 2016/1/13 19:28, Mark Rutland wrote:

> On Wed, Jan 13, 2016 at 01:02:31PM +0800, Xishi Qiu wrote:
>> Hi Mark,
>>
>> If I do like this, does it have the problem too?
>>
>> kmalloc a size
>> no access
>> flush tlb
>> call set_memory_ro to change the page table flag
>> flush tlb
>> start access
> 
> This is broken.
> 
> The kmalloc will give you memory form the linear mapping. Even if you
> allocate a page, that page could have been mapped with a section at the
> PMD/PUD/PGD level.
> 
> Other data could fall within that section (e.g. a kernel stack,
> perhaps).

Hi Mark,

If nobody use that whole section before(however it is almost impossible),
flush tlb is safe, right?

Thanks,
Xishi Qiu

> 
> Additional TLB flushees do not help. There's still a race against the
> asynchronous TLB logic. The TLB can allocate or destroy entries at any
> tim. If there were no page table changes prior to the invalidate, the
> TLB could re-allocate all existing entries immediately after the TLB
> invalidate, leaving you in the same state as before.
> 
> Thanks,
> Mark.
> 
> .
> 

  reply	other threads:[~2016-01-27  1:18 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <5693A740.7070408@huawei.com>
     [not found] ` <20160111133145.GM6499@leverpostej>
2016-01-12  1:20   ` Have any influence on set_memory_** about below patch ?? Xishi Qiu
2016-01-12  1:20     ` Xishi Qiu
2016-01-12 11:15     ` Mark Rutland
2016-01-12 11:15       ` Mark Rutland
2016-01-13  4:10       ` Xishi Qiu
2016-01-13  4:10         ` Xishi Qiu
2016-01-13 11:22         ` Mark Rutland
2016-01-13 11:22           ` Mark Rutland
2016-01-13  5:02       ` Xishi Qiu
2016-01-13  5:02         ` Xishi Qiu
2016-01-13  6:35         ` Xishi Qiu
2016-01-13  6:35           ` Xishi Qiu
2016-01-13 11:28         ` Mark Rutland
2016-01-13 11:28           ` Mark Rutland
2016-01-27  1:18           ` Xishi Qiu [this message]
2016-01-27  1:18             ` Xishi Qiu
2016-01-27 11:25             ` Mark Rutland
2016-01-27 11:25               ` Mark Rutland
2016-01-26 14:05         ` zhong jiang
2016-01-26 14:05           ` zhong jiang
2016-01-26 16:07           ` Mark Rutland
2016-01-26 16:07             ` Mark Rutland
2016-01-13 10:30       ` Xishi Qiu
2016-01-13 10:30         ` Xishi Qiu
2016-01-13 11:18         ` Mark Rutland
2016-01-13 11:18           ` Mark Rutland
2016-01-14 12:35           ` Xishi Qiu
2016-01-14 12:35             ` Xishi Qiu
2016-01-14 13:06             ` Xishi Qiu
2016-01-14 13:06               ` Xishi Qiu
2016-01-14 13:44               ` Mark Rutland
2016-01-14 13:44                 ` Mark Rutland

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=56A81B01.7010104@huawei.com \
    --to=qiuxishi@huawei.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.