Skip to content

Commit ce06b1f

Browse files
committed
Merge branch 'bpf-next/master' into for-next
Signed-off-by: Andrii Nakryiko <[email protected]>
2 parents 323e146 + fdf1c72 commit ce06b1f

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

kernel/bpf/btf.c

+2-7
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,7 @@ const char *btf_str_by_offset(const struct btf *btf, u32 offset)
790790
return NULL;
791791
}
792792

793-
static bool __btf_name_valid(const struct btf *btf, u32 offset)
793+
static bool btf_name_valid_identifier(const struct btf *btf, u32 offset)
794794
{
795795
/* offset must be valid */
796796
const char *src = btf_str_by_offset(btf, offset);
@@ -811,11 +811,6 @@ static bool __btf_name_valid(const struct btf *btf, u32 offset)
811811
return !*src;
812812
}
813813

814-
static bool btf_name_valid_identifier(const struct btf *btf, u32 offset)
815-
{
816-
return __btf_name_valid(btf, offset);
817-
}
818-
819814
/* Allow any printable character in DATASEC names */
820815
static bool btf_name_valid_section(const struct btf *btf, u32 offset)
821816
{
@@ -4629,7 +4624,7 @@ static s32 btf_var_check_meta(struct btf_verifier_env *env,
46294624
}
46304625

46314626
if (!t->name_off ||
4632-
!__btf_name_valid(env->btf, t->name_off)) {
4627+
!btf_name_valid_identifier(env->btf, t->name_off)) {
46334628
btf_verifier_log_type(env, t, "Invalid name");
46344629
return -EINVAL;
46354630
}

samples/bpf/Makefile

+5-1
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,10 @@ BPF_EXTRA_CFLAGS += -I$(srctree)/arch/mips/include/asm/mach-generic
169169
endif
170170
endif
171171

172+
ifeq ($(ARCH), x86)
173+
BPF_EXTRA_CFLAGS += -fcf-protection
174+
endif
175+
172176
TPROGS_CFLAGS += -Wall -O2
173177
TPROGS_CFLAGS += -Wmissing-prototypes
174178
TPROGS_CFLAGS += -Wstrict-prototypes
@@ -405,7 +409,7 @@ $(obj)/%.o: $(src)/%.c
405409
-Wno-gnu-variable-sized-type-not-at-end \
406410
-Wno-address-of-packed-member -Wno-tautological-compare \
407411
-Wno-unknown-warning-option $(CLANG_ARCH_ARGS) \
408-
-fno-asynchronous-unwind-tables -fcf-protection \
412+
-fno-asynchronous-unwind-tables \
409413
-I$(srctree)/samples/bpf/ -include asm_goto_workaround.h \
410414
-O2 -emit-llvm -Xclang -disable-llvm-passes -c $< -o - | \
411415
$(OPT) -O2 -mtriple=bpf-pc-linux | $(LLVM_DIS) | \

tools/lib/bpf/elf.c

+3
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ int elf_open(const char *binary_path, struct elf_fd *elf_fd)
2828
int fd, ret;
2929
Elf *elf;
3030

31+
elf_fd->elf = NULL;
32+
elf_fd->fd = -1;
33+
3134
if (elf_version(EV_CURRENT) == EV_NONE) {
3235
pr_warn("elf: failed to init libelf for %s\n", binary_path);
3336
return -LIBBPF_ERRNO__LIBELF;

0 commit comments

Comments
 (0)