From debd9eaffa3d773e604197883440197998e415d0 Mon Sep 17 00:00:00 2001 From: Lorenzo Colitti Date: Thu, 27 Jan 2022 23:02:59 +0900 Subject: [PATCH] Don't enable DscpPolicyTracker on pre-T devices. The code cannot work before T because before T the tethering module can only load BPF programs/maps into /sys/fs/tethering/bpf and the system server cannot access that directory. Additionally, this is causing unit tests to fail on pre-T devices because on those devices the seccomp filter blocks the bpf syscall from apps (including Java tests). Test: revert aosp/1907693 and atest FrameworksNetTests:ConnectivityServiceTest Change-Id: I6c398031dffb840da1d723b11ea4d0845ad6c6f2 --- service/src/com/android/server/ConnectivityService.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/service/src/com/android/server/ConnectivityService.java b/service/src/com/android/server/ConnectivityService.java index d2c0e18395..fa7dfa9846 100644 --- a/service/src/com/android/server/ConnectivityService.java +++ b/service/src/com/android/server/ConnectivityService.java @@ -1495,7 +1495,14 @@ public class ConnectivityService extends IConnectivityManager.Stub mLingerDelayMs, mQosCallbackTracker, mDeps); try { - mDscpPolicyTracker = new DscpPolicyTracker(); + // DscpPolicyTracker cannot run on S because on S the tethering module can only load + // BPF programs/maps into /sys/fs/tethering/bpf, which the system server cannot access. + // Even if it could, running on S would at least require mocking out the BPF map, + // otherwise the unit tests will fail on pre-T devices where the seccomp filter blocks + // the bpf syscall. http://aosp/1907693 + if (SdkLevel.isAtLeastT()) { + mDscpPolicyTracker = new DscpPolicyTracker(); + } } catch (ErrnoException e) { loge("Unable to create DscpPolicyTracker"); }