No description
Find a file
Andrii Nakryiko 7c819e7013 libbpf: Support stripping modifiers for btf_dump
One important use case when emitting const/volatile/restrict is undesirable is
BPF skeleton generation of DATASEC layout. These are further memory-mapped and
can be written/read from user-space directly.

For important case of .rodata variables, bpftool strips away first-level
modifiers, to make their use on user-space side simple and not requiring extra
type casts to override compiler complaining about writing to const variables.

This logic works mostly fine, but breaks in some more complicated cases. E.g.:

    const volatile int params[10];

Because in BTF it's a chain of ARRAY -> CONST -> VOLATILE -> INT, bpftool
stops at ARRAY and doesn't strip CONST and VOLATILE. In skeleton this variable
will be emitted as is. So when used from user-space, compiler will complain
about writing to const array. This is problematic, as also mentioned in [0].

To solve this for arrays and other non-trivial cases (e.g., inner
const/volatile fields inside the struct), teach btf_dump to strip away any
modifier, when requested. This is done as an extra option on
btf_dump__emit_type_decl() API.

Reported-by: Anton Protopopov <a.s.protopopov@gmail.com>
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200713232409.3062144-2-andriin@fb.com
2020-07-13 17:07:43 -07:00
arch Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2020-06-25 19:29:51 -07:00
block block-5.8-2020-06-19 2020-06-19 13:11:26 -07:00
certs
crypto crypto: drbg - always try to free Jitter RNG instance 2020-06-15 17:38:54 +10:00
Documentation bpf: Add info about .BTF_ids section to btf.rst 2020-07-13 10:42:03 -07:00
drivers mvpp2: fix pointer check 2020-07-07 13:03:21 -07:00
fs \n 2020-06-25 13:02:58 -07:00
include xsk: Add xdp statistics to xsk_diag 2020-07-13 15:32:56 -07:00
init Kbuild updates for v5.8 (2nd) 2020-06-13 13:29:16 -07:00
ipc mmap locking API: use coccinelle to convert mmap_sem rwsem call sites 2020-06-09 09:39:14 -07:00
kernel bpf: Use dedicated bpf_trace_printk event instead of trace_printk() 2020-07-13 16:55:49 -07:00
lib Kbuild fixes for v5.8 2020-06-21 12:44:52 -07:00
LICENSES
mm powerpc fixes for 5.8 #3 2020-06-21 10:02:53 -07:00
net xsk: Add xdp statistics to xsk_diag 2020-07-13 15:32:56 -07:00
samples samples: bpf: Add an option for printing extra statistics in xdpsock 2020-07-13 15:32:56 -07:00
scripts bpf: Resolve BTF IDs in vmlinux image 2020-07-13 10:42:02 -07:00
security selinux/stable-5.8 PR 20200621 2020-06-21 15:41:24 -07:00
sound sound fixes for 5.8-rc3 2020-06-25 09:15:24 -07:00
tools libbpf: Support stripping modifiers for btf_dump 2020-07-13 17:07:43 -07:00
usr
virt MIPS: 2020-06-12 11:05:52 -07:00
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore modpost: generate vmlinux.symvers and reuse it for the second modpost 2020-06-06 23:38:12 +09:00
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS docs: networking: move remaining Ethernet driver docs to the hw section 2020-06-26 16:08:45 -07:00
Makefile bpf: Resolve BTF IDs in vmlinux image 2020-07-13 10:42:02 -07:00
README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.