Message ID | 20170801112535.20765-4-bsingharora@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
> arch/powerpc/net/bpf: Basic EBPF support Perhaps: powerpc/bpf: Set JIT memory read-only On 2017/08/01 09:25PM, Balbir Singh wrote: > 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 > > 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 >
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)); 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); -}
Signed-off-by: Balbir Singh <bsingharora@gmail.com> --- arch/powerpc/net/bpf_jit_comp64.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-)