Linux 6.6.38
Greg Kroah-Hartman
maintainerI'm announcing the release of the 6.6.38 kernel.
All powerpc and arm64 users of the 6.6 kernel series must upgrade. Everyone else probably should as well to be safe.
The updated 6.6.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-6.6.y
and can be browsed at the normal kernel.org git web browser:
https://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary
thanks,
greg k-h
------------
Makefile | 2 arch/arm/net/bpf_jit_32.c | 25 ++++---- arch/loongarch/net/bpf_jit.c | 22 ++----- arch/mips/net/bpf_jit_comp.c | 3 - arch/parisc/net/bpf_jit_core.c | 8 -- arch/powerpc/net/bpf_jit.h | 18 ++++-- arch/powerpc/net/bpf_jit_comp.c | 110 ++++++++++---------------------------- arch/powerpc/net/bpf_jit_comp32.c | 13 ++-- arch/powerpc/net/bpf_jit_comp64.c | 10 +-- arch/s390/net/bpf_jit_comp.c | 6 -- arch/sparc/net/bpf_jit_comp_64.c | 6 -- arch/x86/net/bpf_jit_comp32.c | 3 - include/linux/filter.h | 10 +-- kernel/bpf/core.c | 4 - kernel/bpf/verifier.c | 8 -- 15 files changed, 86 insertions(+), 162 deletions(-)
Greg Kroah-Hartman (5):
Revert "bpf: Take return from set_memory_rox() into account with bpf_jit_binary_lock_ro()" Revert "powerpc/bpf: use bpf_jit_binary_pack_[alloc|finalize|free]"
Revert "powerpc/bpf: rename powerpc64_jit_data to powerpc_jit_data"
Revert "bpf: Take return from set_memory_ro() into account with bpf_prog_lock_ro()" Linux 6.6.38
Greg Kroah-Hartman
maintainerMakefile +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 VERSION = 6 PATCHLEVEL = 6 -SUBLEVEL = 37 +SUBLEVEL = 38 EXTRAVERSION = NAME = Hurr durr I'ma ninja sloth
arch/arm/net/bpf_jit_32.c +13 -12
@@ -1982,21 +1982,28 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)/* If building the body of the JITed code fails somehow, * we fall back to the interpretation. */ -if (build_body (&ctx) <0 ) - goto out_free; +if (build_body (&ctx) <0 ) { + image_ptr =NULL ; +bpf_jit_binary_free (header); + prog = orig_prog; + goto out_imms; + }build_epilogue (&ctx);/* 3.) Extra pass to validate JITed Code */ -if (validate_code (&ctx)) - goto out_free; +if (validate_code (&ctx)) { + image_ptr =NULL ; +bpf_jit_binary_free (header); + prog = orig_prog; + goto out_imms; + }flush_icache_range ((u32 )header, (u32)(ctx.target + ctx.idx));if (bpf_jit_enable >1 )/* there are 2 passes here */ bpf_jit_dump (prog->len, image_size,2 , ctx.target); -if (bpf_jit_binary_lock_ro (header)) - goto out_free; +bpf_jit_binary_lock_ro (header); prog->bpf_func = (void *)ctx.target; prog->jited =1 ; prog->jited_len = image_size;
@@ -2013,11 +2020,5 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)bpf_jit_prog_release_other (prog, prog == orig_prog ? tmp : orig_prog);return prog; - -out_free: - image_ptr =NULL ; -bpf_jit_binary_free (header); - prog = orig_prog; - goto out_imms; }
arch/loongarch/net/bpf_jit.c +6 -16
@@ -1206,19 +1206,16 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)flush_icache_range ((unsigned long )header, (unsigned long )(ctx.image + ctx.idx));if (!prog->is_func || extra_pass) { -int err; -if (extra_pass && ctx.idx != jit_data->ctx.idx) {pr_err_once ("multi-func JIT bug %d != %d\n" , ctx.idx, jit_data->ctx.idx); - goto out_free; - } - err =bpf_jit_binary_lock_ro (header); -if (err) { -pr_err_once ("bpf_jit_binary_lock_ro() returned %d\n" , - err); - goto out_free; +bpf_jit_binary_free (header); + prog->bpf_func =NULL ; + prog->jited =0 ; + prog->jited_len =0 ; + goto out_offset; } +bpf_jit_binary_lock_ro (header); }else { jit_data->ctx = ctx; jit_data->image = image_ptr;
@@ -1249,13 +1246,6 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog) out_offset =-1 ;return prog; - -out_free: -bpf_jit_binary_free (header); - prog->bpf_func =NULL ; - prog->jited =0 ; - prog->jited_len =0 ; - goto out_offset; }/* Indicate the JIT backend supports mixing bpf2bpf and tailcalls. */
arch/mips/net/bpf_jit_comp.c +1 -2
@@ -1012,8 +1012,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)bpf_prog_fill_jited_linfo (prog, &ctx.descriptors[1 ]);/* Set as read-only exec and flush instruction cache */ -if (bpf_jit_binary_lock_ro (header)) - goto out_err; +bpf_jit_binary_lock_ro (header);flush_icache_range ((unsigned long )header, (unsigned long )&ctx.target[ctx.jit_index]);
arch/parisc/net/bpf_jit_core.c +1 -7
@@ -167,13 +167,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)bpf_flush_icache (jit_data->header, ctx->insns + ctx->ninsns);if (!prog->is_func || extra_pass) { -if (bpf_jit_binary_lock_ro (jit_data->header)) { -bpf_jit_binary_free (jit_data->header); - prog->bpf_func =NULL ; - prog->jited =0 ; - prog->jited_len =0 ; - goto out_offset; - } +bpf_jit_binary_lock_ro (jit_data->header); prologue_len = ctx->epilogue_offset - ctx->body_len;for (i =0 ; i < prog->len; i++) ctx->offset[i] += prologue_len;
arch/powerpc/net/bpf_jit.h +13 -5
@@ -36,6 +36,9 @@EMIT (PPC_RAW_BRANCH (offset)); \ }while (0 ) +/* bl (unconditional 'branch' with link) */ +#define PPC_BL (dest) EMIT(PPC_RAW_BL((dest) - (unsigned long)(image + ctx->idx))) +/* "cond" here covers BO:BI fields. */ #define PPC_BCC_SHORT (cond, dest) \ do { \
@@ -144,6 +147,12 @@ struct codegen_context {#define BPF_FIXUP_LEN 2/* Two instructions => 8 bytes */ #endif +static inline void bpf_flush_icache (void *start,void *end) +{ +smp_wmb ();/* smp write barrier */ +flush_icache_range ((unsigned long )start, (unsigned long )end); +} +static inline bool bpf_is_seen_register (struct codegen_context *ctx,int i) {return ctx->seen & (1 << (31 - i));
@@ -160,17 +169,16 @@ static inline void bpf_clear_seen_register(struct codegen_context *ctx, int i) }void bpf_jit_init_reg_mapping (struct codegen_context *ctx); -int bpf_jit_emit_func_call_rel (u32 *image,u32 *fimage,struct codegen_context *ctx,u64 func); -int bpf_jit_build_body (struct bpf_prog *fp,u32 *image,u32 *fimage,struct codegen_context *ctx, +int bpf_jit_emit_func_call_rel (u32 *image,struct codegen_context *ctx,u64 func); +int bpf_jit_build_body (struct bpf_prog *fp,u32 *image,struct codegen_context *ctx,u32 *addrs,int pass,bool extra_pass);void bpf_jit_build_prologue (u32 *image,struct codegen_context *ctx);void bpf_jit_build_epilogue (u32 *image,struct codegen_context *ctx);void bpf_jit_realloc_regs (struct codegen_context *ctx);int bpf_jit_emit_exit_insn (u32 *image,struct codegen_context *ctx,int tmp_reg,long exit_addr); -int bpf_add_extable_entry (struct bpf_prog *fp,u32 *image,u32 *fimage,int pass, -struct codegen_context *ctx,int insn_idx, -int jmp_off,int dst_reg); +int bpf_add_extable_entry (struct bpf_prog *fp,u32 *image,int pass,struct codegen_context *ctx, +int insn_idx,int jmp_off,int dst_reg);#endif
arch/powerpc/net/bpf_jit_comp.c +29 -81
218 lines not on this page · raw message
arch/powerpc/net/bpf_jit_comp32.c +6 -7
@@ -200,13 +200,12 @@ void bpf_jit_build_epilogue(u32 *image, struct codegen_context *ctx)EMIT (PPC_RAW_BLR ()); } -/* Relative offset needs to be calculated based on final image location */ -int bpf_jit_emit_func_call_rel (u32 *image,u32 *fimage,struct codegen_context *ctx,u64 func) +int bpf_jit_emit_func_call_rel (u32 *image,struct codegen_context *ctx,u64 func) { -s32 rel = (s32 )func - (s32)(fimage + ctx->idx); +s32 rel = (s32 )func - (s32)(image + ctx->idx);if (image && rel <0x2000000 && rel >=-0x2000000 ) { -EMIT (PPC_RAW_BL (rel)); +PPC_BL (func); }else {/* Load function address into r0 */ EMIT (PPC_RAW_LIS (_R0,IMM_H (func)));
@@ -279,7 +278,7 @@ static int bpf_jit_emit_tail_call(u32 *image, struct codegen_context *ctx, u32 o }/* Assemble the body code between the prologue & epilogue */ -int bpf_jit_build_body (struct bpf_prog *fp,u32 *image,u32 *fimage,struct codegen_context *ctx, +int bpf_jit_build_body (struct bpf_prog *fp,u32 *image,struct codegen_context *ctx,u32 *addrs,int pass,bool extra_pass) {const struct bpf_insn *insn = fp->insnsi;
@@ -1010,7 +1009,7 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, u32 *fimage, struct code jmp_off +=4 ; } - ret =bpf_add_extable_entry (fp, image, fimage, pass, ctx, insn_idx, + ret =bpf_add_extable_entry (fp, image, pass, ctx, insn_idx, jmp_off, dst_reg);if (ret)return ret;
@@ -1066,7 +1065,7 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, u32 *fimage, struct codeEMIT (PPC_RAW_STW (bpf_to_ppc (BPF_REG_5 ), _R1,12 )); } - ret =bpf_jit_emit_func_call_rel (image, fimage, ctx, func_addr); + ret =bpf_jit_emit_func_call_rel (image, ctx, func_addr);if (ret)return ret;
arch/powerpc/net/bpf_jit_comp64.c +5 -5
@@ -240,7 +240,7 @@ static int bpf_jit_emit_func_call_hlp(u32 *image, struct codegen_context *ctx, ureturn 0 ; } -int bpf_jit_emit_func_call_rel (u32 *image,u32 *fimage,struct codegen_context *ctx,u64 func) +int bpf_jit_emit_func_call_rel (u32 *image,struct codegen_context *ctx,u64 func) {unsigned int i, ctx_idx = ctx->idx;
@@ -361,7 +361,7 @@ asm ( );/* Assemble the body code between the prologue & epilogue */ -int bpf_jit_build_body (struct bpf_prog *fp,u32 *image,u32 *fimage,struct codegen_context *ctx, +int bpf_jit_build_body (struct bpf_prog *fp,u32 *image,struct codegen_context *ctx,u32 *addrs,int pass,bool extra_pass) {enum stf_barrier_type stf_barrier =stf_barrier_type_get ();
@@ -952,8 +952,8 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, u32 *fimage, struct code addrs[++i] = ctx->idx *4 ;if (BPF_MODE (code) ==BPF_PROBE_MEM ) { - ret =bpf_add_extable_entry (fp, image, fimage, pass, ctx, - ctx->idx -1 ,4 , dst_reg); + ret =bpf_add_extable_entry (fp, image, pass, ctx, ctx->idx -1 , +4 , dst_reg);if (ret)return ret; }
@@ -1007,7 +1007,7 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, u32 *fimage, struct codeif (func_addr_fixed) ret =bpf_jit_emit_func_call_hlp (image, ctx, func_addr);else - ret =bpf_jit_emit_func_call_rel (image, fimage, ctx, func_addr); + ret =bpf_jit_emit_func_call_rel (image, ctx, func_addr);if (ret)return ret;
arch/s390/net/bpf_jit_comp.c +1 -5
@@ -1973,11 +1973,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp)print_fn_code (jit.prg_buf, jit.size_prg); }if (!fp->is_func || extra_pass) { -if (bpf_jit_binary_lock_ro (header)) { -bpf_jit_binary_free (header); - fp = orig_fp; - goto free_addrs; - } +bpf_jit_binary_lock_ro (header); }else { jit_data->header = header; jit_data->ctx = jit;
arch/sparc/net/bpf_jit_comp_64.c +1 -5
@@ -1602,11 +1602,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)bpf_flush_icache (header, (u8 *)header + header->size);if (!prog->is_func || extra_pass) { -if (bpf_jit_binary_lock_ro (header)) { -bpf_jit_binary_free (header); - prog = orig_prog; - goto out_off; - } +bpf_jit_binary_lock_ro (header); }else { jit_data->ctx = ctx; jit_data->image = image_ptr;
arch/x86/net/bpf_jit_comp32.c +2 -1
@@ -2600,7 +2600,8 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)if (bpf_jit_enable >1 )bpf_jit_dump (prog->len, proglen, pass +1 , image); -if (image && !bpf_jit_binary_lock_ro (header)) { +if (image) { +bpf_jit_binary_lock_ro (header); prog->bpf_func = (void *)image; prog->jited =1 ; prog->jited_len = proglen;
include/linux/filter.h +4 -6
@@ -842,22 +842,20 @@ bpf_ctx_narrow_access_offset(u32 off, u32 size, u32 size_default)#define bpf_classic_proglen (fprog) (fprog->len * sizeof(fprog->filter[0])) -static inline int __must_check bpf_prog_lock_ro (struct bpf_prog *fp) +static inline void bpf_prog_lock_ro (struct bpf_prog *fp) {#ifndef CONFIG_BPF_JIT_ALWAYS_ON if (!fp->jited) {set_vm_flush_reset_perms (fp); -return set_memory_ro ((unsigned long )fp, fp->pages); +set_memory_ro ((unsigned long )fp, fp->pages); }#endif -return 0 ; } -static inline int __must_check -bpf_jit_binary_lock_ro (struct bpf_binary_header *hdr) +static inline void bpf_jit_binary_lock_ro (struct bpf_binary_header *hdr) {set_vm_flush_reset_perms (hdr); -return set_memory_rox ((unsigned long )hdr, hdr->size >>PAGE_SHIFT ); +set_memory_rox ((unsigned long )hdr, hdr->size >>PAGE_SHIFT ); }int sk_filter_trim_cap (struct sock *sk,struct sk_buff *skb,unsigned int cap);
kernel/bpf/core.c +1 -3
@@ -2375,9 +2375,7 @@ struct bpf_prog *bpf_prog_select_runtime(struct bpf_prog *fp, int *err) } finalize: - *err =bpf_prog_lock_ro (fp); -if (*err) -return fp; +bpf_prog_lock_ro (fp);/* The tail call compatibility check can only be done at * this late stage as we need to determine, if we deal
kernel/bpf/verifier.c +2 -6
@@ -18625,13 +18625,9 @@ static int jit_subprogs(struct bpf_verifier_env *env)* bpf_prog_load will add the kallsyms for the main program. */ for (i =1 ; i < env->subprog_cnt; i++) { - err =bpf_prog_lock_ro (func[i]); -if (err) - goto out_free; - } - -for (i =1 ; i < env->subprog_cnt; i++) +bpf_prog_lock_ro (func[i]);bpf_prog_kallsyms_add (func[i]); + }/* Last step: make now unused interpreter insns from main * prog consistent for later dump requests, so they can