Re: [PATCH RFC bpf-next 2/4] bpf: support BPF ksym variables in kernel modules

2020-12-11 Thread Andrii Nakryiko
On Fri, Dec 11, 2020 at 5:52 PM Alexei Starovoitov wrote: > > On Fri, Dec 11, 2020 at 02:15:28PM -0800, Andrii Nakryiko wrote: > > On Fri, Dec 11, 2020 at 1:27 PM Alexei Starovoitov > > wrote: > > > > > > On Thu, Dec 10, 2020 at 08:27:32PM -0800, Andrii Nakryiko wrote: > > > > During BPF program

Re: [PATCH RFC bpf-next 2/4] bpf: support BPF ksym variables in kernel modules

2020-12-11 Thread Alexei Starovoitov
On Fri, Dec 11, 2020 at 02:15:28PM -0800, Andrii Nakryiko wrote: > On Fri, Dec 11, 2020 at 1:27 PM Alexei Starovoitov > wrote: > > > > On Thu, Dec 10, 2020 at 08:27:32PM -0800, Andrii Nakryiko wrote: > > > During BPF program load time, verifier will resolve FD to BTF object and > > > will > > > t

Re: [PATCH RFC bpf-next 2/4] bpf: support BPF ksym variables in kernel modules

2020-12-11 Thread Andrii Nakryiko
On Fri, Dec 11, 2020 at 1:27 PM Alexei Starovoitov wrote: > > On Thu, Dec 10, 2020 at 08:27:32PM -0800, Andrii Nakryiko wrote: > > During BPF program load time, verifier will resolve FD to BTF object and > > will > > take reference on BTF object itself and, for module BTFs, corresponding > > mod

Re: [PATCH RFC bpf-next 2/4] bpf: support BPF ksym variables in kernel modules

2020-12-11 Thread Alexei Starovoitov
On Thu, Dec 10, 2020 at 08:27:32PM -0800, Andrii Nakryiko wrote: > During BPF program load time, verifier will resolve FD to BTF object and will > take reference on BTF object itself and, for module BTFs, corresponding module > as well, to make sure it won't be unloaded from under running BPF progr

[PATCH RFC bpf-next 2/4] bpf: support BPF ksym variables in kernel modules

2020-12-10 Thread Andrii Nakryiko
Add support for directly accessing kernel module variables from BPF programs using special ldimm64 instructions. This functionality builds upon vmlinux ksym support, but extends ldimm64 with src_reg=BPF_PSEUDO_BTF_ID to allow specifying kernel module BTF's FD in insn[1].imm field. During BPF progr