Thread (7 messages) 7 messages, 3 authors, 2016-01-28

[PATCH] arm64: allow vmalloc regions to be set with set_memory_*

flat view
STALE3908d

From: Ard Biesheuvel <hidden>
Date: 2016-01-28 16:43:41

On 28 January 2016 at 16:08, Will Deacon [off-list ref] wrote:
On Mon, Jan 18, 2016 at 03:01:05PM +0100, Ard Biesheuvel wrote:
quoted
The range of set_memory_* is currently restricted to the module address
range because of difficulties in breaking down larger block sizes.
vmalloc maps PAGE_SIZE pages so it is safe to use as well. Update the
function ranges and add a comment explaining why the range is restricted
the way it is.

Suggested-by: Laura Abbott <redacted>
Signed-off-by: Ard Biesheuvel <redacted>
---
 arch/arm64/mm/pageattr.c | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)
What's the user for this? It would be better to apply along with something
that actually needs to change permission for arbitrary vmalloc mappings.
BPF already uses set_memory_ro() but doesn't bother to check the return value.

Without the patch, I get:

root at ubuntu-arm64:~# grep bpf /proc/vmallocinfo
0xffff000000014000-0xffff000000016000    8192 bpf_prog_alloc+0x3c/0xb8
pages=1 vmalloc
0xffff00000017a000-0xffff00000017c000    8192 bpf_prog_alloc+0x3c/0xb8
pages=1 vmalloc
root at ubuntu-arm64:~# grep -E 0xffff000000014000\|0xffff00000017a000
/sys/kernel/debug/kernel_page_tables
0xffff000000014000-0xffff000000015000           4K     RW NX SHD AF
        UXN MEM/NORMAL
0xffff00000017a000-0xffff00000017b000           4K     RW NX SHD AF
        UXN MEM/NORMAL

and with:

root at ubuntu-arm64:~# grep bpf /proc/vmallocinfo
0xffff000000014000-0xffff000000016000    8192 bpf_prog_alloc+0x3c/0xb8
pages=1 vmalloc
0xffff00000017a000-0xffff00000017c000    8192 bpf_prog_alloc+0x3c/0xb8
pages=1 vmalloc
root at ubuntu-arm64:~# grep -E 0xffff000000014000\|0xffff00000017a000
/sys/kernel/debug/kernel_page_tables
0xffff000000014000-0xffff000000015000           4K     ro NX SHD AF
        UXN MEM/NORMAL
0xffff00000017a000-0xffff00000017b000           4K     ro NX SHD AF
        UXN MEM/NORMAL

Anyway, with that (and a rebase to -rc2):

Acked-by: Will Deacon <redacted>
Thanks
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help