linux-stable/arch
Martin KaFai Lau c454a46b5e bpf: Add bpf_line_info support
This patch adds bpf_line_info support.

It accepts an array of bpf_line_info objects during BPF_PROG_LOAD.
The "line_info", "line_info_cnt" and "line_info_rec_size" are added
to the "union bpf_attr".  The "line_info_rec_size" makes
bpf_line_info extensible in the future.

The new "check_btf_line()" ensures the userspace line_info is valid
for the kernel to use.

When the verifier is translating/patching the bpf_prog (through
"bpf_patch_insn_single()"), the line_infos' insn_off is also
adjusted by the newly added "bpf_adj_linfo()".

If the bpf_prog is jited, this patch also provides the jited addrs (in
aux->jited_linfo) for the corresponding line_info.insn_off.
"bpf_prog_fill_jited_linfo()" is added to fill the aux->jited_linfo.
It is currently called by the x86 jit.  Other jits can also use
"bpf_prog_fill_jited_linfo()" and it will be done in the followup patches.
In the future, if it deemed necessary, a particular jit could also provide
its own "bpf_prog_fill_jited_linfo()" implementation.

A few "*line_info*" fields are added to the bpf_prog_info such
that the user can get the xlated line_info back (i.e. the line_info
with its insn_off reflecting the translated prog).  The jited_line_info
is available if the prog is jited.  It is an array of __u64.
If the prog is not jited, jited_line_info_cnt is 0.

The verifier's verbose log with line_info will be done in
a follow up patch.

Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Acked-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2018-12-09 13:54:38 -08:00
..
alpha TTY/Serial fixes for 4.20-rc2 2018-11-10 13:32:14 -06:00
arc mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
arm Merge branch 'spectre' of git://git.armlinux.org.uk/~rmk/linux-arm 2018-11-18 10:45:09 -08:00
arm64 arm64/bpf: don't allocate BPF JIT programs in module memory 2018-12-05 16:36:28 +01:00
c6x c6x changes for 4.20 2018-10-31 15:39:25 -07:00
csky csky: dtb Kbuild fixup patches for linux-4.20-rc1 2018-11-01 09:04:30 -07:00
h8300 mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
hexagon mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
ia64 ia64: export node_distance function 2018-11-26 18:30:40 -08:00
m68k s390 updates for 4.20-rc2 2018-11-09 06:30:44 -06:00
microblaze s390 updates for 4.20-rc2 2018-11-09 06:30:44 -06:00
mips mips: bpf: implement jitting of BPF_ALU | BPF_ARSH | BPF_X 2018-12-07 13:30:48 -08:00
nds32 s390 updates for 4.20-rc2 2018-11-09 06:30:44 -06:00
nios2 mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
openrisc mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
parisc Merge branch 'parisc-4.20-3' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux 2018-11-14 13:42:41 -06:00
powerpc ppc: bpf: implement jitting of BPF_ALU | BPF_ARSH | BPF_* 2018-12-07 13:30:48 -08:00
riscv RISC-V: recognize S/U mode bits in print_isa 2018-11-20 05:19:28 -08:00
s390 s390: bpf: implement jitting of BPF_ALU | BPF_ARSH | BPF_* 2018-12-07 13:30:48 -08:00
sh mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
sparc Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2018-11-28 22:10:54 -08:00
um for-linus-20181109 2018-11-09 16:31:51 -06:00
unicore32 memblock: stop using implicit alignment to SMP_CACHE_BYTES 2018-10-31 08:54:16 -07:00
x86 bpf: Add bpf_line_info support 2018-12-09 13:54:38 -08:00
xtensa xtensa: fix coprocessor part of ptrace_{get,set}xregs 2018-11-26 18:37:51 -08:00
.gitignore
Kconfig New gcc plugin: stackleak 2018-11-01 11:46:27 -07:00