Thread (55 messages) 55 messages, 10 authors, 2023-07-20

Re: [PATCH 12/13] x86/jitalloc: prepare to allocate exectuatble memory as ROX

From: Kent Overstreet <kent.overstreet@linux.dev>
Date: 2023-06-01 18:38:19
Also in: bpf, linux-arm-kernel, linux-mips, linux-modules, linux-riscv, linux-s390, linux-trace-kernel, linuxppc-dev, lkml, loongarch, sparclinux

On Thu, Jun 01, 2023 at 06:13:44PM +0000, Edgecombe, Rick P wrote:
quoted
text_poke() _does_ create a separate RW mapping.
Sorry, I meant a separate RW allocation.
Ah yes, that makes sense

quoted
The thing that sucks about text_poke() is that it always does a full
TLB
flush, and AFAICT that's not remotely needed. What it really wants to
be
doing is conceptually just

kmap_local()
mempcy()
kunmap_loca()
flush_icache();

...except that kmap_local() won't actually create a new mapping on
non-highmem architectures, so text_poke() open codes it.
Text poke creates only a local CPU RW mapping. It's more secure because
other threads can't write to it.
*nod*, same as kmap_local
It also only needs to flush the local core when it's done since it's
not using a shared MM.
 
Ahh! Thanks for that; perhaps the comment in text_poke() about IPIs
could be a bit clearer.

What is it (if anything) you don't like about text_poke() then? It looks
like it's doing broadly similar things to kmap_local(), so should be
in the same ballpark from a performance POV?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help