lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 15 Jul 2020 14:43:10 -0700
From:   Hao Luo <>
Cc:     Shuah Khan <>, Alexei Starovoitov <>,
        Andrii Nakryiko <>,
        John Fastabend <>,
        Daniel Borkmann <>,
        Martin KaFai Lau <>,
        Song Liu <>, Yonghong Song <>,
        KP Singh <>,
        Stanislav Fomichev <>,
        Quentin Monnet <>,
        Hao Luo <>
Subject: [RFC PATCH bpf-next 0/2] BTF support for ksyms

This patch series extends the previously add __ksym externs with btf

Right now the __ksym externs are treated as pure 64-bit scalar value.
Libbpf replaces ld_imm64 insn of __ksym by its kernel address at load
time. This patch series extend those extern with their btf info. Note
that btf support for __ksym must come with the btf that has VARs encoded
to work properly. Therefore, these patches are tested against a btf
generated by a patched pahole, whose change will available in released
pahole soon.

There are a couple of design choices that I would like feedbacks from
bpf/btf experts.

 1. Because the newly added pseudo_btf_id needs to carry both a kernel
    address (64 bits) and a btf id (32 bits), I used the 'off' fields
    of ld_imm insn to carry btf id. I wonder if this breaks anything or
    if there is a better idea.
 2. Since only a subset of vars are going to be encoded into the new
    btf, if a ksym that doesn't find its btf id, it doesn't get
    converted into pseudo_btf_id. It is still treated as pure scalar
    value. But we require kernel btf to be loaded in libbpf if there is
    any ksym in the bpf prog.

This is RFC as it requires pahole changes that encode kernel vars into

Hao Luo (2):
  bpf: BTF support for __ksym externs
  selftests/bpf: Test __ksym externs with BTF

 include/uapi/linux/bpf.h                      | 37 ++++++++++----
 kernel/bpf/verifier.c                         | 26 ++++++++--
 tools/include/uapi/linux/bpf.h                | 37 ++++++++++----
 tools/lib/bpf/libbpf.c                        | 50 ++++++++++++++++++-
 .../testing/selftests/bpf/prog_tests/ksyms.c  |  2 +
 .../testing/selftests/bpf/progs/test_ksyms.c  | 14 ++++++
 6 files changed, 143 insertions(+), 23 deletions(-)


Powered by blists - more mailing lists