Commit 17f5bd09 authored by Hailong.Liu's avatar Hailong.Liu Committed by Suren Baghdasaryan
Browse files

ANDROID: sched/psi: disable the privilege check if


CONFIG_DEFAULT_SECURITY_SELINUX is enabled

Since 'commit d82caa27 ("sched/psi: Allow unprivileged polling
of N*2s period")' only processes with CAP_SYS_RESOURCE privilege can
register with window_us < WINDOW_MAX_US. Unprivileged ones can only
use multiples of 2s for window_us to register.

So on the Android V with kernel-6.6, system_server without
CAP_SYS_RESOURCE using 1s for window_us failed to register.

The relative code as follows:
frameworks/base/services/core/jni/com_android_server_am_LowMemDetector.cpp;l=44
// stall tracking window size in us
static constexpr int PSI_WINDOW_SIZE_US = 1000000;

The failed log:
libpsi  : /proc/pressure/memory write failed for psi stall type 'some'; errno=22
LowMemDetector: Failed to register psi trigger

To fix this, disable the privilege check if CONFIG_DEFAULT_SECURITY_SELINUX
is enabled, Besides change proc_create() calls to 0 to keep consistency with
the previous version of the kernel.

Bug: 348152354
Bug: 410150316
Change-Id: Ica596c210604661e37fd3ff4c7c3aa22855573f5
Signed-off-by: default avatarHailong.Liu <liuhailong@oppo.com>
parent ad2761e0
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment