1
0
mirror of https://github.com/yurisieucuti/treble_evolution.git synced 2024-11-14 09:07:01 +00:00
treble_evolution/patches/platform_system_bpf/0004-Fix-bpf-boot-issue-for-kernel-4.19-2.patch
2024-04-24 15:13:17 +00:00

45 lines
2.2 KiB
Diff

From 251fd99e6458644f258dff7eb2450a3dc74b78c5 Mon Sep 17 00:00:00 2001
From: danielzhang130 <37479705+danielzhang130@users.noreply.github.com>
Date: Mon, 25 Mar 2024 03:57:56 -0400
Subject: [PATCH 4/4] Fix bpf boot issue for kernel < 4.19 (#2)
Cherry-picked commit 22836357eca318f1721628038f67e1735560d039 from packages_modules_Connectivity
Change-Id: I36a8eb859775325b1568515e776a58e421da3976
---
bpfloader/BpfLoader.cpp | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/bpfloader/BpfLoader.cpp b/bpfloader/BpfLoader.cpp
index 036a9b9..7b18055 100644
--- a/bpfloader/BpfLoader.cpp
+++ b/bpfloader/BpfLoader.cpp
@@ -183,8 +183,7 @@ int main(int argc, char** argv) {
// Linux 5.16-rc1 changed the default to 2 (disabled but changeable), but we need 0 (enabled)
// (this writeFile is known to fail on at least 4.19, but always defaults to 0 on pre-5.13,
// on 5.13+ it depends on CONFIG_BPF_UNPRIV_DEFAULT_OFF)
- if (writeProcSysFile("/proc/sys/kernel/unprivileged_bpf_disabled", "0\n") &&
- android::bpf::isAtLeastKernelVersion(5, 13, 0)) return 1;
+ writeProcSysFile("/proc/sys/kernel/unprivileged_bpf_disabled", "0\n");
// Enable the eBPF JIT -- but do note that on 64-bit kernels it is likely
// already force enabled by the kernel config option BPF_JIT_ALWAYS_ON.
@@ -192,12 +191,12 @@ int main(int argc, char** argv) {
// kernel does not have CONFIG_BPF_JIT=y)
// BPF_JIT is required by R VINTF (which means 4.14/4.19/5.4 kernels),
// but 4.14/4.19 were released with P & Q, and only 5.4 is new in R+.
- if (writeProcSysFile("/proc/sys/net/core/bpf_jit_enable", "1\n")) return 1;
+ writeProcSysFile("/proc/sys/net/core/bpf_jit_enable", "1\n");
// Enable JIT kallsyms export for privileged users only
// (Note: this (open) will fail with ENOENT 'No such file or directory' if
// kernel does not have CONFIG_HAVE_EBPF_JIT=y)
- if (writeProcSysFile("/proc/sys/net/core/bpf_jit_kallsyms", "1\n")) return 1;
+ writeProcSysFile("/proc/sys/net/core/bpf_jit_kallsyms", "1\n");
// Create all the pin subdirectories
// (this must be done first to allow selinux_context and pin_subdir functionality,
--
2.25.1