-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Documentation fixups & additions (#274)
* cleanup a bunch of existing docs. * docs: more code cleanup & add tools details. * docs: add smth small on centos support. * docs: address review. * Update README.md Co-authored-by: Vladimir Kobal <vlad@prokk.net> Co-authored-by: thiagoftsm <thiagoftsm@gmail.com> Co-authored-by: Vladimir Kobal <vlad@prokk.net>
- Loading branch information
1 parent
8ec9a19
commit ea08cdf
Showing
12 changed files
with
205 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# CentOS | ||
|
||
Our eBPF programs are designed to support down to CentOS 7. | ||
|
||
Note that CentOS 7 uses Linux 3.10, and supports eBPF via backporting the code | ||
for it to their distribution's kernel fork. | ||
|
||
This introduces some complexities in dealing with the eBPF verifier, as it may | ||
behave very differently than on the latest kernels for some code, and reject | ||
it. | ||
|
||
For this reason it is strongly advised to create a VM for CentOS 7 and test | ||
whether the verifier will accept your programs on that platform. | ||
|
||
## Setting up CentOS 7 | ||
|
||
Setting up the environment inside the VM is nearly exactly the same as that | ||
used in the `Dockerfile.glibc.centos7`. | ||
|
||
When you run any compilation commands with `make`, you must ensure `make` uses | ||
the correct LLVM toolset as well. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Compiling | ||
|
||
## 1. Package Installs | ||
|
||
Before compiling this repository, you have to install necessary packages | ||
available on your Linux distribution. The complete list of packages can be | ||
found inside the Docker files in this repository. | ||
|
||
## 2. Linux Source Code Directory | ||
|
||
Also, if your distribution does not create the symlink `/usr/src/linux`, | ||
pointing to the latest Linux source code of your current live kernel, you | ||
should make one now. | ||
|
||
## 3. Disabling Inline Assembly | ||
|
||
In case you are trying to compile on a kernel newer than `5.0`, it will be | ||
necessary to disable the `assembly inline` option; this can be done by editing | ||
the file `/usr/src/linux/include/generated/autoconf.h` and commenting the line | ||
`//#define CONFIG_CC_HAS_ASM_INLINE 1`. | ||
|
||
## 4. Compile | ||
|
||
Now you can simply run `make`: | ||
|
||
```bash | ||
$ make -j`nproc` | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Kernel version and eBPF program | ||
|
||
In the first versions of the `bpf()` syscall, the Linux kernel verified whether | ||
the eBPF programs that had `kprobe` were matching the kernel version, but when | ||
the kernel `5.0` was released they removed this check with the argument that it | ||
was [useless](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/kernel/bpf/syscall.c?h=v5.0&id=6c4fc209fcf9d27efbaa48368773e4d2bfbd59aa): | ||
|
||
> bpf: remove useless version check for prog load | ||
> Existing libraries and tracing frameworks work around this kernel | ||
> version check by automatically deriving the kernel version from | ||
> uname(3) or similar such that the user does not need to do it | ||
> manually; these workarounds also make the version check useless | ||
> at the same time. | ||
> | ||
> Moreover, most other BPF tracing types enabling `bpf_probe_read()`-like | ||
> functionality have /not/ adapted this check, and in general these | ||
> days it is well understood anyway that all the tracing programs are | ||
> not stable with regards to future kernels as kernel internal data | ||
> structures are subject to change from release to release. | ||
> | ||
> Back at last netconf we discussed [0] and agreed to remove this | ||
> check from `bpf_prog_load()` and instead document it here in the uapi | ||
> header that there is no such guarantee for stable API for these | ||
> programs. | ||
> | ||
> [0] http://vger.kernel.org/netconf2018_files/DanielBorkmann_netconf2018.pdf | ||
At Netdata we therefore took the decision to always give the current kernel | ||
version of the kernel when any of our `kprobe`-based eBPF programs are loaded. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
# Patches | ||
# Kernel Patches | ||
|
||
For some Linux kernels that are not LTS and are used on distributions like Ubuntu, BPF programs cannot be compiled | ||
cleanly. It is necessary to apply some patches on these kernels in order to use them. | ||
For some Linux kernels that are not LTS and are used on distributions like | ||
Ubuntu, eBPF programs cannot be compiled cleanly. It is necessary to apply some | ||
patches on these kernels in order to use them. | ||
|
||
The structure of our Docker file forces us to have a directory for every kernel that we are compiling for. In case | ||
the kernel does not need a patch, it is necessary to create the directory and insert an empty `.gitclean` file. | ||
The structure of our Dockerfile forces us to have a directory for every kernel | ||
that we are compiling for, even if a patch is not needed. If you'd like to add | ||
a new kernel version, please make the directory here as well and insert an | ||
empty `.gitclean` file. |
Oops, something went wrong.