public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: Question about PTE_CONT in linux_4.10
Date: Tue, 14 Feb 2017 18:13:16 +0000	[thread overview]
Message-ID: <20170214181315.GM23718@leverpostej> (raw)
In-Reply-To: <B99C36949BCC8541A564076B659DD9706714ED6D@nkgeml514-mbx.china.huawei.com>

On Mon, Feb 13, 2017 at 08:04:03AM +0000, Wangxuefeng (E) wrote:
> Hi Jeremy,
> 
> I has a question about change access permission(X-executable) in
> linux_4.10 when continuous bit enable.
> In linux_4.10, the memories allocated by kmalloc are always set
> PTE_PXN and PTE_CONT. When I need change the access permission
> of the kmalloc area to make it has executable permission(clear
> PXN), what interface can I use?

Why do you wish to make a portion of this executable?

There is no interface for changing the linear map (i.e. the kmalloc
area) in this way because it cannot be implemented safely without
tremendous expense.

> The set_memory_x only change the PTE_PXN, but it doesn't change
> continuous bit. If only a 4K page change the permission, TLB
> conflict will happen.

As Ard said, set_memory_x() should return -EINVAL if it's used for
anything without a vm_area, so it should reject attempts to change the
linear map.

Is that not working correctly, or has thatcode been modified?

> Is there any other interface can change the permission?

It is unsafe to change the permissions of the linear map since this may
require splitting and/or merging of block entries (or regions where the
contiguous bit is set). This requires a Break-Before-Make approach,
which we cannot use while data mapped by those tables are in active use.

We take great pains at boot time [1] to avoid this, and we can't do
similarly at run time as it would involve parking all secondary CPUs in
idmap'd code.

Thanks,
Mark.

[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2016-January/401434.html

      parent reply	other threads:[~2017-02-14 18:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-13  8:04 Question about PTE_CONT in linux_4.10 Wangxuefeng (E)
2017-02-13  8:13 ` Ard Biesheuvel
2017-02-14 18:13 ` Mark Rutland [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=20170214181315.GM23718@leverpostej \
    --to=mark.rutland@arm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox