vendorBpfLoader: move /sys/fs/bpf/vendor creation to rust
We continue to have: $ adbz shell ls -lZ /sys/fs/bpf /sys/fs/bpf/vendor /sys/fs/bpf: total 0 ... drwxrwxrwt 2 root root u:object_r:fs_bpf_vendor:s0 0 2025-07-16 00:09 vendor /sys/fs/bpf/vendor: total 0 -r--r----- 1 root system u:object_r:fs_bpf_vendor:s0 0 2025-07-16 00:09 prog_filterPowerSupplyEvents_skfilter_power_supply Test: TreeHugger Flag: EXEMPT no-op Signed-off-by: Maciej Żenczykowski <maze@google.com> Change-Id: I74d87a6f382e3b1bc10a8eb82915bc340568f2a8
This commit is contained in:
parent
c30b4f8bee
commit
d29bd0b4ca
2 changed files with 4 additions and 17 deletions
|
|
@ -850,21 +850,6 @@ int loadAllElfObjects() {
|
|||
return retVal;
|
||||
}
|
||||
|
||||
int createSysFsBpfVendor() {
|
||||
mode_t prevUmask = umask(0);
|
||||
|
||||
errno = 0;
|
||||
int ret = mkdir("/sys/fs/bpf/vendor", S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO);
|
||||
if (ret && errno != EEXIST) {
|
||||
const int err = errno;
|
||||
ALOGE("Failed to create directory: /sys/fs/bpf/vendor, ret: %s", strerror(err));
|
||||
return -err;
|
||||
}
|
||||
|
||||
umask(prevUmask);
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace bpf
|
||||
} // namespace android
|
||||
|
||||
|
|
@ -877,8 +862,6 @@ void vendorBpfLoader() {
|
|||
const char* argv[] = {"/system/bin/bpfloader", NULL};
|
||||
android::base::InitLogging(const_cast<char**>(argv), &android::base::KernelLogger);
|
||||
|
||||
if (android::bpf::createSysFsBpfVendor()) exit(120);
|
||||
|
||||
// Load all ELF objects, create programs and maps, and pin them
|
||||
if (android::bpf::loadAllElfObjects()) {
|
||||
ALOGE("=== CRITICAL FAILURE LOADING BPF PROGRAMS FROM /vendor/etc/bpf ===");
|
||||
|
|
|
|||
|
|
@ -644,6 +644,10 @@ fn main() {
|
|||
load_libbpf_progs();
|
||||
info!("Loading legacy BPF progs");
|
||||
|
||||
if let Err(e) = create_dir(Path::new("/sys/fs/bpf/vendor")) {
|
||||
panic!("Error during mkdir /sys/fs/bpf/vendor: {e}");
|
||||
};
|
||||
|
||||
// SAFETY: Linking in the existing legacy vendor bpfloader functionality.
|
||||
// The following bindgen function can abort() or exit() on failure,
|
||||
// but will usually execve().
|
||||
|
|
|
|||
Loading…
Reference in a new issue