From 72df65b28de7cce69b1d606c4d2ebe588b83c69a Mon Sep 17 00:00:00 2001 From: Patrick Rohr Date: Mon, 8 Jul 2024 13:43:48 -0700 Subject: [PATCH] Do not test Log.wtf reporting pipeline on V+ On U QPR3+, networking bpf programs are already loaded by netbpfload, so there is no point in checking the netbpfload result. The system will likely abort if anything was not loaded correctly. Checking the netbpfload result is only really relevant on devices before V that receive netbpfload via mainline update. In addition, removing the Log.wtf from V+ devices prevents Android Go devices that use non-updatable modules from reporting wtf logs for a very long time. Test: TH Bug: 351118770 (cherry picked from https://android-review.googlesource.com/q/commit:1c351b2c4aed13b6169cbb107f7a1488637dbdd5) Merged-In: I8a412cb25374f3637f2fbd89617baa58d41d8589 Change-Id: I8a412cb25374f3637f2fbd89617baa58d41d8589 --- .../android/server/ConnectivityService.java | 52 ++++++++++--------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/service/src/com/android/server/ConnectivityService.java b/service/src/com/android/server/ConnectivityService.java index be1d3c7c7c..51862033e4 100755 --- a/service/src/com/android/server/ConnectivityService.java +++ b/service/src/com/android/server/ConnectivityService.java @@ -1847,31 +1847,33 @@ public class ConnectivityService extends IConnectivityManager.Stub mHandler = new InternalHandler(mHandlerThread.getLooper()); // Temporary hack to report netbpfload result. // TODO: remove in 2024-09 when netbpfload starts loading mainline bpf programs. - mHandler.postDelayed(() -> { - // Test Pitot pipeline, ignore this Log.wtf if it shows up in the logs. - final Random r = new Random(); - if (Build.TYPE.equals("user") && r.nextInt(1000) == 0) { - Log.wtf(TAG, "NOT A FAILURE, PLEASE IGNORE! Test Pitot pipeline works correctly"); - } - // Did netbpfload create the map? - try { - Os.access("/sys/fs/bpf/net_shared/map_gentle_test", F_OK); - } catch (ErrnoException e) { - Log.wtf(TAG, "netbpfload did not create map", e); - } - // Did netbpfload create the program? - try { - Os.access("/sys/fs/bpf/net_shared/prog_gentle_skfilter_accept", F_OK); - } catch (ErrnoException e) { - Log.wtf(TAG, "netbpfload did not create program", e); - } - // Did netbpfload run to completion? - try { - Os.access("/sys/fs/bpf/netd_shared/mainline_done", F_OK); - } catch (ErrnoException e) { - Log.wtf(TAG, "netbpfload did not run to completion", e); - } - }, 30_000 /* delayMillis */); + if (!mDeps.isAtLeastV()) { + mHandler.postDelayed(() -> { + // Test Log.wtf reporting pipeline. Ignore this Log.wtf if it shows up in the logs. + final Random r = new Random(); + if (Build.TYPE.equals("user") && r.nextInt(1000) == 0) { + Log.wtf(TAG, "NOT A FAILURE, PLEASE IGNORE! Ensure netbpfload result reported"); + } + // Did netbpfload create the map? + try { + Os.access("/sys/fs/bpf/net_shared/map_gentle_test", F_OK); + } catch (ErrnoException e) { + Log.wtf(TAG, "netbpfload did not create map", e); + } + // Did netbpfload create the program? + try { + Os.access("/sys/fs/bpf/net_shared/prog_gentle_skfilter_accept", F_OK); + } catch (ErrnoException e) { + Log.wtf(TAG, "netbpfload did not create program", e); + } + // Did netbpfload run to completion? + try { + Os.access("/sys/fs/bpf/netd_shared/mainline_done", F_OK); + } catch (ErrnoException e) { + Log.wtf(TAG, "netbpfload did not run to completion", e); + } + }, 30_000 /* delayMillis */); + } mTrackerHandler = new NetworkStateTrackerHandler(mHandlerThread.getLooper()); mConnectivityDiagnosticsHandler = new ConnectivityDiagnosticsHandler(mHandlerThread.getLooper());