Add new caps from kernel 5.8.
Test: Builds and boots on a bonito.
Change-Id: I8dff4818bb98be3d731256be100a1c4aed4d414c
diff --git a/init/capabilities.cpp b/init/capabilities.cpp
index a91cd1d..0b9f161 100644
--- a/init/capabilities.cpp
+++ b/init/capabilities.cpp
@@ -28,47 +28,55 @@
namespace init {
static const std::map<std::string, int> cap_map = {
- CAP_MAP_ENTRY(CHOWN),
- CAP_MAP_ENTRY(DAC_OVERRIDE),
- CAP_MAP_ENTRY(DAC_READ_SEARCH),
- CAP_MAP_ENTRY(FOWNER),
- CAP_MAP_ENTRY(FSETID),
- CAP_MAP_ENTRY(KILL),
- CAP_MAP_ENTRY(SETGID),
- CAP_MAP_ENTRY(SETUID),
- CAP_MAP_ENTRY(SETPCAP),
- CAP_MAP_ENTRY(LINUX_IMMUTABLE),
- CAP_MAP_ENTRY(NET_BIND_SERVICE),
- CAP_MAP_ENTRY(NET_BROADCAST),
- CAP_MAP_ENTRY(NET_ADMIN),
- CAP_MAP_ENTRY(NET_RAW),
- CAP_MAP_ENTRY(IPC_LOCK),
- CAP_MAP_ENTRY(IPC_OWNER),
- CAP_MAP_ENTRY(SYS_MODULE),
- CAP_MAP_ENTRY(SYS_RAWIO),
- CAP_MAP_ENTRY(SYS_CHROOT),
- CAP_MAP_ENTRY(SYS_PTRACE),
- CAP_MAP_ENTRY(SYS_PACCT),
- CAP_MAP_ENTRY(SYS_ADMIN),
- CAP_MAP_ENTRY(SYS_BOOT),
- CAP_MAP_ENTRY(SYS_NICE),
- CAP_MAP_ENTRY(SYS_RESOURCE),
- CAP_MAP_ENTRY(SYS_TIME),
- CAP_MAP_ENTRY(SYS_TTY_CONFIG),
- CAP_MAP_ENTRY(MKNOD),
- CAP_MAP_ENTRY(LEASE),
- CAP_MAP_ENTRY(AUDIT_WRITE),
- CAP_MAP_ENTRY(AUDIT_CONTROL),
- CAP_MAP_ENTRY(SETFCAP),
- CAP_MAP_ENTRY(MAC_OVERRIDE),
- CAP_MAP_ENTRY(MAC_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AP_ENTRY(WAKE_ALARM),
+ CAP_MAP_ENTRY(BLOCK_SUSPEND),
+ CAP_MAP_ENTRY(AUDIT_READ),
+#if defined(__BIONIC__)
+ CAP_MAP_ENTRY(PERFMON),
+ CAP_MAP_ENTRY(BPF),
+#endif
};
+#if defined(__BIONIC__)
+static_assert(CAP_LAST_CAP == CAP_BPF, "CAP_LAST_CAP is not CAP_BPF");
+#else
static_assert(CAP_LAST_CAP == CAP_AUDIT_READ, "CAP_LAST_CAP is not CAP_AUDIT_READ");
+#endif
static bool ComputeCapAmbientSupported() {
#if defined(__ANDROID__)