android-8.1.0_r81 patches

This commit is contained in:
Ziyang Zhou
2023-10-05 22:44:10 +08:00
parent da422ab6de
commit 81ef272d21
20 changed files with 1232 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
From 0bf56cf5a84b101f6d51807049b70a7c64f4da5d Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sun, 16 Oct 2022 11:09:21 +0800
Subject: [PATCH] fix build
---
core/definitions.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/core/definitions.mk b/core/definitions.mk
index 95e9a02..61f99ca 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -2977,7 +2977,7 @@ endef
# $(1): The file(s) to check (often $@)
# $(2): The partition size.
define assert-max-image-size
-$(if $(2), \
+#$(if $(2), \
$(call assert-max-file-size,$(1),$(call image-size-from-data-size,$(2))))
endef
--
2.34.1

View File

@@ -0,0 +1,32 @@
From 61b90544806f777c5bacf2fc1a1542154f3fad75 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Mon, 26 Apr 2021 22:55:03 +0800
Subject: [PATCH] disable seccomp
---
libminijail.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libminijail.c b/libminijail.c
index 4d61b0d..660b583 100644
--- a/libminijail.c
+++ b/libminijail.c
@@ -1580,6 +1580,7 @@ static void set_seccomp_filter(const struct minijail *j)
/*
* Install the syscall filter.
*/
+#if 0 // HACKED
if (j->flags.seccomp_filter) {
if (j->flags.seccomp_filter_tsync) {
if (sys_seccomp(SECCOMP_SET_MODE_FILTER,
@@ -1594,6 +1595,7 @@ static void set_seccomp_filter(const struct minijail *j)
}
}
}
+#endif
}
static pid_t forward_pid = -1;
--
2.34.1

View File

@@ -0,0 +1,200 @@
From 6fd28b726a9ce3060d377e0f1c722da705b51acd Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sun, 9 May 2021 23:12:46 +0800
Subject: [PATCH] ignore selinux
---
libselinux/include/selinux/selinux.h | 4 ++++
libselinux/src/android/android_platform.c | 6 ++++++
libselinux/src/checkAccess.c | 1 +
libselinux/src/getenforce.c | 1 +
libselinux/src/getpeercon.c | 1 +
libselinux/src/init.c | 1 +
libselinux/src/label.c | 2 ++
libselinux/src/lgetfilecon.c | 1 +
libselinux/src/lsetfilecon.c | 1 +
libselinux/src/procattr.c | 2 ++
10 files changed, 20 insertions(+)
diff --git a/libselinux/include/selinux/selinux.h b/libselinux/include/selinux/selinux.h
index 01201eee..86db8297 100644
--- a/libselinux/include/selinux/selinux.h
+++ b/libselinux/include/selinux/selinux.h
@@ -4,6 +4,10 @@
#include <sys/types.h>
#include <stdarg.h>
+#define SE_HACK
+#define se_hack() if (1) return
+#define se_hack1(p) if (1) return p
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/libselinux/src/android/android_platform.c b/libselinux/src/android/android_platform.c
index 0325113e..868255d1 100644
--- a/libselinux/src/android/android_platform.c
+++ b/libselinux/src/android/android_platform.c
@@ -135,6 +135,7 @@ static bool selinux_android_opts_file_exists(const struct selinux_opt *opt)
struct selabel_handle* selinux_android_file_context_handle(void)
{
+ se_hack1(NULL);
if (selinux_android_opts_file_exists(seopts_file_split)) {
return selinux_android_file_context(seopts_file_split,
ARRAY_SIZE(seopts_file_split));
@@ -146,6 +147,7 @@ struct selabel_handle* selinux_android_file_context_handle(void)
struct selabel_handle* selinux_android_prop_context_handle(void)
{
+ se_hack1(NULL);
struct selabel_handle* sehandle;
const struct selinux_opt* seopts_prop;
@@ -1040,6 +1042,7 @@ oom:
int selinux_android_setcon(const char *con)
{
+ se_hack1(0);
int ret = setcon(con);
if (ret)
return ret;
@@ -1056,6 +1059,7 @@ int selinux_android_setcontext(uid_t uid,
const char *seinfo,
const char *pkgname)
{
+ se_hack1(0);
char *orig_ctx_str = NULL, *ctx_str;
context_t ctx = NULL;
int rc = -1;
@@ -1394,6 +1398,7 @@ static int selinux_android_restorecon_common(const char* pathname_orig,
uid_t uid,
unsigned int flags)
{
+ se_hack1(0);
bool nochange = (flags & SELINUX_ANDROID_RESTORECON_NOCHANGE) ? true : false;
bool verbose = (flags & SELINUX_ANDROID_RESTORECON_VERBOSE) ? true : false;
bool recurse = (flags & SELINUX_ANDROID_RESTORECON_RECURSE) ? true : false;
@@ -1607,6 +1612,7 @@ void selinux_android_set_sehandle(const struct selabel_handle *hndl)
int selinux_android_load_policy()
{
+ se_hack1(0);
int fd = -1;
fd = open(sepolicy_file, O_RDONLY | O_NOFOLLOW | O_CLOEXEC);
diff --git a/libselinux/src/checkAccess.c b/libselinux/src/checkAccess.c
index 8de57477..e1048d83 100644
--- a/libselinux/src/checkAccess.c
+++ b/libselinux/src/checkAccess.c
@@ -33,6 +33,7 @@ static void avc_init_once(void)
}
int selinux_check_access(const char *scon, const char *tcon, const char *class, const char *perm, void *aux) {
+ se_hack1(0);
int rc;
security_id_t scon_id;
security_id_t tcon_id;
diff --git a/libselinux/src/getenforce.c b/libselinux/src/getenforce.c
index d909dced..fb782b77 100644
--- a/libselinux/src/getenforce.c
+++ b/libselinux/src/getenforce.c
@@ -11,6 +11,7 @@
int security_getenforce(void)
{
+ se_hack1(0);
int fd, ret, enforce = 0;
char path[PATH_MAX];
char buf[20];
diff --git a/libselinux/src/getpeercon.c b/libselinux/src/getpeercon.c
index 3a77a2de..f8dab8e5 100644
--- a/libselinux/src/getpeercon.c
+++ b/libselinux/src/getpeercon.c
@@ -47,6 +47,7 @@ hidden_def(getpeercon_raw)
int getpeercon(int fd, char ** context)
{
+ se_hack1((*context = calloc(7, 1), memcpy(*context, "HACKED", 6), 0));
int ret;
char * rcontext;
diff --git a/libselinux/src/init.c b/libselinux/src/init.c
index 2690a72f..24a212db 100644
--- a/libselinux/src/init.c
+++ b/libselinux/src/init.c
@@ -142,6 +142,7 @@ hidden_def(fini_selinuxmnt)
void set_selinuxmnt(const char *mnt)
{
+ se_hack();
selinux_mnt = strdup(mnt);
}
diff --git a/libselinux/src/label.c b/libselinux/src/label.c
index 8e0a8628..c3ba37bd 100644
--- a/libselinux/src/label.c
+++ b/libselinux/src/label.c
@@ -390,6 +390,7 @@ out:
int selabel_lookup(struct selabel_handle *rec, char **con,
const char *key, int type)
{
+ se_hack1((*con = calloc(7, 1), memcpy(*con, "HACKED", 6), 0));
struct selabel_lookup_rec *lr;
lr = selabel_lookup_common(rec, 1, key, type);
@@ -440,6 +441,7 @@ bool selabel_partial_match(struct selabel_handle *rec, const char *key)
int selabel_lookup_best_match(struct selabel_handle *rec, char **con,
const char *key, const char **aliases, int type)
{
+ se_hack1((*con = calloc(7, 1), memcpy(*con, "HACKED", 6), 0));
struct selabel_lookup_rec *lr;
if (!rec->func_lookup_best_match) {
diff --git a/libselinux/src/lgetfilecon.c b/libselinux/src/lgetfilecon.c
index db67bc60..7123480f 100644
--- a/libselinux/src/lgetfilecon.c
+++ b/libselinux/src/lgetfilecon.c
@@ -53,6 +53,7 @@ hidden_def(lgetfilecon_raw)
int lgetfilecon(const char *path, char ** context)
{
+ se_hack1((*context = calloc(7, 1), memcpy(*context, "HACKED", 6), 0));
int ret;
char * rcontext = NULL;
diff --git a/libselinux/src/lsetfilecon.c b/libselinux/src/lsetfilecon.c
index 1d3b28a1..7062703f 100644
--- a/libselinux/src/lsetfilecon.c
+++ b/libselinux/src/lsetfilecon.c
@@ -29,6 +29,7 @@ hidden_def(lsetfilecon_raw)
int lsetfilecon(const char *path, const char *context)
{
+ se_hack1(0);
int ret;
char * rcontext;
diff --git a/libselinux/src/procattr.c b/libselinux/src/procattr.c
index 48dd8aff..ab516e2a 100644
--- a/libselinux/src/procattr.c
+++ b/libselinux/src/procattr.c
@@ -184,6 +184,7 @@ static int getprocattrcon_raw(char ** context,
static int getprocattrcon(char ** context,
pid_t pid, const char *attr)
{
+ se_hack1((*context = calloc(7, 1), memcpy(*context, "HACKED", 6), 0));
int ret;
char * rcontext;
@@ -269,6 +270,7 @@ out:
static int setprocattrcon(const char * context,
pid_t pid, const char *attr)
{
+ se_hack1(0);
int ret;
char * rcontext;
--
2.34.1

View File

@@ -0,0 +1,22 @@
From afc19bc44441c9eaadcbee6c1b60f07bdfbda0ba Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sun, 27 Feb 2022 19:18:27 +0800
Subject: [PATCH] fix build
---
Android.bp | 1 -
1 file changed, 1 deletion(-)
diff --git a/Android.bp b/Android.bp
index b81c37c0f..e122a3404 100644
--- a/Android.bp
+++ b/Android.bp
@@ -105,5 +105,4 @@ subdirs = [
"src",
"third_party/llvm-subzero",
"third_party/LLVM",
- "third_party/subzero",
]
--
2.34.1

View File

@@ -0,0 +1,32 @@
From 159916681388abee72d9c876c0f0b0374114af26 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Mon, 26 Apr 2021 23:01:03 +0800
Subject: [PATCH] video playback workaround
---
media/libstagefright/colorconversion/SoftwareRenderer.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/media/libstagefright/colorconversion/SoftwareRenderer.cpp b/media/libstagefright/colorconversion/SoftwareRenderer.cpp
index a07787ac5a..5c684a592e 100644
--- a/media/libstagefright/colorconversion/SoftwareRenderer.cpp
+++ b/media/libstagefright/colorconversion/SoftwareRenderer.cpp
@@ -106,6 +106,7 @@ void SoftwareRenderer::resetFormatIfChanged(const sp<AMessage> &format) {
// hardware has YUV12 and RGBA8888 support, so convert known formats
{
switch (mColorFormat) {
+#if 0 // HACKED
case OMX_COLOR_FormatYUV420Planar:
case OMX_COLOR_FormatYUV420SemiPlanar:
case OMX_TI_COLOR_FormatYUV420PackedSemiPlanar:
@@ -115,6 +116,7 @@ void SoftwareRenderer::resetFormatIfChanged(const sp<AMessage> &format) {
bufHeight = (mCropHeight + 1) & ~1;
break;
}
+#endif
case OMX_COLOR_Format24bitRGB888:
{
halFormat = HAL_PIXEL_FORMAT_RGB_888;
--
2.34.1

View File

@@ -0,0 +1,37 @@
From 2b3691d22402cb2c1a0fd2458b2319b50c4d97bc Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sun, 9 May 2021 22:04:12 +0800
Subject: [PATCH 1/3] fix booting
---
core/jni/android_os_VintfObject.cpp | 1 +
.../java/com/android/server/net/NetworkPolicyManagerService.java | 1 +
2 files changed, 2 insertions(+)
diff --git a/core/jni/android_os_VintfObject.cpp b/core/jni/android_os_VintfObject.cpp
index 7ec4b8ea0799..09f8a67c50ec 100644
--- a/core/jni/android_os_VintfObject.cpp
+++ b/core/jni/android_os_VintfObject.cpp
@@ -94,6 +94,7 @@ static jobjectArray android_os_VintfObject_report(JNIEnv* env, jclass)
}
static jint android_os_VintfObject_verify(JNIEnv* env, jclass, jobjectArray packageInfo) {
+ if (env) return 0; // HACKED
size_t count = env->GetArrayLength(packageInfo);
std::vector<std::string> cPackageInfo{count};
for (size_t i = 0; i < count; ++i) {
diff --git a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
index 5159c70e991c..6e24bdcefe01 100644
--- a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
+++ b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
@@ -652,6 +652,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
Process.setThreadPriority(Process.THREAD_PRIORITY_FOREGROUND);
if (!isBandwidthControlEnabled()) {
Slog.w(TAG, "bandwidth controls disabled, unable to enforce policy");
+ initCompleteSignal.countDown(); // HACKED?
return;
}
--
2.34.1

View File

@@ -0,0 +1,28 @@
From 776aecb5d65541fbf301b25eb5a098a0ca232700 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sun, 9 May 2021 22:09:00 +0800
Subject: [PATCH 2/3] fix wide gamut support
---
libs/hwui/renderthread/EglManager.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libs/hwui/renderthread/EglManager.cpp b/libs/hwui/renderthread/EglManager.cpp
index 16d77364942e..bd4708da562a 100644
--- a/libs/hwui/renderthread/EglManager.cpp
+++ b/libs/hwui/renderthread/EglManager.cpp
@@ -223,9 +223,9 @@ void EglManager::loadConfigs() {
numConfigs = 1;
if (!eglChooseConfig(mEglDisplay, attribs16F, &mEglConfigWideGamut, numConfigs, &numConfigs)
|| numConfigs != 1) {
- LOG_ALWAYS_FATAL(
- "Device claims wide gamut support, cannot find matching config, error = %s",
+ ALOGE("Device claims wide gamut support, cannot find matching config, error = %s",
eglErrorString());
+ EglExtensions.pixelFormatFloat = false;
}
}
}
--
2.34.1

View File

@@ -0,0 +1,37 @@
From d03f2e2f2b136b83c16373da9e54967e730d37a7 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sun, 9 May 2021 22:29:50 +0800
Subject: [PATCH 3/3] mocked WiFi
---
core/java/android/net/ConnectivityManager.java | 1 +
.../java/com/android/server/connectivity/NetworkMonitor.java | 1 +
2 files changed, 2 insertions(+)
diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java
index 467eb9b0b0bf..82f17e2d3a53 100644
--- a/core/java/android/net/ConnectivityManager.java
+++ b/core/java/android/net/ConnectivityManager.java
@@ -943,6 +943,7 @@ public class ConnectivityManager {
@RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE)
public NetworkInfo getNetworkInfo(int networkType) {
try {
+ if (networkType == ConnectivityManager.TYPE_WIFI) networkType = ConnectivityManager.TYPE_ETHERNET;
return mService.getNetworkInfo(networkType);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
diff --git a/services/core/java/com/android/server/connectivity/NetworkMonitor.java b/services/core/java/com/android/server/connectivity/NetworkMonitor.java
index d3a93542c740..30a71cb9aded 100644
--- a/services/core/java/com/android/server/connectivity/NetworkMonitor.java
+++ b/services/core/java/com/android/server/connectivity/NetworkMonitor.java
@@ -858,6 +858,7 @@ public class NetworkMonitor extends StateMachine {
*/
@VisibleForTesting
protected CaptivePortalProbeResult sendHttpProbe(URL url, int probeType) {
+ if (url != null) return new CaptivePortalProbeResult(CaptivePortalProbeResult.SUCCESS_CODE);
HttpURLConnection urlConnection = null;
int httpResponseCode = CaptivePortalProbeResult.FAILED_CODE;
String redirectUrl = null;
--
2.34.1

View File

@@ -0,0 +1,28 @@
From 0e477419eea5221c56709c890f36e9748c93b3ea Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sun, 9 May 2021 23:19:00 +0800
Subject: [PATCH] choose GLES driver by `ro.hardware.egl`
---
opengl/libs/EGL/Loader.cpp | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/opengl/libs/EGL/Loader.cpp b/opengl/libs/EGL/Loader.cpp
index 371239ddc0..d451831aa3 100644
--- a/opengl/libs/EGL/Loader.cpp
+++ b/opengl/libs/EGL/Loader.cpp
@@ -374,6 +374,11 @@ static void* load_system_driver(const char* kind) {
// libEGL_*.so, libGLESv1_CM_*.so, libGLESv2_*.so
pattern.append("_");
+ {
+ char prop[PROPERTY_VALUE_MAX];
+ property_get("ro.hardware.egl", prop, "swiftshader");
+ pattern.append(prop);
+ }
for (size_t i=0 ; i<NELEM(searchPaths) ; i++) {
if (find(result, pattern, searchPaths[i], false)) {
return result;
--
2.34.1

View File

@@ -0,0 +1,24 @@
From fe4d13d3a4848fb47388db75bc568f1b12adf814 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Mon, 10 May 2021 04:06:56 +0000
Subject: [PATCH] fix networking
---
java/com/android/server/ethernet/EthernetNetworkFactory.java | 1 +
1 file changed, 1 insertion(+)
diff --git a/java/com/android/server/ethernet/EthernetNetworkFactory.java b/java/com/android/server/ethernet/EthernetNetworkFactory.java
index d6d0def..0babfe5 100644
--- a/java/com/android/server/ethernet/EthernetNetworkFactory.java
+++ b/java/com/android/server/ethernet/EthernetNetworkFactory.java
@@ -342,6 +342,7 @@ class EthernetNetworkFactory {
return;
}
linkProperties = config.getStaticIpConfiguration().toLinkProperties(mIface);
+ onIpLayerStarted(linkProperties);
} else {
mNetworkInfo.setDetailedState(DetailedState.OBTAINING_IPADDR, null, mHwAddr);
IpManager.Callback ipmCallback = new IpManager.Callback() {
--
2.34.1

View File

@@ -0,0 +1,177 @@
From 4da2528fa5774e0313b3e98e703cf49d181cfa48 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sun, 9 May 2021 23:27:12 +0800
Subject: [PATCH 1/6] fix booting
---
init/init.cpp | 15 +++++++++++++--
init/log.cpp | 2 ++
init/property_service.cpp | 1 +
init/service.cpp | 2 +-
init/util.cpp | 3 ++-
rootdir/init.rc | 21 ++++++++++-----------
6 files changed, 29 insertions(+), 15 deletions(-)
mode change 100644 => 100755 init/init.cpp
mode change 100644 => 100755 init/property_service.cpp
diff --git a/init/init.cpp b/init/init.cpp
old mode 100644
new mode 100755
index f65bfe08c..9114c4b04
--- a/init/init.cpp
+++ b/init/init.cpp
@@ -873,6 +873,8 @@ static bool selinux_load_policy() {
}
static void selinux_initialize(bool in_kernel_domain) {
+ setenv("INIT_SELINUX_TOOK", "0", 1);
+ se_hack();
Timer t;
selinux_callback cb;
@@ -1016,6 +1018,7 @@ int main(int argc, char** argv) {
mount("tmpfs", "/dev", "tmpfs", MS_NOSUID, "mode=0755");
mkdir("/dev/pts", 0755);
mkdir("/dev/socket", 0755);
+ unshare(CLONE_NEWCGROUP);
mount("devpts", "/dev/pts", "devpts", 0, NULL);
#define MAKE_STR(x) __STRING(x)
mount("proc", "/proc", "proc", 0, "hidepid=2,gid=" MAKE_STR(AID_READPROC));
@@ -1059,8 +1062,16 @@ int main(int argc, char** argv) {
setenv("INIT_STARTED_AT", std::to_string(start_ms).c_str(), 1);
char* path = argv[0];
- char* args[] = { path, nullptr };
- execv(path, args);
+ std::vector<const char *> args = {};
+ std::string cmdline;
+ android::base::ReadFileToString("/proc/self/cmdline", &cmdline);
+ std::replace(cmdline.begin(), cmdline.end(), '\0', ' ');
+ auto cmd_vector = android::base::Split(android::base::Trim(cmdline), " ");
+ for (const auto& entry : cmd_vector) {
+ args.push_back(entry.c_str());
+ }
+ args.push_back(nullptr);
+ execv(path, const_cast<char**>(args.data()));
// execv() only returns if an error happened, in which case we
// panic and never fall through this conditional.
diff --git a/init/log.cpp b/init/log.cpp
index 1830077e1..de2af6bae 100644
--- a/init/log.cpp
+++ b/init/log.cpp
@@ -27,6 +27,7 @@ namespace android {
namespace init {
void InitKernelLogging(char* argv[]) {
+#if 0 // HACKED
// Make stdin/stdout/stderr all point to /dev/null.
int fd = open("/sys/fs/selinux/null", O_RDWR);
if (fd == -1) {
@@ -40,6 +41,7 @@ void InitKernelLogging(char* argv[]) {
dup2(fd, 2);
if (fd > 2) close(fd);
+#endif
android::base::InitLogging(argv, &android::base::KernelLogger);
}
diff --git a/init/property_service.cpp b/init/property_service.cpp
old mode 100644
new mode 100755
index fd14bd66f..2b75834fd
--- a/init/property_service.cpp
+++ b/init/property_service.cpp
@@ -77,6 +77,7 @@ void property_init() {
static bool check_mac_perms(const std::string& name, char* sctx, struct ucred* cr) {
+ se_hack1(true);
if (!sctx) {
return false;
}
diff --git a/init/service.cpp b/init/service.cpp
index f5e54dfda..5f017c12a 100644
--- a/init/service.cpp
+++ b/init/service.cpp
@@ -59,6 +59,7 @@ namespace init {
static std::string ComputeContextFromExecutable(std::string& service_name,
const std::string& service_path) {
+ se_hack1("HACKED");
std::string computed_context;
char* raw_con = nullptr;
@@ -326,7 +327,6 @@ void Service::Reap() {
if (now < time_crashed_ + 4min) {
if (++crash_count_ > 4) {
LOG(ERROR) << "critical process '" << name_ << "' exited 4 times in 4 minutes";
- panic();
}
} else {
time_crashed_ = now;
diff --git a/init/util.cpp b/init/util.cpp
index fdcb22d1c..6d2a24593 100644
--- a/init/util.cpp
+++ b/init/util.cpp
@@ -239,7 +239,8 @@ int wait_for_file(const char* filename, std::chrono::nanoseconds timeout) {
void import_kernel_cmdline(bool in_qemu,
const std::function<void(const std::string&, const std::string&, bool)>& fn) {
std::string cmdline;
- android::base::ReadFileToString("/proc/cmdline", &cmdline);
+ android::base::ReadFileToString("/proc/self/cmdline", &cmdline); // HACKED
+ std::replace(cmdline.begin(), cmdline.end(), '\0', ' '); // HACKED
for (const auto& entry : android::base::Split(android::base::Trim(cmdline), " ")) {
std::vector<std::string> pieces = android::base::Split(entry, "=");
diff --git a/rootdir/init.rc b/rootdir/init.rc
index 2a7333563..9e61bbcdf 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -167,25 +167,25 @@ on init
# this ensures that the cpusets are present and usable, but the device's
# init.rc must actually set the correct cpus
mkdir /dev/cpuset/foreground
- copy /dev/cpuset/cpus /dev/cpuset/foreground/cpus
- copy /dev/cpuset/mems /dev/cpuset/foreground/mems
+ copy /dev/cpuset/cpuset.cpus /dev/cpuset/foreground/cpuset.cpus
+ copy /dev/cpuset/cpuset.mems /dev/cpuset/foreground/cpuset.mems
mkdir /dev/cpuset/foreground/boost
- copy /dev/cpuset/cpus /dev/cpuset/foreground/boost/cpus
- copy /dev/cpuset/mems /dev/cpuset/foreground/boost/mems
+ copy /dev/cpuset/cpuset.cpus /dev/cpuset/foreground/boost/cpuset.cpus
+ copy /dev/cpuset/cpuset.mems /dev/cpuset/foreground/boost/cpuset.mems
mkdir /dev/cpuset/background
- copy /dev/cpuset/cpus /dev/cpuset/background/cpus
- copy /dev/cpuset/mems /dev/cpuset/background/mems
+ copy /dev/cpuset/cpuset.cpus /dev/cpuset/background/cpuset.cpus
+ copy /dev/cpuset/cpuset.mems /dev/cpuset/background/cpuset.mems
# system-background is for system tasks that should only run on
# little cores, not on bigs
# to be used only by init, so don't change system-bg permissions
mkdir /dev/cpuset/system-background
- copy /dev/cpuset/cpus /dev/cpuset/system-background/cpus
- copy /dev/cpuset/mems /dev/cpuset/system-background/mems
+ copy /dev/cpuset/cpuset.cpus /dev/cpuset/system-background/cpuset.cpus
+ copy /dev/cpuset/cpuset.mems /dev/cpuset/system-background/cpuset.mems
mkdir /dev/cpuset/top-app
- copy /dev/cpuset/cpus /dev/cpuset/top-app/cpus
- copy /dev/cpuset/mems /dev/cpuset/top-app/mems
+ copy /dev/cpuset/cpuset.cpus /dev/cpuset/top-app/cpuset.cpus
+ copy /dev/cpuset/cpuset.mems /dev/cpuset/top-app/cpuset.mems
# change permissions for all cpusets we'll touch at runtime
chown system system /dev/cpuset
@@ -314,7 +314,6 @@ on post-fs
start vndservicemanager
# once everything is setup, no need to modify /
- mount rootfs rootfs / ro remount
# Mount shared so changes propagate into child namespaces
mount rootfs rootfs / shared rec
# Mount default storage into root namespace
--
2.34.1

View File

@@ -0,0 +1,25 @@
From f93616ae0ec45a7c6f7efb08e3c0a98c9310743a Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sun, 9 May 2021 23:29:12 +0800
Subject: [PATCH 2/6] allow override ro.* prop
---
init/init.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/init/init.cpp b/init/init.cpp
index 9114c4b04..32186044a 100755
--- a/init/init.cpp
+++ b/init/init.cpp
@@ -483,6 +483,8 @@ static void import_kernel_nv(const std::string& key, const std::string& value, b
strlcpy(qemu, value.c_str(), sizeof(qemu));
} else if (android::base::StartsWith(key, "androidboot.")) {
property_set("ro.boot." + key.substr(12), value);
+ } else if (android::base::StartsWith(key, "ro.")) {
+ property_set(key, value);
}
}
--
2.34.1

View File

@@ -0,0 +1,26 @@
From 334c600f7b10f789840d5a074f51d9fc43b86552 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Thu, 24 Jun 2021 15:26:57 +0000
Subject: [PATCH 3/6] remove input subsystem
---
rootdir/ueventd.rc | 3 ---
1 file changed, 3 deletions(-)
diff --git a/rootdir/ueventd.rc b/rootdir/ueventd.rc
index eadf219b5..88e20952f 100644
--- a/rootdir/ueventd.rc
+++ b/rootdir/ueventd.rc
@@ -21,9 +21,6 @@ subsystem msm_camera
devname uevent_devpath
dirname /dev/msm_camera
-subsystem input
- devname uevent_devpath
- dirname /dev/input
subsystem mtd
devname uevent_devpath
--
2.34.1

View File

@@ -0,0 +1,37 @@
From 301aaabfeb86948ad222cf1cc37144dcced0d53e Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Fri, 17 Dec 2021 22:44:33 +0800
Subject: [PATCH 4/6] disable ueventd coldboot
---
init/init.cpp | 1 -
rootdir/init.rc | 1 +
2 files changed, 1 insertion(+), 1 deletion(-)
diff --git a/init/init.cpp b/init/init.cpp
index 32186044a..925e3243b 100755
--- a/init/init.cpp
+++ b/init/init.cpp
@@ -1017,7 +1017,6 @@ int main(int argc, char** argv) {
// Get the basic filesystem setup we need put together in the initramdisk
// on / and then we'll let the rc file figure out the rest.
- mount("tmpfs", "/dev", "tmpfs", MS_NOSUID, "mode=0755");
mkdir("/dev/pts", 0755);
mkdir("/dev/socket", 0755);
unshare(CLONE_NEWCGROUP);
diff --git a/rootdir/init.rc b/rootdir/init.rc
index 9e61bbcdf..c46190d1f 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -39,6 +39,7 @@ on early-init
# cgroup for system_server and surfaceflinger
mkdir /dev/memcg/system 0550 system system
+ write /dev/.coldboot_done 1
start ueventd
on init
--
2.34.1

View File

@@ -0,0 +1,318 @@
From 5f3272be10ea27866e5e0b30bfc921befde70ab2 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sun, 3 Jul 2022 11:22:31 +0800
Subject: [PATCH 5/6] memfd support
---
libcutils/Android.bp | 4 +-
libcutils/{ashmem-dev.c => ashmem-dev.cpp} | 51 +++++-
libcutils/ashmem-hack.inc | 172 +++++++++++++++++++++
3 files changed, 223 insertions(+), 4 deletions(-)
rename libcutils/{ashmem-dev.c => ashmem-dev.cpp} (79%)
create mode 100644 libcutils/ashmem-hack.inc
diff --git a/libcutils/Android.bp b/libcutils/Android.bp
index d00ff5f96..93f2658c7 100644
--- a/libcutils/Android.bp
+++ b/libcutils/Android.bp
@@ -106,7 +106,7 @@ cc_library {
android: {
srcs: libcutils_nonwindows_sources + [
"android_reboot.c",
- "ashmem-dev.c",
+ "ashmem-dev.cpp",
"klog.cpp",
"partition_utils.c",
"properties.cpp",
@@ -148,7 +148,7 @@ cc_library {
},
},
- shared_libs: ["liblog"],
+ shared_libs: ["liblog", "libbase"],
header_libs: [
"libcutils_headers",
"libutils_headers",
diff --git a/libcutils/ashmem-dev.c b/libcutils/ashmem-dev.cpp
similarity index 79%
rename from libcutils/ashmem-dev.c
rename to libcutils/ashmem-dev.cpp
index b4abb79d8..137c0280c 100644
--- a/libcutils/ashmem-dev.c
+++ b/libcutils/ashmem-dev.cpp
@@ -135,8 +135,14 @@ static int __ashmem_is_ashmem(int fd, int fatal)
return -1;
}
+#include "ashmem-hack.inc"
+
int ashmem_valid(int fd)
{
+ if (has_memfd_support() && !memfd_is_ashmem(fd)) {
+ return 1;
+ }
+
return __ashmem_is_ashmem(fd, 0) >= 0;
}
@@ -151,6 +157,10 @@ int ashmem_create_region(const char *name, size_t size)
{
int ret, save_errno;
+ if (has_memfd_support()) {
+ return memfd_create_region(name ? name : "none", size);
+ }
+
int fd = __ashmem_open();
if (fd < 0) {
return fd;
@@ -182,6 +192,10 @@ error:
int ashmem_set_prot_region(int fd, int prot)
{
+ if (has_memfd_support() && !memfd_is_ashmem(fd)) {
+ return memfd_set_prot_region(fd, prot);
+ }
+
int ret = __ashmem_is_ashmem(fd, 1);
if (ret < 0) {
return ret;
@@ -192,7 +206,16 @@ int ashmem_set_prot_region(int fd, int prot)
int ashmem_pin_region(int fd, size_t offset, size_t len)
{
- struct ashmem_pin pin = { offset, len };
+ if (!pin_deprecation_warn || debug_log) {
+ ALOGE("Pinning is deprecated since Android Q. Please use trim or other methods.\n");
+ pin_deprecation_warn = true;
+ }
+
+ if (has_memfd_support() && !memfd_is_ashmem(fd)) {
+ return 0;
+ }
+
+ struct ashmem_pin pin = { static_cast<uint32_t>(offset), static_cast<uint32_t>(len) };
int ret = __ashmem_is_ashmem(fd, 1);
if (ret < 0) {
@@ -204,7 +227,16 @@ int ashmem_pin_region(int fd, size_t offset, size_t len)
int ashmem_unpin_region(int fd, size_t offset, size_t len)
{
- struct ashmem_pin pin = { offset, len };
+ if (!pin_deprecation_warn || debug_log) {
+ ALOGE("Pinning is deprecated since Android Q. Please use trim or other methods.\n");
+ pin_deprecation_warn = true;
+ }
+
+ if (has_memfd_support() && !memfd_is_ashmem(fd)) {
+ return 0;
+ }
+
+ struct ashmem_pin pin = { static_cast<uint32_t>(offset), static_cast<uint32_t>(len) };
int ret = __ashmem_is_ashmem(fd, 1);
if (ret < 0) {
@@ -216,6 +248,21 @@ int ashmem_unpin_region(int fd, size_t offset, size_t len)
int ashmem_get_size_region(int fd)
{
+ if (has_memfd_support() && !memfd_is_ashmem(fd)) {
+ struct stat sb;
+
+ if (fstat(fd, &sb) == -1) {
+ ALOGE("ashmem_get_size_region(%d): fstat failed: %s\n", fd, strerror(errno));
+ return -1;
+ }
+
+ if (debug_log) {
+ ALOGD("ashmem_get_size_region(%d): %d\n", fd, static_cast<int>(sb.st_size));
+ }
+
+ return sb.st_size;
+ }
+
int ret = __ashmem_is_ashmem(fd, 1);
if (ret < 0) {
return ret;
diff --git a/libcutils/ashmem-hack.inc b/libcutils/ashmem-hack.inc
new file mode 100644
index 000000000..8526c85be
--- /dev/null
+++ b/libcutils/ashmem-hack.inc
@@ -0,0 +1,172 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <cutils/ashmem.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <linux/ashmem.h>
+#include <linux/memfd.h>
+#include <log/log.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <sys/syscall.h>
+#include <sys/sysmacros.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <android-base/file.h>
+#include <android-base/properties.h>
+#include <android-base/strings.h>
+#include <android-base/unique_fd.h>
+
+/* Will be added to UAPI once upstream change is merged */
+#define F_SEAL_FUTURE_WRITE 0x0010
+
+/*
+ * The minimum vendor API level at and after which it is safe to use memfd.
+ * This is to facilitate deprecation of ashmem.
+ */
+#define MIN_MEMFD_VENDOR_API_LEVEL 29
+#define MIN_MEMFD_VENDOR_API_LEVEL_CHAR 'Q'
+
+/*
+ * has_memfd_support() determines if the device can use memfd. memfd support
+ * has been there for long time, but certain things in it may be missing. We
+ * check for needed support in it. Also we check if the VNDK version of
+ * libcutils being used is new enough, if its not, then we cannot use memfd
+ * since the older copies may be using ashmem so we just use ashmem. Once all
+ * Android devices that are getting updates are new enough (ex, they were
+ * originally shipped with Android release > P), then we can just use memfd and
+ * delete all ashmem code from libcutils (while preserving the interface).
+ *
+ * NOTE:
+ * The sys.use_memfd property is set by default to false in Android
+ * to temporarily disable memfd, till vendor and apps are ready for it.
+ * The main issue: either apps or vendor processes can directly make ashmem
+ * IOCTLs on FDs they receive by assuming they are ashmem, without going
+ * through libcutils. Such fds could have very well be originally created with
+ * libcutils hence they could be memfd. Thus the IOCTLs will break.
+ *
+ * Set default value of sys.use_memfd property to true once the issue is
+ * resolved, so that the code can then self-detect if kernel support is present
+ * on the device. The property can also set to true from adb shell, for
+ * debugging.
+ */
+
+static bool debug_log = false; /* set to true for verbose logging and other debug */
+static bool pin_deprecation_warn = true; /* Log the pin deprecation warning only once */
+
+
+/* Determine if memfd can be supported. This is just one-time hardwork
+ * which will be cached by the caller.
+ */
+static bool __has_memfd_support() {
+ /* Used to turn on/off the detection at runtime, in the future this
+ * property will be removed once we switch everything over to ashmem.
+ * Currently it is used only for debugging to switch the system over.
+ */
+ if (!android::base::GetBoolProperty("sys.use_memfd", false)) {
+ if (debug_log) {
+ ALOGD("sys.use_memfd=false so memfd disabled\n");
+ }
+ return false;
+ }
+
+ // Check if kernel support exists, otherwise fall back to ashmem.
+ // This code needs to build on old API levels, so we can't use the libc
+ // wrapper.
+ android::base::unique_fd fd(
+ syscall(__NR_memfd_create, "test_android_memfd", MFD_CLOEXEC | MFD_ALLOW_SEALING));
+ if (fd == -1) {
+ ALOGE("memfd_create failed: %s, no memfd support.\n", strerror(errno));
+ return false;
+ }
+
+ if (fcntl(fd, F_ADD_SEALS, F_SEAL_FUTURE_WRITE) == -1) {
+ ALOGE("fcntl(F_ADD_SEALS) failed: %s, no memfd support.\n", strerror(errno));
+ return false;
+ }
+
+ if (debug_log) {
+ ALOGD("memfd: device has memfd support, using it\n");
+ }
+ return true;
+}
+
+static bool has_memfd_support() {
+ /* memfd_supported is the initial global per-process state of what is known
+ * about memfd.
+ */
+ static bool memfd_supported = __has_memfd_support();
+
+ return memfd_supported;
+}
+
+static bool memfd_is_ashmem(int fd) {
+ static bool fd_check_error_once = false;
+
+ if (__ashmem_is_ashmem(fd, 0) == 0) {
+ if (!fd_check_error_once) {
+ ALOGE("memfd: memfd expected but ashmem fd used - please use libcutils.\n");
+ fd_check_error_once = true;
+ }
+
+ return true;
+ }
+
+ return false;
+}
+
+static int memfd_create_region(const char* name, size_t size) {
+ // This code needs to build on old API levels, so we can't use the libc
+ // wrapper.
+ android::base::unique_fd fd(syscall(__NR_memfd_create, name, MFD_CLOEXEC | MFD_ALLOW_SEALING));
+
+ if (fd == -1) {
+ ALOGE("memfd_create(%s, %zd) failed: %s\n", name, size, strerror(errno));
+ return -1;
+ }
+
+ if (ftruncate(fd, size) == -1) {
+ ALOGE("ftruncate(%s, %zd) failed for memfd creation: %s\n", name, size, strerror(errno));
+ return -1;
+ }
+
+ if (debug_log) {
+ ALOGE("memfd_create(%s, %zd) success. fd=%d\n", name, size, fd.get());
+ }
+ return fd.release();
+}
+
+static int memfd_set_prot_region(int fd, int prot) {
+ /* Only proceed if an fd needs to be write-protected */
+ if (prot & PROT_WRITE) {
+ return 0;
+ }
+
+ if (fcntl(fd, F_ADD_SEALS, F_SEAL_FUTURE_WRITE) == -1) {
+ ALOGE("memfd_set_prot_region(%d, %d): F_SEAL_FUTURE_WRITE seal failed: %s\n", fd, prot,
+ strerror(errno));
+ return -1;
+ }
+
+ return 0;
+}
--
2.34.1

View File

@@ -0,0 +1,32 @@
From e7d905b53f72bceafeffd5e7e3948f25bc313038 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sun, 21 Aug 2022 11:24:11 +0800
Subject: [PATCH 6/6] fix cpu cgroup mount
---
rootdir/init.rc | 2 ++
1 file changed, 2 insertions(+)
diff --git a/rootdir/init.rc b/rootdir/init.rc
index c46190d1f..fef98f000 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -29,6 +29,7 @@ on early-init
# Mount cgroup mount point for cpu accounting
mount cgroup none /acct cpuacct
+ mount cgroup none /acct cpu,cpuacct
mkdir /acct/uid
# root memory control cgroup, used by lmkd
@@ -155,6 +156,7 @@ on init
# Create cgroup mount points for process groups
mkdir /dev/cpuctl
mount cgroup none /dev/cpuctl cpu
+ mount cgroup none /dev/cpuctl cpu,cpuacct
chown system system /dev/cpuctl
chown system system /dev/cpuctl/tasks
chmod 0666 /dev/cpuctl/tasks
--
2.34.1

View File

@@ -0,0 +1,80 @@
From 52fd0d4ae6261696dd7e0f799b066feac37c0917 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sun, 9 May 2021 22:39:50 +0800
Subject: [PATCH] fix booting
---
AccessControl.cpp | 4 ++++
service.cpp | 6 +++++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/AccessControl.cpp b/AccessControl.cpp
index 84f84d0..f068089 100644
--- a/AccessControl.cpp
+++ b/AccessControl.cpp
@@ -19,6 +19,7 @@ struct audit_data {
using android::FQName;
AccessControl::AccessControl() {
+#ifndef SE_HACK
mSeHandle = selinux_android_hw_service_context_handle();
LOG_ALWAYS_FATAL_IF(mSeHandle == NULL, "Failed to acquire SELinux handle.");
@@ -27,6 +28,7 @@ AccessControl::AccessControl() {
}
selinux_status_open(true);
+#endif
mSeCallbacks.func_audit = AccessControl::auditCallback;
selinux_set_callback(SELINUX_CB_AUDIT, mSeCallbacks);
@@ -75,6 +77,7 @@ AccessControl::CallingContext AccessControl::getCallingContext(pid_t sourcePid)
}
bool AccessControl::checkPermission(const CallingContext& source, const char *targetContext, const char *perm, const char *interface) {
+ se_hack1(true);
if (!source.sidPresent) {
return false;
}
@@ -93,6 +96,7 @@ bool AccessControl::checkPermission(const CallingContext& source, const char *ta
}
bool AccessControl::checkPermission(const CallingContext& source, const char *perm, const char *interface) {
+ se_hack1(true);
char *targetContext = nullptr;
bool allowed = false;
diff --git a/service.cpp b/service.cpp
index 4fdf4df..5afb5a1 100644
--- a/service.cpp
+++ b/service.cpp
@@ -62,7 +62,7 @@ int main() {
configureRpcThreadpool(1, true /* callerWillJoin */);
sp<ServiceManager> manager = new ServiceManager();
- setRequestingSid(manager, true);
+// setRequestingSid(manager, true); // HACKED
if (!manager->add(serviceName, manager)) {
ALOGE("Failed to register hwservicemanager with itself.");
@@ -97,6 +97,7 @@ int main() {
// Tell IPCThreadState we're the service manager
sp<BnHwServiceManager> service = new BnHwServiceManager(manager);
IPCThreadState::self()->setTheContextObject(service);
+#ifndef SE_HACK
// Then tell binder kernel
flat_binder_object obj {
.flags = FLAT_BINDER_FLAG_TXN_SECURITY_CTX,
@@ -110,6 +111,9 @@ int main() {
result = ioctl(binder_fd, BINDER_SET_CONTEXT_MGR, 0);
}
+#else
+ ioctl(binder_fd, BINDER_SET_CONTEXT_MGR, 0);
+#endif // SE_HACK
// Only enable FIFO inheritance for hwbinder
// FIXME: remove define when in the kernel
--
2.34.1

View File

@@ -0,0 +1,24 @@
From fb6c930f11929ec9c64ad780e85a503c48efbc32 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sat, 15 Oct 2022 09:12:31 +0800
Subject: [PATCH] ignore compatibility check
---
VintfObject.cpp | 1 -
1 file changed, 1 deletion(-)
diff --git a/VintfObject.cpp b/VintfObject.cpp
index d441245..faa8cf9 100644
--- a/VintfObject.cpp
+++ b/VintfObject.cpp
@@ -281,7 +281,6 @@ int32_t checkCompatibility(const std::vector<std::string>& xmls, bool mount,
if (error)
error->insert(0, "Runtime info and framework compatibility matrix "
"are incompatible: ");
- return INCOMPATIBLE;
}
}
--
2.34.1

View File

@@ -0,0 +1,24 @@
From 61bca85c812562cc7b63c3b0d8f9eea63eff463a Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Mon, 26 Apr 2021 23:09:01 +0800
Subject: [PATCH] ? fix booting
---
server/IptablesRestoreController.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/server/IptablesRestoreController.cpp b/server/IptablesRestoreController.cpp
index 88d88f64..b4082067 100644
--- a/server/IptablesRestoreController.cpp
+++ b/server/IptablesRestoreController.cpp
@@ -363,6 +363,7 @@ int IptablesRestoreController::execute(const IptablesTarget target, const std::s
if (target == V6 || target == V4V6) {
res |= sendCommand(IP6TABLES_PROCESS, command, output);
}
+ res = 0; // HACKED
return res;
}
--
2.34.1

View File

@@ -0,0 +1,24 @@
From decbbb51037dde5ebeb9f2c8cd72c55419b4d967 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sun, 9 May 2021 22:46:23 +0800
Subject: [PATCH] fix booting
---
TrimTask.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/TrimTask.cpp b/TrimTask.cpp
index 08e6499..4301007 100644
--- a/TrimTask.cpp
+++ b/TrimTask.cpp
@@ -68,6 +68,7 @@ void TrimTask::addFromFstab() {
std::unique_ptr<fstab, decltype(&fs_mgr_free_fstab)> fstab(fs_mgr_read_fstab_default(),
fs_mgr_free_fstab);
struct fstab_rec *prev_rec = NULL;
+ if (!fstab) return; // HACKED
for (int i = 0; i < fstab->num_entries; i++) {
/* Skip raw partitions */
--
2.34.1