Skip to content

eBPF-based security platform

vendor: define __u128 in the vendored linux/types.h

Daniel Borkmannd11573831452
diff --git a/Documentation/contribute/code/developer-guide.rst b/Documentation/contribute/code/developer-guide.rst
index 20e8954a..c4cc6af6 100644
--- a/Documentation/contribute/code/developer-guide.rst
+++ b/Documentation/contribute/code/developer-guide.rst
@@ -294,8 +294,8 @@ a change needs a newer libbpf or UAPI:
:src:`tools/bpf-deps/bpf-deps.sh` makes a shallow clone of bpf-next.
The source revision is recorded in ``vendor/libbpf/COMMIT``. After
-refreshing, reapply the sole local change: set ``MAX_USED_PROGS`` in
-``vendor/libbpf/bpf/gen_loader.c`` to 64 for the kernel-obs package.
+refreshing, reapply the local changes :src:`vendor/libbpf/README.md`
+lists.
Other make targets
------------------
diff --git a/vendor/libbpf/README.md b/vendor/libbpf/README.md
index bc7dcbcf..55d46e4c 100644
--- a/vendor/libbpf/README.md
+++ b/vendor/libbpf/README.md
@@ -16,7 +16,7 @@ source commit in `COMMIT`, and rebuilds `libbpf.a` as a check.
|---|---|---|
| `bpf/*.c`, `bpf/*.h` | `tools/lib/bpf/` (verbatim, but see below) | `LGPL-2.1 OR BSD-2-Clause`; shirudo consumes the BSD branch |
| `bpf/bpf_helper_defs.h` | generated from `bpf.h` by `scripts/bpf_doc.py` | as libbpf |
-| `include/uapi/linux/*.h` | `tools/include/uapi/linux/` (verbatim) | `GPL-2.0 WITH Linux-syscall-note`, `netdev.h` also `OR BSD-3-Clause`: the syscall note permits user programs to include them |
+| `include/uapi/linux/*.h` | `tools/include/uapi/linux/` (verbatim, but see below) | `GPL-2.0 WITH Linux-syscall-note`, `netdev.h` also `OR BSD-3-Clause`: the syscall note permits user programs to include them |
| `include/linux/*.h`, `include/asm/*.h` | shirudo-owned shims replacing the kernel's `tools/include` internals | BSD-2-Clause |
| `Makefile`, `README.md` | shirudo-owned | BSD-2-Clause |
@@ -33,9 +33,13 @@ commit: `MAX_USED_PROGS` is 64 instead of 32, as required by the
kernel-obs package. In addition `gen_loader.c` also supports reusing a
signer-selected map FD supplied through the loader context.
`bpf/btf_dump.c` preserves complete native GNU attribute spellings without
-wrapping them twice. `bpf-deps`
-overwrites these files, so re-apply those changes after a refresh until
-they are upstream.
+wrapping them twice. `include/uapi/linux/types.h` defines `__s128` and
+`__u128` as the kernel's own `include/uapi/linux/types.h` does: it
+shadows the system's copy, and the arm64 `asm/sigcontext.h` of current
+kernel headers, which `<signal.h>` pulls in, uses `__u128`. In the
+kernel tree `tools/include/linux/types.h` defines them first, which the
+shims do not stand in for. `bpf-deps` overwrites these files, so
+re-apply those changes after a refresh until they are upstream.
`.github/scripts/check-spdx.sh` holds every vendored `.c` and `.h` to
the licences in this table, so a refresh that brings in a file under
diff --git a/vendor/libbpf/include/uapi/linux/types.h b/vendor/libbpf/include/uapi/linux/types.h
index 6acf2059..96996cfd 100644
--- a/vendor/libbpf/include/uapi/linux/types.h
+++ b/vendor/libbpf/include/uapi/linux/types.h
@@ -7,6 +7,11 @@
#ifndef __ASSEMBLER__
/* copied from linux:include/uapi/linux/types.h */
+#ifdef __SIZEOF_INT128__
+typedef __signed__ __int128 __s128 __attribute__((aligned(16)));
+typedef unsigned __int128 __u128 __attribute__((aligned(16)));
+#endif
+
#define __bitwise
typedef __u16 __bitwise __le16;
typedef __u16 __bitwise __be16;