Thread (11 messages) flat view 11 messages, 4 authors, 2017-08-04

Re: [PATCH v1 3/3] arch/powerpc/net/bpf: Basic EBPF support

From: Naveen N. Rao <hidden>
Date: 2017-08-02 14:22:58

arch/powerpc/net/bpf: Basic EBPF support
Perhaps:
powerpc/bpf: Set JIT memory read-only

On 2017/08/01 09:25PM, Balbir Singh wrote:
quoted hunk ↗ jump to hunk
Signed-off-by: Balbir Singh <bsingharora@gmail.com>
---
 arch/powerpc/net/bpf_jit_comp64.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/arch/powerpc/net/bpf_jit_comp64.c b/arch/powerpc/net/bpf_jit_comp64.c
index 861c5af..d81110e 100644
--- a/arch/powerpc/net/bpf_jit_comp64.c
+++ b/arch/powerpc/net/bpf_jit_comp64.c
@@ -1054,6 +1054,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp)
 	fp->jited = 1;
 	fp->jited_len = alloclen;

+	bpf_jit_binary_lock_ro(bpf_hdr);
 	bpf_flush_icache(bpf_hdr, (u8 *)bpf_hdr + (bpf_hdr->pages * PAGE_SIZE));
Should we call bpf_flush_icache() _before_ locking the memory?

Thanks,
Naveen
quoted hunk ↗ jump to hunk
 out:
@@ -1064,15 +1065,3 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp)

 	return fp;
 }
-
-/* Overriding bpf_jit_free() as we don't set images read-only. */
-void bpf_jit_free(struct bpf_prog *fp)
-{
-	unsigned long addr = (unsigned long)fp->bpf_func & PAGE_MASK;
-	struct bpf_binary_header *bpf_hdr = (void *)addr;
-
-	if (fp->jited)
-		bpf_jit_binary_free(bpf_hdr);
-
-	bpf_prog_unlock_free(fp);
-}
-- 
2.9.4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help