summaryrefslogtreecommitdiff
path: root/progs
diff options
context:
space:
mode:
authorMaciej Żenczykowski <maze@google.com>2020-06-10 15:49:31 -0700
committerMaciej Żenczykowski <maze@google.com>2020-06-15 06:34:51 +0000
commit4ba8c1c1ac50bcdf74526dc7a26e7f9bfd8144aa (patch)
tree643774d1159e422a00838d328048ae73614ca670 /progs
parent567dc56b5783073d8721f13acebb3d4bab11aa72 (diff)
downloadbpf-4ba8c1c1ac50bcdf74526dc7a26e7f9bfd8144aa.tar.gz
allow tagging a bpf .o as critical
This does not yet do anything with this information besides logging it. Test: builds $ adb logcat -s -d LibBpfLoader:D | egrep Loading 06-14 22:52:48.657 430 430 D LibBpfLoader: Loading critical for netd ELF object /system/etc/bpf/offload.o with license Apache 2.0 06-14 22:52:48.682 430 430 D LibBpfLoader: Loading optional ELF object /system/etc/bpf/time_in_state.o with license GPL 06-14 22:52:48.729 430 430 D LibBpfLoader: Loading critical for netd ELF object /system/etc/bpf/clatd.o with license Apache 2.0 06-14 22:52:48.767 430 430 D LibBpfLoader: Loading critical for netd ELF object /system/etc/bpf/netd.o with license Apache 2.0 06-14 22:53:26.052 2605 2605 D LibBpfLoader: Loading optional ELF object /data/local/tmp/32/kern.o with license Apache 2.0 06-14 22:54:26.070 2605 2605 D LibBpfLoader: Loading optional ELF object /data/local/tmp/32/kern.o with license Apache 2.0 Bug: 150040815 Signed-off-by: Maciej Żenczykowski <maze@google.com> Change-Id: Ie07549528800d6d7c5ff7f12b859702113d7194e
Diffstat (limited to 'progs')
-rw-r--r--progs/include/bpf_helpers.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/progs/include/bpf_helpers.h b/progs/include/bpf_helpers.h
index 8ff155f..f76b382 100644
--- a/progs/include/bpf_helpers.h
+++ b/progs/include/bpf_helpers.h
@@ -12,6 +12,12 @@
/* Example use: LICENSE("GPL"); or LICENSE("Apache 2.0"); */
#define LICENSE(NAME) char _license[] SEC("license") = (NAME)
+/* flag the resulting bpf .o file as critical to system functionality,
+ * loading all kernel version appropriate programs in it must succeed
+ * for bpfloader success
+ */
+#define CRITICAL(REASON) char _critical[] SEC("critical") = (REASON)
+
/*
* Helper functions called from eBPF programs written in C. These are
* implemented in the kernel sources.