* Question about PTE_CONT in linux_4.10
@ 2017-02-13 8:04 Wangxuefeng (E)
2017-02-13 8:13 ` Ard Biesheuvel
2017-02-14 18:13 ` Mark Rutland
0 siblings, 2 replies; 3+ messages in thread
From: Wangxuefeng (E) @ 2017-02-13 8:04 UTC (permalink / raw)
To: linux-arm-kernel
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?
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. Is there any other interface can change the permission?
Thanks,
Xuefeng
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Question about PTE_CONT in linux_4.10
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
1 sibling, 0 replies; 3+ messages in thread
From: Ard Biesheuvel @ 2017-02-13 8:13 UTC (permalink / raw)
To: linux-arm-kernel
On 13 February 2017 at 08:04, Wangxuefeng (E) <wxf.wang@hisilicon.com> 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?
> 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. Is there any other interface can change the permission?
>
set_memory_x() can only be used on vmalloc/vmap regions, which don't
use PTE_CONT. Does set_memory_x() work for you on kmalloc allocations?
If so, that is a bug and we should fix it
^ permalink raw reply [flat|nested] 3+ messages in thread
* Question about PTE_CONT in linux_4.10
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
1 sibling, 0 replies; 3+ messages in thread
From: Mark Rutland @ 2017-02-14 18:13 UTC (permalink / raw)
To: linux-arm-kernel
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-02-14 18:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox