25 Commits

Author SHA1 Message Date
77fa630b9d 优化GPS坐标解析逻辑,使用strtod实现无异常解析,并添加解析失败的日志记录 2025-09-19 01:54:56 +08:00
e3fddbd365 添加从文件读取自定义GPS位置的功能,进一步增强GNSS位置提供者的灵活性 2025-09-19 01:44:55 +08:00
66306ee466 修复GNSS位置提供者的路径问题,确保JNI实现的正确性 2025-09-19 01:36:18 +08:00
71fc42c2cc 更新GNSS位置提供者的JNI实现,增强GPS功能的稳定性和性能 2025-09-19 01:19:38 +08:00
0c785fa9ce 实现从文件读取自定义GPS位置的功能,增强了GPS定位的灵活性 2025-09-19 00:41:11 +08:00
7fa744139d 添加自定义GPS位置支持,通过读取文件获取经纬度信息 2025-09-19 00:28:02 +08:00
Ziyang Zhou
a5c70c0dd8 refine sdcard for android-10.0.0_r47 2025-09-07 22:03:59 +08:00
Ziyang Zhou
b5bef4a5e6 support android-16.0.0_r2 2025-09-07 21:48:56 +08:00
Ziyang Zhou
6bd995c1d8 remove patches for cpu / cpuacct cgroup mount
should place those instructions under vendor impl
2025-06-19 21:10:35 +08:00
Ziyang Zhou
4236e3753f android-14.0.0_r75: OMX fix 2025-06-15 22:16:30 +08:00
Ziyang Zhou
2f056e6c18 support android-14.0.0_r75 2025-06-15 21:44:49 +08:00
Ziyang Zhou
80068271cd support android-15.0.0_r36 2025-06-15 19:33:47 +08:00
Ziyang Zhou
142755f1b4 support android-15.0.0_r1 2024-09-05 20:42:56 +08:00
Ziyang Zhou
4c18f31f2c support android-14.0.0_r45 2024-05-27 21:08:51 +08:00
Ziyang Zhou
a36e885cd4 8.1.0_r81 tweak lmkd 2024-05-27 21:07:03 +08:00
Ziyang Zhou
754cb80d35 refine apply patches script 2024-05-19 17:25:32 +08:00
Ziyang Zhou
67791923f8 add android-14.0.0_r21 2024-01-26 20:05:19 +08:00
Ziyang Zhou
24b5fd2353 add art patch for android P 2023-11-23 21:11:24 +08:00
Ziyang Zhou
f2d5949983 add android-13.0.0_r83 2023-11-13 20:24:17 +08:00
Ziyang Zhou
4c2b313d51 add android-12.0.0_r34 2023-11-13 20:24:07 +08:00
Ziyang Zhou
34db07fe6d add android-14.0.0_r11/r15 2023-11-13 19:56:58 +08:00
Ziyang Zhou
303d8a20e3 fix cgroup v2 for redroid-14.0.0 2023-11-13 19:56:38 +08:00
Ziyang Zhou
f1da778529 add libpsi to redroid-9.0.0 2023-11-13 19:55:54 +08:00
Ziyang Zhou
a2a7be2ddb add libpsi to redroid-8.1.0 2023-11-13 19:55:41 +08:00
Ziyang Zhou
92029ba800 android-10.0.0_r47 add clang prebuilts patch 2023-10-25 15:59:16 +08:00
127 changed files with 36439 additions and 219 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,16 +1,16 @@
From 9a5bad549330a4f1f8cfc35a0e2e5e34c826ab06 Mon Sep 17 00:00:00 2001
From 4173a1b73e4d6290ecb5cf214df24849f373c6e8 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 2/7] bring back fuse
Subject: bring back fuse
---
sdcard/Android.bp | 17 -
sdcard/Android.mk | 13 +
sdcard/OWNERS | 1 -
sdcard/fuse.cpp | 1476 +++++++++++++++++++++++++++++++++++++++++++++
sdcard/fuse.h | 209 +++++++
sdcard/sdcard.cpp | 429 +++++++++----
6 files changed, 2021 insertions(+), 124 deletions(-)
sdcard/fuse.cpp | 1479 +++++++++++++++++++++++++++++++++++++++++++++
sdcard/fuse.h | 210 +++++++
sdcard/sdcard.cpp | 443 ++++++++++----
6 files changed, 2040 insertions(+), 123 deletions(-)
delete mode 100644 sdcard/Android.bp
create mode 100644 sdcard/Android.mk
delete mode 100644 sdcard/OWNERS
@@ -19,7 +19,7 @@ Subject: [PATCH 2/7] bring back fuse
diff --git a/sdcard/Android.bp b/sdcard/Android.bp
deleted file mode 100644
index c096587ba..000000000
index c096587..0000000
--- a/sdcard/Android.bp
+++ /dev/null
@@ -1,17 +0,0 @@
@@ -42,7 +42,7 @@ index c096587ba..000000000
-}
diff --git a/sdcard/Android.mk b/sdcard/Android.mk
new file mode 100644
index 000000000..0c5857462
index 0000000..0c58574
--- /dev/null
+++ b/sdcard/Android.mk
@@ -0,0 +1,13 @@
@@ -61,17 +61,17 @@ index 000000000..0c5857462
+include $(BUILD_EXECUTABLE)
diff --git a/sdcard/OWNERS b/sdcard/OWNERS
deleted file mode 100644
index 199a0f885..000000000
index 199a0f8..0000000
--- a/sdcard/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-drosen@google.com
diff --git a/sdcard/fuse.cpp b/sdcard/fuse.cpp
new file mode 100644
index 000000000..95559d7ff
index 0000000..05c6bfe
--- /dev/null
+++ b/sdcard/fuse.cpp
@@ -0,0 +1,1476 @@
@@ -0,0 +1,1479 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
@@ -917,6 +917,9 @@ index 000000000..95559d7ff
+ if (fuse != fuse->global->fuse_write) {
+ fuse_notify_delete(fuse->global->fuse_write, parent_node->nid, child_node->nid, name);
+ }
+ if (fuse != fuse->global->fuse_full) {
+ fuse_notify_delete(fuse->global->fuse_full, parent_node->nid, child_node->nid, name);
+ }
+ }
+ return 0;
+}
@@ -1550,10 +1553,10 @@ index 000000000..95559d7ff
+}
diff --git a/sdcard/fuse.h b/sdcard/fuse.h
new file mode 100644
index 000000000..9ccd21dc4
index 0000000..b4c2bb1
--- /dev/null
+++ b/sdcard/fuse.h
@@ -0,0 +1,209 @@
@@ -0,0 +1,210 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
@@ -1732,6 +1735,7 @@ index 000000000..9ccd21dc4
+ struct fuse* fuse_default;
+ struct fuse* fuse_read;
+ struct fuse* fuse_write;
+ struct fuse* fuse_full;
+};
+
+/* Single FUSE mount */
@@ -1764,7 +1768,7 @@ index 000000000..9ccd21dc4
+
+#endif /* FUSE_H_ */
diff --git a/sdcard/sdcard.cpp b/sdcard/sdcard.cpp
index 2b358197a..0cfac382a 100644
index 2b35819..0c9f343 100644
--- a/sdcard/sdcard.cpp
+++ b/sdcard/sdcard.cpp
@@ -27,7 +27,6 @@
@@ -1970,7 +1974,7 @@ index 2b358197a..0cfac382a 100644
static void drop_privs(uid_t uid, gid_t gid) {
ScopedMinijail j(minijail_new());
@@ -98,35 +205,144 @@ static void drop_privs(uid_t uid, gid_t gid) {
@@ -98,35 +205,157 @@ static void drop_privs(uid_t uid, gid_t gid) {
minijail_enter(j.get());
}
@@ -2002,20 +2006,25 @@ index 2b358197a..0cfac382a 100644
+ struct fuse fuse_default;
+ struct fuse fuse_read;
+ struct fuse fuse_write;
+ struct fuse fuse_full;
+ struct fuse_handler handler_default;
+ struct fuse_handler handler_read;
+ struct fuse_handler handler_write;
+ struct fuse_handler handler_full;
+ pthread_t thread_default;
+ pthread_t thread_read;
+ pthread_t thread_write;
+ pthread_t thread_full;
+
+ memset(&global, 0, sizeof(global));
+ memset(&fuse_default, 0, sizeof(fuse_default));
+ memset(&fuse_read, 0, sizeof(fuse_read));
+ memset(&fuse_write, 0, sizeof(fuse_write));
+ memset(&fuse_full, 0, sizeof(fuse_full));
+ memset(&handler_default, 0, sizeof(handler_default));
+ memset(&handler_read, 0, sizeof(handler_read));
+ memset(&handler_write, 0, sizeof(handler_write));
+ memset(&handler_full, 0, sizeof(handler_full));
+
+ pthread_mutex_init(&global.lock, NULL);
+ global.package_to_appid = new AppIdMap;
@@ -2047,22 +2056,27 @@ index 2b358197a..0cfac382a 100644
+ fuse_default.global = &global;
+ fuse_read.global = &global;
+ fuse_write.global = &global;
+ fuse_full.global = &global;
+
+ global.fuse_default = &fuse_default;
+ global.fuse_read = &fuse_read;
+ global.fuse_write = &fuse_write;
+ global.fuse_full = &fuse_full;
+
+ snprintf(fuse_default.dest_path, PATH_MAX, "/mnt/runtime/default/%s", label);
+ snprintf(fuse_read.dest_path, PATH_MAX, "/mnt/runtime/read/%s", label);
+ snprintf(fuse_write.dest_path, PATH_MAX, "/mnt/runtime/write/%s", label);
+ snprintf(fuse_full.dest_path, PATH_MAX, "/mnt/runtime/full/%s", label);
+
+ handler_default.fuse = &fuse_default;
+ handler_read.fuse = &fuse_read;
+ handler_write.fuse = &fuse_write;
+ handler_full.fuse = &fuse_full;
+
+ handler_default.token = 0;
+ handler_read.token = 1;
+ handler_write.token = 2;
+ handler_full.token = 3;
+
+ umask(0);
+
@@ -2071,7 +2085,8 @@ index 2b358197a..0cfac382a 100644
+ * permissions are completely masked off. */
+ if (fuse_setup(&fuse_default, AID_SDCARD_RW, 0006)
+ || fuse_setup(&fuse_read, AID_EVERYBODY, 0027)
+ || fuse_setup(&fuse_write, AID_EVERYBODY, full_write ? 0007 : 0027)) {
+ || fuse_setup(&fuse_write, AID_EVERYBODY, full_write ? 0007 : 0027)
+ || fuse_setup(&fuse_full, AID_EVERYBODY, 0007)) {
+ PLOG(FATAL) << "failed to fuse_setup";
+ }
+ } else {
@@ -2080,7 +2095,8 @@ index 2b358197a..0cfac382a 100644
+ * deep inside attr_from_stat(). */
+ if (fuse_setup(&fuse_default, AID_SDCARD_RW, 0006)
+ || fuse_setup(&fuse_read, AID_EVERYBODY, full_write ? 0027 : 0022)
+ || fuse_setup(&fuse_write, AID_EVERYBODY, full_write ? 0007 : 0022)) {
+ || fuse_setup(&fuse_write, AID_EVERYBODY, full_write ? 0007 : 0022)
+ || fuse_setup(&fuse_full, AID_EVERYBODY, 0007)) {
+ PLOG(FATAL) << "failed to fuse_setup";
}
+ }
@@ -2099,7 +2115,8 @@ index 2b358197a..0cfac382a 100644
- PLOG(WARNING) << "Failed to mount sdcardfs with options " << opts;
+ if (pthread_create(&thread_default, NULL, start_handler, &handler_default)
+ || pthread_create(&thread_read, NULL, start_handler, &handler_read)
+ || pthread_create(&thread_write, NULL, start_handler, &handler_write)) {
+ || pthread_create(&thread_write, NULL, start_handler, &handler_write)
+ || pthread_create(&thread_full, NULL, start_handler, &handler_full)) {
+ LOG(FATAL) << "failed to pthread_create";
+ }
+
@@ -2139,7 +2156,7 @@ index 2b358197a..0cfac382a 100644
}
static bool sdcardfs_setup_bind_remount(const std::string& source_path, const std::string& dest_path,
@@ -150,43 +366,22 @@ static bool sdcardfs_setup_bind_remount(const std::string& source_path, const st
@@ -150,22 +379,9 @@ static bool sdcardfs_setup_bind_remount(const std::string& source_path, const st
return true;
}
@@ -2163,10 +2180,7 @@ index 2b358197a..0cfac382a 100644
std::string dest_path_default = "/mnt/runtime/default/" + label;
std::string dest_path_read = "/mnt/runtime/read/" + label;
std::string dest_path_write = "/mnt/runtime/write/" + label;
- std::string dest_path_full = "/mnt/runtime/full/" + label;
umask(0);
if (multi_user) {
@@ -176,17 +392,11 @@ static void run_sdcardfs(const std::string& source_path, const std::string& labe
// Multi-user storage is fully isolated per user, so "other"
// permissions are completely masked off.
if (!sdcardfs_setup(source_path, dest_path_default, uid, gid, multi_user, userid,
@@ -2184,11 +2198,12 @@ index 2b358197a..0cfac382a 100644
+ AID_SDCARD_RW, 0006, derive_gid) ||
+ !sdcardfs_setup_bind_remount(dest_path_default, dest_path_read, AID_EVERYBODY, 0027) ||
+ !sdcardfs_setup_bind_remount(dest_path_default, dest_path_write, AID_EVERYBODY,
+ full_write ? 0007 : 0027)) {
+ full_write ? 0007 : 0027) ||
+ !sdcardfs_setup_bind_remount(dest_path_default, dest_path_full, AID_EVERYBODY, 0007)) {
LOG(FATAL) << "failed to sdcardfs_setup";
}
} else {
@@ -194,17 +389,11 @@ static void run_sdcardfs(const std::string& source_path, const std::string& labe
@@ -194,17 +404,12 @@ static void run_sdcardfs(const std::string& source_path, const std::string& labe
// the Android directories are masked off to a single user
// deep inside attr_from_stat().
if (!sdcardfs_setup(source_path, dest_path_default, uid, gid, multi_user, userid,
@@ -2207,11 +2222,12 @@ index 2b358197a..0cfac382a 100644
+ !sdcardfs_setup_bind_remount(dest_path_default, dest_path_read, AID_EVERYBODY,
+ full_write ? 0027 : 0022) ||
+ !sdcardfs_setup_bind_remount(dest_path_default, dest_path_write, AID_EVERYBODY,
+ full_write ? 0007 : 0022)) {
+ full_write ? 0007 : 0022) ||
+ !sdcardfs_setup_bind_remount(dest_path_default, dest_path_full, AID_EVERYBODY, 0007)) {
LOG(FATAL) << "failed to sdcardfs_setup";
}
}
@@ -220,6 +409,41 @@ static void run_sdcardfs(const std::string& source_path, const std::string& labe
@@ -220,6 +425,41 @@ static void run_sdcardfs(const std::string& source_path, const std::string& labe
exit(0);
}
@@ -2253,7 +2269,7 @@ index 2b358197a..0cfac382a 100644
static int usage() {
LOG(ERROR) << "usage: sdcard [OPTIONS] <source_path> <label>"
<< " -u: specify UID to run as"
@@ -227,8 +451,7 @@ static int usage() {
@@ -227,8 +467,7 @@ static int usage() {
<< " -U: specify user ID that owns device"
<< " -m: source_path is multi-user"
<< " -w: runtime write mount has full write access"
@@ -2263,7 +2279,7 @@ index 2b358197a..0cfac382a 100644
return 1;
}
@@ -241,15 +464,10 @@ int main(int argc, char **argv) {
@@ -241,15 +480,10 @@ int main(int argc, char **argv) {
bool multi_user = false;
bool full_write = false;
bool derive_gid = false;
@@ -2279,7 +2295,7 @@ index 2b358197a..0cfac382a 100644
int opt;
while ((opt = getopt(argc, argv, "u:g:U:mwGio")) != -1) {
switch (opt) {
@@ -272,14 +490,10 @@ int main(int argc, char **argv) {
@@ -272,14 +506,10 @@ int main(int argc, char **argv) {
derive_gid = true;
break;
case 'i':
@@ -2294,7 +2310,7 @@ index 2b358197a..0cfac382a 100644
return usage();
}
}
@@ -320,7 +534,10 @@ int main(int argc, char **argv) {
@@ -320,7 +550,10 @@ int main(int argc, char **argv) {
sleep(1);
}
@@ -2308,5 +2324,5 @@ index 2b358197a..0cfac382a 100644
return 1;
}
--
2.34.1
2.49.0

View File

@@ -1,28 +0,0 @@
From 7a3d9447f2c12e00b07acafacdabe798edf351eb Mon Sep 17 00:00:00 2001
From: John Tung <watchnight@163.com>
Date: Sun, 21 Aug 2022 11:22:48 +0800
Subject: [PATCH 7/7] fix cpu cgroup mount
---
libprocessgroup/setup/cgroup_map_write.cpp | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/libprocessgroup/setup/cgroup_map_write.cpp b/libprocessgroup/setup/cgroup_map_write.cpp
index 17ea06e09..c25bf302a 100644
--- a/libprocessgroup/setup/cgroup_map_write.cpp
+++ b/libprocessgroup/setup/cgroup_map_write.cpp
@@ -217,6 +217,11 @@ static bool SetupCgroup(const CgroupDescriptor& descriptor) {
result = mount("none", controller->path(), "cgroup", MS_NODEV | MS_NOEXEC | MS_NOSUID,
controller->name());
}
+ if (result < 0 && (!strcmp(controller->name(), "cpu")
+ || !strcmp(controller->name(), "cpuacct"))) {
+ result = mount("none", controller->path(), "cgroup", MS_NODEV | MS_NOEXEC | MS_NOSUID,
+ "cpu,cpuacct");
+ }
}
if (result < 0) {
--
2.34.1

View File

@@ -0,0 +1,40 @@
From 378c66a1d3f20659ed1df5a51188fe48eb604b80 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sun, 9 May 2021 23:27:12 +0800
Subject: fix sdcard
---
main.cpp | 1 +
model/EmulatedVolume.cpp | 2 ++
2 files changed, 3 insertions(+)
diff --git a/main.cpp b/main.cpp
index 27a701b..aca9cac 100644
--- a/main.cpp
+++ b/main.cpp
@@ -53,6 +53,7 @@ using android::base::StringPrintf;
using android::fs_mgr::ReadDefaultFstab;
int main(int argc, char** argv) {
+ signal(SIGCHLD, SIG_IGN); // ignore sdcard child
atrace_set_tracing_enabled(false);
setenv("ANDROID_LOG_TAGS", "*:d", 1); // Do not submit with verbose logs enabled
android::base::InitLogging(argv, android::base::LogdLogger(android::base::SYSTEM));
diff --git a/model/EmulatedVolume.cpp b/model/EmulatedVolume.cpp
index 552fe2f..e03e5d2 100644
--- a/model/EmulatedVolume.cpp
+++ b/model/EmulatedVolume.cpp
@@ -119,8 +119,10 @@ status_t EmulatedVolume::doMount() {
}
}
/* sdcardfs will have exited already. FUSE will still be running */
+ #if 0 // HACKED
TEMP_FAILURE_RETRY(waitpid(mFusePid, nullptr, 0));
mFusePid = 0;
+ #endif
return OK;
}
--
2.49.0

View File

@@ -1,28 +0,0 @@
From 17a19be89f85e2d03123f9eb5661b397a78a1a63 Mon Sep 17 00:00:00 2001
From: Tung <john@example.com>
Date: Fri, 19 Aug 2022 10:07:23 +0800
Subject: [PATCH 6/7] mount cpuacct and cpu together
---
libprocessgroup/setup/cgroup_map_write.cpp | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/libprocessgroup/setup/cgroup_map_write.cpp b/libprocessgroup/setup/cgroup_map_write.cpp
index 25f16a6e9..9ef9c1105 100644
--- a/libprocessgroup/setup/cgroup_map_write.cpp
+++ b/libprocessgroup/setup/cgroup_map_write.cpp
@@ -291,6 +291,11 @@ static bool SetupCgroup(const CgroupDescriptor& descriptor) {
result = mount("none", controller->path(), "cgroup", MS_NODEV | MS_NOEXEC | MS_NOSUID,
controller->name());
}
+ if (result < 0 && (!strcmp(controller->name(), "cpu")
+ || !strcmp(controller->name(), "cpuacct"))) {
+ result = mount("none", controller->path(), "cgroup", MS_NODEV | MS_NOEXEC | MS_NOSUID,
+ "cpu,cpuacct");
+ }
}
if (result < 0) {
--
2.34.1

View File

@@ -1,28 +0,0 @@
From b142c7c0ce2d63422932b7d9bf912c7240f8a025 Mon Sep 17 00:00:00 2001
From: John Tung <watchnight@163.com>
Date: Sun, 21 Aug 2022 11:23:33 +0800
Subject: [PATCH 7/8] fix cpu cgroup mount
---
libprocessgroup/setup/cgroup_map_write.cpp | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/libprocessgroup/setup/cgroup_map_write.cpp b/libprocessgroup/setup/cgroup_map_write.cpp
index 3121d244b..bb15e4f6d 100644
--- a/libprocessgroup/setup/cgroup_map_write.cpp
+++ b/libprocessgroup/setup/cgroup_map_write.cpp
@@ -309,6 +309,11 @@ static bool SetupCgroup(const CgroupDescriptor& descriptor) {
result = mount("none", controller->path(), "cgroup", MS_NODEV | MS_NOEXEC | MS_NOSUID,
controller->name());
}
+ if (result < 0 && (!strcmp(controller->name(), "cpu")
+ || !strcmp(controller->name(), "cpuacct"))) {
+ result = mount("none", controller->path(), "cgroup", MS_NODEV | MS_NOEXEC | MS_NOSUID,
+ "cpu,cpuacct");
+ }
}
if (result < 0) {
--
2.34.1

1
android-12.0.0_r34 Symbolic link
View File

@@ -0,0 +1 @@
android-12.0.0_r32

View File

@@ -1,29 +0,0 @@
From 034e45234b3ad1e44ac4f23314e0ef36b67e36bd Mon Sep 17 00:00:00 2001
From: John Tung <watchnight@163.com>
Date: Sun, 21 Aug 2022 11:24:11 +0800
Subject: [PATCH 7/8] fix cpu cgroup mount, possible need mount cpuacct and cpu
together
---
libprocessgroup/setup/cgroup_map_write.cpp | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/libprocessgroup/setup/cgroup_map_write.cpp b/libprocessgroup/setup/cgroup_map_write.cpp
index 3831ef20a..80fa6a157 100644
--- a/libprocessgroup/setup/cgroup_map_write.cpp
+++ b/libprocessgroup/setup/cgroup_map_write.cpp
@@ -324,6 +324,11 @@ static bool SetupCgroup(const CgroupDescriptor& descriptor) {
result = mount("none", controller->path(), "cgroup", MS_NODEV | MS_NOEXEC | MS_NOSUID,
controller->name());
}
+ if (result < 0 && (!strcmp(controller->name(), "cpu")
+ || !strcmp(controller->name(), "cpuacct"))) {
+ result = mount("none", controller->path(), "cgroup", MS_NODEV | MS_NOEXEC | MS_NOSUID,
+ "cpu,cpuacct");
+ }
}
if (result < 0) {
--
2.34.1

1
android-13.0.0_r83 Symbolic link
View File

@@ -0,0 +1 @@
android-13.0.0_r82

1
android-14.0.0_r11 Symbolic link
View File

@@ -0,0 +1 @@
android-14.0.0_r2

1
android-14.0.0_r15 Symbolic link
View File

@@ -0,0 +1 @@
android-14.0.0_r2

View File

@@ -0,0 +1,25 @@
From 128cf1db2fa2ae4124c016f4d577ba80cda27ea5 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sat, 11 Nov 2023 10:30:11 +0800
Subject: [PATCH] ignore cgroup error
---
services/core/java/com/android/server/am/ProcessList.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/services/core/java/com/android/server/am/ProcessList.java b/services/core/java/com/android/server/am/ProcessList.java
index c5776d822..fbae6b845 100644
--- a/services/core/java/com/android/server/am/ProcessList.java
+++ b/services/core/java/com/android/server/am/ProcessList.java
@@ -2437,7 +2437,7 @@ public final class ProcessList {
"Unable to create process group for "
+ app.processName + " (" + startResult.pid + ")");
} else {
- throw new AssertionError("Unable to create process group for "
+ Slog.e(ActivityManagerService.TAG, "Unable to create process group for "
+ app.processName + " (" + startResult.pid + ")");
}
} else {
--
2.34.1

1
android-14.0.0_r21 Symbolic link
View File

@@ -0,0 +1 @@
android-14.0.0_r2

View File

@@ -0,0 +1,32 @@
From 573a6eb815e1c3a077cf7c2dc27cc3be93702025 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 bb60904..efe8be2 100644
--- a/libminijail.c
+++ b/libminijail.c
@@ -2487,6 +2487,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 ||
j->flags.seccomp_filter_allow_speculation) {
@@ -2508,6 +2509,7 @@ static void set_seccomp_filter(const struct minijail *j)
}
}
}
+#endif
}
static pid_t forward_pid = -1;
--
2.45.1

View File

@@ -0,0 +1,165 @@
From c57cf20c9992eac4d53889e4af6889a66d267683 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sun, 9 May 2021 23:44:12 +0800
Subject: [PATCH] ignore selinux
---
libselinux/include/selinux/selinux.h | 4 ++++
libselinux/src/checkAccess.c | 1 +
libselinux/src/getenforce.c | 1 +
libselinux/src/getfilecon.c | 1 +
libselinux/src/getpeercon.c | 1 +
libselinux/src/init.c | 1 +
libselinux/src/label.c | 1 +
libselinux/src/lgetfilecon.c | 1 +
libselinux/src/lsetfilecon.c | 1 +
libselinux/src/procattr.c | 2 ++
libselinux/src/sestatus.c | 1 +
11 files changed, 15 insertions(+)
diff --git a/libselinux/include/selinux/selinux.h b/libselinux/include/selinux/selinux.h
index a094885..3ddeee2 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/checkAccess.c b/libselinux/src/checkAccess.c
index 022cd6b..a23bffc 100644
--- a/libselinux/src/checkAccess.c
+++ b/libselinux/src/checkAccess.c
@@ -20,6 +20,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 3f1e200..bf16227 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/getfilecon.c b/libselinux/src/getfilecon.c
index 4bee313..f8b159a 100644
--- a/libselinux/src/getfilecon.c
+++ b/libselinux/src/getfilecon.c
@@ -52,6 +52,7 @@ int getfilecon_raw(const char *path, char ** context)
int getfilecon(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/getpeercon.c b/libselinux/src/getpeercon.c
index a9dca73..10771cb 100644
--- a/libselinux/src/getpeercon.c
+++ b/libselinux/src/getpeercon.c
@@ -46,6 +46,7 @@ int getpeercon_raw(int fd, char ** context)
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 439da41..41268a7 100644
--- a/libselinux/src/init.c
+++ b/libselinux/src/init.c
@@ -139,6 +139,7 @@ void fini_selinuxmnt(void)
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 e0ed68d..2c22c04 100644
--- a/libselinux/src/label.c
+++ b/libselinux/src/label.c
@@ -310,6 +310,7 @@ bool selabel_hash_all_partial_matches(struct selabel_handle *rec,
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 d1fb821..0d3b0ac 100644
--- a/libselinux/src/lgetfilecon.c
+++ b/libselinux/src/lgetfilecon.c
@@ -52,6 +52,7 @@ int lgetfilecon_raw(const char *path, char ** context)
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 213fb68..c73c152 100644
--- a/libselinux/src/lsetfilecon.c
+++ b/libselinux/src/lsetfilecon.c
@@ -28,6 +28,7 @@ int lsetfilecon_raw(const char *path, const char * context)
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 b7a93a2..a1478c7 100644
--- a/libselinux/src/procattr.c
+++ b/libselinux/src/procattr.c
@@ -175,6 +175,7 @@ static int getprocattrcon_raw(char **context, pid_t pid, const char *attr,
static int getprocattrcon(char **context, pid_t pid, const char *attr,
const char *prev_context)
{
+ se_hack1((*context = calloc(7, 1), memcpy(*context, "HACKED", 6), 0));
int ret;
char * rcontext;
@@ -239,6 +240,7 @@ out:
static int setprocattrcon(const char *context, const char *attr,
char **prev_context)
{
+ se_hack1(0);
int ret;
char * rcontext;
diff --git a/libselinux/src/sestatus.c b/libselinux/src/sestatus.c
index fbe6430..bafe6bb 100644
--- a/libselinux/src/sestatus.c
+++ b/libselinux/src/sestatus.c
@@ -277,6 +277,7 @@ static int fallback_cb_policyload(int policyload)
*/
int selinux_status_open(int fallback)
{
+ se_hack1(0);
int fd;
char path[PATH_MAX];
long pagesize;
--
2.45.1

View File

@@ -0,0 +1,48 @@
From 768da11e017c7d2d5f27b0aa9326f1d8211872c0 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Mon, 20 Sep 2021 18:22:20 +0000
Subject: [PATCH 1/2] ? workaround for mesa video playback
---
media/libstagefright/colorconversion/SoftwareRenderer.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/media/libstagefright/colorconversion/SoftwareRenderer.cpp b/media/libstagefright/colorconversion/SoftwareRenderer.cpp
index 2409315..1e3ec7b 100644
--- a/media/libstagefright/colorconversion/SoftwareRenderer.cpp
+++ b/media/libstagefright/colorconversion/SoftwareRenderer.cpp
@@ -130,6 +130,7 @@ void SoftwareRenderer::resetFormatIfChanged(
// 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:
@@ -139,6 +140,7 @@ void SoftwareRenderer::resetFormatIfChanged(
bufHeight = (mCropHeight + 1) & ~1;
break;
}
+#endif
case OMX_COLOR_Format24bitRGB888:
{
halFormat = HAL_PIXEL_FORMAT_RGB_888;
@@ -154,6 +156,7 @@ void SoftwareRenderer::resetFormatIfChanged(
bufHeight = (mCropHeight + 1) & ~1;
break;
}
+#if 0 // HACKED
case OMX_COLOR_FormatYUV420Planar16:
{
if (((dataSpace & HAL_DATASPACE_STANDARD_MASK) == HAL_DATASPACE_STANDARD_BT2020)
@@ -170,6 +173,7 @@ void SoftwareRenderer::resetFormatIfChanged(
bufHeight = (mCropHeight + 1) & ~1;
break;
}
+#endif
default:
{
break;
--
2.45.1

View File

@@ -0,0 +1,26 @@
From 9e2cd9acaca605e90a658a0c0c701fdafe88c505 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sat, 6 Aug 2022 10:17:12 +0800
Subject: [PATCH 2/2] NOT skip OMX nodes
users may use legacy kernel without `ION` / `DMABUF_HEAP` enabled,
enable OMX nodes to support this.
---
media/libstagefright/omx/OMXStore.cpp | 1 -
1 file changed, 1 deletion(-)
diff --git a/media/libstagefright/omx/OMXStore.cpp b/media/libstagefright/omx/OMXStore.cpp
index 0906433..8ea62b6 100644
--- a/media/libstagefright/omx/OMXStore.cpp
+++ b/media/libstagefright/omx/OMXStore.cpp
@@ -161,7 +161,6 @@ void OMXStore::addPlugin(OMXPluginBase *plugin) {
}
}
if (skip) {
- continue;
}
}
--
2.45.1

View File

@@ -0,0 +1,25 @@
From e5918c6bc9c3bb9192edbd16bae68f8e62de1f17 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sat, 11 Nov 2023 10:30:11 +0800
Subject: [PATCH] ignore cgroup error
---
services/core/java/com/android/server/am/ProcessList.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/services/core/java/com/android/server/am/ProcessList.java b/services/core/java/com/android/server/am/ProcessList.java
index b0f776043..96ff8e271 100644
--- a/services/core/java/com/android/server/am/ProcessList.java
+++ b/services/core/java/com/android/server/am/ProcessList.java
@@ -2438,7 +2438,7 @@ public final class ProcessList {
"Unable to create process group for "
+ app.processName + " (" + startResult.pid + ")");
} else {
- throw new AssertionError("Unable to create process group for "
+ Slog.e(ActivityManagerService.TAG, "Unable to create process group for "
+ app.processName + " (" + startResult.pid + ")");
}
} else {
--
2.45.1

View File

@@ -0,0 +1,51 @@
From 4f87c37f1ffa56f3b502373e29605bc2da4caed3 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sun, 9 May 2021 23:04:00 +0800
Subject: [PATCH] fix booting
---
libs/binder/Binder.cpp | 1 +
libs/binder/IPCThreadState.cpp | 2 +-
libs/binder/ProcessState.cpp | 1 +
3 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/libs/binder/Binder.cpp b/libs/binder/Binder.cpp
index 3e49656..8b91975 100644
--- a/libs/binder/Binder.cpp
+++ b/libs/binder/Binder.cpp
@@ -506,6 +506,7 @@ void BBinder::setRequestingSid(bool requestingSid)
"setRequestingSid() should not be called after a binder object "
"is parceled/sent to another process");
+ requestingSid = false; // HACKED
Extras* e = mExtras.load(std::memory_order_acquire);
if (!e) {
diff --git a/libs/binder/IPCThreadState.cpp b/libs/binder/IPCThreadState.cpp
index da58251..4a18b42 100644
--- a/libs/binder/IPCThreadState.cpp
+++ b/libs/binder/IPCThreadState.cpp
@@ -1393,7 +1393,7 @@ status_t IPCThreadState::executeCommand(int32_t cmd)
clearPropagateWorkSource();
mCallingPid = tr.sender_pid;
- mCallingSid = reinterpret_cast<const char*>(tr_secctx.secctx);
+ mCallingSid = "HACKED";
mCallingUid = tr.sender_euid;
mHasExplicitIdentity = false;
mLastTransactionBinderFlags = tr.flags;
diff --git a/libs/binder/ProcessState.cpp b/libs/binder/ProcessState.cpp
index 5f1f506..8c1e03d 100644
--- a/libs/binder/ProcessState.cpp
+++ b/libs/binder/ProcessState.cpp
@@ -214,6 +214,7 @@ bool ProcessState::becomeContextManager()
flat_binder_object obj {
.flags = FLAT_BINDER_FLAG_TXN_SECURITY_CTX,
};
+ obj.flags = 0; // HACKED
int result = ioctl(mDriverFD, BINDER_SET_CONTEXT_MGR_EXT, &obj);
--
2.45.1

View File

@@ -0,0 +1,24 @@
From a0c6134bf904e4a81a6782a8965f2de6280f86ec Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Thu, 5 Oct 2023 22:18:09 +0800
Subject: [PATCH] fix booting
---
service/jni/com_android_server_connectivity_ClatCoordinator.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/service/jni/com_android_server_connectivity_ClatCoordinator.cpp b/service/jni/com_android_server_connectivity_ClatCoordinator.cpp
index 059b716..79f5270 100644
--- a/service/jni/com_android_server_connectivity_ClatCoordinator.cpp
+++ b/service/jni/com_android_server_connectivity_ClatCoordinator.cpp
@@ -143,6 +143,7 @@ static void verifyClatPerms() {
return;
}
+ fatal = false; // HACKED
if (fatal) abort();
}
--
2.45.1

View File

@@ -0,0 +1,45 @@
From 37360b6c313bbf923479ef0950ff623dcabd93fe Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Thu, 5 Oct 2023 23:27:52 +0800
Subject: [PATCH] fix booting
---
bpfloader/BpfLoader.cpp | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/bpfloader/BpfLoader.cpp b/bpfloader/BpfLoader.cpp
index e53669a..98686c0 100644
--- a/bpfloader/BpfLoader.cpp
+++ b/bpfloader/BpfLoader.cpp
@@ -271,13 +271,15 @@ int main(int argc, char** argv) {
// BPF_JIT is required by R VINTF (which means 4.14/4.19/5.4 kernels),
// but 4.14/4.19 were released with P & Q, and only 5.4 is new in R+.
if (writeProcSysFile("/proc/sys/net/core/bpf_jit_enable", "1\n") &&
- android::bpf::isAtLeastKernelVersion(5, 4, 0)) return 1;
+ android::bpf::isAtLeastKernelVersion(5, 4, 0))
+ PLOG(ERROR) << "change /proc/sys/net/core/bpf_jit_enable to 1 failed";
// Enable JIT kallsyms export for privileged users only
// (Note: this (open) will fail with ENOENT 'No such file or directory' if
// kernel does not have CONFIG_HAVE_EBPF_JIT=y)
if (writeProcSysFile("/proc/sys/net/core/bpf_jit_kallsyms", "1\n") &&
- android::bpf::isAtLeastKernelVersion(5, 4, 0)) return 1;
+ android::bpf::isAtLeastKernelVersion(5, 4, 0))
+ PLOG(ERROR) << "change /proc/sys/net/core/bpf_jit_kallsyms to 1 failed";
// Create all the pin subdirectories
// (this must be done first to allow selinux_context and pin_subdir functionality,
@@ -302,8 +304,10 @@ int main(int argc, char** argv) {
ALOGE("If this triggers randomly, you might be hitting some memory allocation "
"problems or startup script race.");
ALOGE("--- DO NOT EXPECT SYSTEM TO BOOT SUCCESSFULLY ---");
+#if 0 // HACKED
sleep(20);
return 2;
+#endif
}
}
--
2.45.1

View File

@@ -0,0 +1,125 @@
From 9d4c31162db6e491c69f517d88f77a4ea5d100a6 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sun, 9 May 2021 23:09:00 +0800
Subject: [PATCH 1/6] fix booting
---
init/first_stage_init.cpp | 20 ++++++++++++++++----
init/service.cpp | 3 ++-
init/util.cpp | 3 ++-
rootdir/init.rc | 1 -
4 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/init/first_stage_init.cpp b/init/first_stage_init.cpp
index 107e99a..e6d9601 100644
--- a/init/first_stage_init.cpp
+++ b/init/first_stage_init.cpp
@@ -35,6 +35,7 @@
#include <android-base/chrono_utils.h>
#include <android-base/file.h>
#include <android-base/logging.h>
+#include <android-base/strings.h>
#include <modprobe/modprobe.h>
#include <private/android_filesystem_config.h>
@@ -243,6 +244,8 @@ int FirstStageMain(int argc, char** argv) {
CHECKCALL(mkdir("/dev/pts", 0755));
CHECKCALL(mkdir("/dev/socket", 0755));
CHECKCALL(mkdir("/dev/dm-user", 0755));
+ mount("/system/etc", "/etc", "none", MS_BIND, NULL); // cgroup fix
+ unshare(CLONE_NEWCGROUP);
CHECKCALL(mount("devpts", "/dev/pts", "devpts", 0, NULL));
#define MAKE_STR(x) __STRING(x)
CHECKCALL(mount("proc", "/proc", "proc", 0, "hidepid=2,gid=" MAKE_STR(AID_READPROC)));
@@ -306,7 +309,6 @@ int FirstStageMain(int argc, char** argv) {
for (const auto& [error_string, error_errno] : errors) {
LOG(ERROR) << error_string << " " << strerror(error_errno);
}
- LOG(FATAL) << "Init encountered errors starting first stage, aborting";
}
LOG(INFO) << "init first stage started!";
@@ -401,7 +403,7 @@ int FirstStageMain(int argc, char** argv) {
}
if (!DoFirstStageMount(!created_devices)) {
- LOG(FATAL) << "Failed to mount required partitions early ...";
+ LOG(ERROR) << "Failed to mount required partitions early ...";
}
struct stat new_root_info;
@@ -420,12 +422,22 @@ int FirstStageMain(int argc, char** argv) {
1);
const char* path = "/system/bin/init";
- const char* args[] = {path, "selinux_setup", nullptr};
+ std::vector<const char *> args = {path, "second_stage"};
+ std::string init_cmdline;
+ android::base::ReadFileToString("/proc/self/cmdline", &init_cmdline);
+ std::replace(init_cmdline.begin(), init_cmdline.end(), '\0', ' ');
+ auto cmd_vector = android::base::Split(android::base::Trim(init_cmdline), " ");
+ int i = 0;
+ for (const auto& entry : cmd_vector) {
+ if (i++ == 0) continue; // ignore first arg '/init'
+ args.push_back(entry.c_str());
+ }
+ args.push_back(nullptr);
auto fd = open("/dev/kmsg", O_WRONLY | O_CLOEXEC);
dup2(fd, STDOUT_FILENO);
dup2(fd, STDERR_FILENO);
close(fd);
- execv(path, const_cast<char**>(args));
+ 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/service.cpp b/init/service.cpp
index 35beaad..3bdf7c2 100644
--- a/init/service.cpp
+++ b/init/service.cpp
@@ -75,6 +75,7 @@ namespace android {
namespace init {
static Result<std::string> ComputeContextFromExecutable(const std::string& service_path) {
+ se_hack1("HACKED");
std::string computed_context;
char* raw_con = nullptr;
@@ -371,7 +372,7 @@ void Service::Reap(const siginfo_t& siginfo) {
if (!GetBoolProperty("init.svc_debug.no_fatal." + name_, false)) {
// Aborts into `fatal_reboot_target_'.
SetFatalRebootTarget(fatal_reboot_target_);
- LOG(FATAL) << "critical process '" << name_ << "' exited 4 times "
+ LOG(ERROR) << "critical process '" << name_ << "' exited 4 times "
<< exit_reason;
}
} else {
diff --git a/init/util.cpp b/init/util.cpp
index bc8ea6e..78d76a2 100644
--- a/init/util.cpp
+++ b/init/util.cpp
@@ -242,7 +242,8 @@ int wait_for_file(const char* filename, std::chrono::nanoseconds timeout) {
void ImportKernelCmdline(const std::function<void(const std::string&, const std::string&)>& 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 7da2646..5f804c2 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -571,7 +571,6 @@ on post-fs
# Once everything is setup, no need to modify /.
# The bind+remount combination allows this to work in containers.
- mount rootfs rootfs / remount bind ro nodev
# Mount default storage into root namespace
mount none /mnt/user/0 /storage bind rec
--
2.45.1

View File

@@ -0,0 +1,25 @@
From fb7bd87d3e1c8ed97bd08826ce3a2ef82534d7ea Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sat, 26 Jun 2021 05:42:24 +0000
Subject: [PATCH 2/6] allow override ro.* prop
---
init/property_service.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/init/property_service.cpp b/init/property_service.cpp
index 8da6982..2941834 100644
--- a/init/property_service.cpp
+++ b/init/property_service.cpp
@@ -1343,6 +1343,8 @@ static void ProcessKernelCmdline() {
ImportKernelCmdline([&](const std::string& key, const std::string& value) {
if (StartsWith(key, ANDROIDBOOT_PREFIX)) {
InitPropertySet("ro.boot." + key.substr(ANDROIDBOOT_PREFIX.size()), value);
+ } else if (StartsWith(key, "ro.")) {
+ InitPropertySet(key, value);
}
});
}
--
2.45.1

View File

@@ -0,0 +1,26 @@
From 88a52ef1d15aa88dfd683a966583024058989f88 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Fri, 25 Jun 2021 15:56:47 +0000
Subject: [PATCH 3/6] ignore input subsystem
---
rootdir/ueventd.rc | 3 ---
1 file changed, 3 deletions(-)
diff --git a/rootdir/ueventd.rc b/rootdir/ueventd.rc
index 0b7ffb8..1b6bdb6 100644
--- a/rootdir/ueventd.rc
+++ b/rootdir/ueventd.rc
@@ -12,9 +12,6 @@ subsystem drm
devname uevent_devpath
dirname /dev/dri
-subsystem input
- devname uevent_devpath
- dirname /dev/input
subsystem sound
devname uevent_devpath
--
2.45.1

View File

@@ -0,0 +1,24 @@
From 5c4529f23ce734eab2e0b3cd7333b3ced8671b9a 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] ignore devfs mount
---
init/first_stage_init.cpp | 1 -
1 file changed, 1 deletion(-)
diff --git a/init/first_stage_init.cpp b/init/first_stage_init.cpp
index e6d9601..dffe6aa 100644
--- a/init/first_stage_init.cpp
+++ b/init/first_stage_init.cpp
@@ -240,7 +240,6 @@ int FirstStageMain(int argc, char** argv) {
CHECKCALL(setenv("PATH", _PATH_DEFPATH, 1));
// 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.
- CHECKCALL(mount("tmpfs", "/dev", "tmpfs", MS_NOSUID, "mode=0755"));
CHECKCALL(mkdir("/dev/pts", 0755));
CHECKCALL(mkdir("/dev/socket", 0755));
CHECKCALL(mkdir("/dev/dm-user", 0755));
--
2.45.1

View File

@@ -0,0 +1,24 @@
From 73c1ef7817e3e46da124cff6012cdcdfbcecaeb5 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Thu, 6 Jan 2022 20:47:28 +0800
Subject: [PATCH 5/6] auto alloc binder devices
---
rootdir/init.rc | 1 +
1 file changed, 1 insertion(+)
diff --git a/rootdir/init.rc b/rootdir/init.rc
index 5f804c2..7791c60 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -251,6 +251,7 @@ on init
mkdir /dev/binderfs
mount binder binder /dev/binderfs stats=global
chmod 0755 /dev/binderfs
+ exec -- /vendor/bin/binder_alloc /dev/binderfs/binder-control binder hwbinder vndbinder
# Mount fusectl
mount fusectl none /sys/fs/fuse/connections
--
2.45.1

View File

@@ -0,0 +1,24 @@
From 1c484f8137389b641defd6e277dec13b6ee4440d Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sat, 2 Sep 2023 17:10:16 +0800
Subject: [PATCH 6/6] skip fusectl mount
---
rootdir/init.rc | 1 -
1 file changed, 1 deletion(-)
diff --git a/rootdir/init.rc b/rootdir/init.rc
index 7791c60..a66080e 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -254,7 +254,6 @@ on init
exec -- /vendor/bin/binder_alloc /dev/binderfs/binder-control binder hwbinder vndbinder
# Mount fusectl
- mount fusectl none /sys/fs/fuse/connections
symlink /dev/binderfs/binder /dev/binder
symlink /dev/binderfs/hwbinder /dev/hwbinder
--
2.45.1

View File

@@ -0,0 +1,45 @@
From 4f494de89e86983c02deaf22973dcd0d322c21f6 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sun, 9 May 2021 23:44:12 +0800
Subject: [PATCH] fix booting
---
Binder.cpp | 1 +
ProcessState.cpp | 3 +++
2 files changed, 4 insertions(+)
diff --git a/Binder.cpp b/Binder.cpp
index 6d26414..b657a0b 100644
--- a/Binder.cpp
+++ b/Binder.cpp
@@ -96,6 +96,7 @@ bool BHwBinder::isRequestingSid() {
}
void BHwBinder::setRequestingSid(bool requestingSid) {
+ requestingSid = false; // HACKED
Extras* e = mExtras.load(std::memory_order_acquire);
if (!e) {
diff --git a/ProcessState.cpp b/ProcessState.cpp
index c2284f8..de37ead 100644
--- a/ProcessState.cpp
+++ b/ProcessState.cpp
@@ -121,12 +121,15 @@ void ProcessState::becomeContextManager()
{
AutoMutex _l(mLock);
+#if 0 // HACKED (?)
flat_binder_object obj {
.flags = FLAT_BINDER_FLAG_TXN_SECURITY_CTX,
};
status_t result = ioctl(mDriverFD, BINDER_SET_CONTEXT_MGR_EXT, &obj);
+#endif
+ status_t result = 1;
// fallback to original method
if (result != 0) {
android_errorWriteLog(0x534e4554, "121035042");
--
2.45.1

View File

@@ -0,0 +1,24 @@
From 7cb9a8fcd79c26557197b7f6af8e1c72de362c66 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 77b28b9..fccceed 100644
--- a/VintfObject.cpp
+++ b/VintfObject.cpp
@@ -713,7 +713,6 @@ int32_t VintfObject::checkCompatibility(std::string* error, CheckFlags::Type fla
error->insert(0,
"Runtime info and framework compatibility matrix are incompatible: ");
}
- return INCOMPATIBLE;
}
}
--
2.45.1

View File

@@ -0,0 +1,50 @@
From 6194d00fe6cc032889f5c28fcc963cf684273f77 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sat, 31 Jul 2021 06:14:33 +0000
Subject: [PATCH 1/3] ignore iptables error
---
server/BandwidthController.cpp | 1 +
server/Controllers.cpp | 1 -
server/IptablesRestoreController.cpp | 1 +
3 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/server/BandwidthController.cpp b/server/BandwidthController.cpp
index 438dbb8..8a4ffec 100644
--- a/server/BandwidthController.cpp
+++ b/server/BandwidthController.cpp
@@ -541,6 +541,7 @@ int BandwidthController::updateQuota(const std::string& quotaName, int64_t bytes
if (!isOk(file)) {
int res = errno;
ALOGE("Updating quota %s failed (%s)", quotaName.c_str(), toString(file).c_str());
+ res = 0; // HACKED
return -res;
}
// TODO: should we propagate this error?
diff --git a/server/Controllers.cpp b/server/Controllers.cpp
index 43a2d1e..4eafb11 100644
--- a/server/Controllers.cpp
+++ b/server/Controllers.cpp
@@ -284,7 +284,6 @@ void Controllers::init() {
// As such simply exit netd. This may crash loop the system, but by failing
// to bootup we will trigger rollback and thus this offers us protection against
// a mainline update breaking things.
- exit(1);
}
gLog.info("Enabling bandwidth control: %" PRId64 "us", s.getTimeAndResetUs());
diff --git a/server/IptablesRestoreController.cpp b/server/IptablesRestoreController.cpp
index dc71830..160350c 100644
--- a/server/IptablesRestoreController.cpp
+++ b/server/IptablesRestoreController.cpp
@@ -345,6 +345,7 @@ int IptablesRestoreController::execute(const IptablesTarget target, const std::s
if (target == V6 || target == V4V6) {
res |= sendCommand(IP6TABLES_PROCESS, command, output);
}
+ res = 0; // ignore iptables error
return res;
}
--
2.45.1

View File

@@ -0,0 +1,24 @@
From cd7cf127d84ae64a3bfcf5a09d2c7af4f6f4dfd4 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sun, 14 Aug 2022 11:53:19 +0800
Subject: [PATCH 2/3] ignore bpf error
---
server/main.cpp | 1 -
1 file changed, 1 deletion(-)
diff --git a/server/main.cpp b/server/main.cpp
index 3c6b0d5..7f84589 100644
--- a/server/main.cpp
+++ b/server/main.cpp
@@ -147,7 +147,6 @@ int main() {
if (libnetd_updatable_init(cg2_path.c_str())) {
ALOGE("libnetd_updatable_init failed");
- exit(1);
}
gLog.info("libnetd_updatable_init success");
--
2.45.1

View File

@@ -0,0 +1,28 @@
From fb8fb052b6b5664da5f8cb551cfb9cb8379cfbc0 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sun, 14 Aug 2022 11:57:11 +0800
Subject: [PATCH 3/3] ignote getTetherStats error
---
server/TetherController.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/server/TetherController.cpp b/server/TetherController.cpp
index 7919357..826ef43 100644
--- a/server/TetherController.cpp
+++ b/server/TetherController.cpp
@@ -917,9 +917,11 @@ StatusOr<TetherController::TetherStatsList> TetherController::getTetherStats() {
}
if (int ret = addForwardChainStats(statsList, statsString, parsedIptablesOutput)) {
+#if 0
return statusFromErrno(-ret, StringPrintf("failed to parse %s tether stats:\n%s",
target == V4 ? "IPv4": "IPv6",
parsedIptablesOutput.c_str()));
+#endif
}
}
--
2.45.1

View File

@@ -0,0 +1,24 @@
From d4a5b68297cb7595826bd92c6468bdbf136db13b Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sat, 6 Aug 2022 10:19:11 +0800
Subject: [PATCH] ignore project quota error
---
Utils.cpp | 1 -
1 file changed, 1 deletion(-)
diff --git a/Utils.cpp b/Utils.cpp
index 40a182b..30527c6 100644
--- a/Utils.cpp
+++ b/Utils.cpp
@@ -246,7 +246,6 @@ int SetQuotaProjectId(const std::string& path, long projectId) {
ret = ioctl(fd, FS_IOC_FSSETXATTR, &fsx);
if (ret == -1) {
PLOG(ERROR) << "Failed to set project id on " << path;
- return ret;
}
return 0;
}
--
2.45.1

View File

@@ -0,0 +1,32 @@
From 7ce93a65d3ec48d465a1659f360f5fc5cbc05171 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 bb60904..efe8be2 100644
--- a/libminijail.c
+++ b/libminijail.c
@@ -2487,6 +2487,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 ||
j->flags.seccomp_filter_allow_speculation) {
@@ -2508,6 +2509,7 @@ static void set_seccomp_filter(const struct minijail *j)
}
}
}
+#endif
}
static pid_t forward_pid = -1;
--
2.49.0

View File

@@ -0,0 +1,165 @@
From 5fb822b4cad95ee5cd97eb0bc7170fdcb407dfbb Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sun, 9 May 2021 23:44:12 +0800
Subject: [PATCH] ignore selinux
---
libselinux/include/selinux/selinux.h | 4 ++++
libselinux/src/checkAccess.c | 1 +
libselinux/src/getenforce.c | 1 +
libselinux/src/getfilecon.c | 1 +
libselinux/src/getpeercon.c | 1 +
libselinux/src/init.c | 1 +
libselinux/src/label.c | 1 +
libselinux/src/lgetfilecon.c | 1 +
libselinux/src/lsetfilecon.c | 1 +
libselinux/src/procattr.c | 2 ++
libselinux/src/sestatus.c | 1 +
11 files changed, 15 insertions(+)
diff --git a/libselinux/include/selinux/selinux.h b/libselinux/include/selinux/selinux.h
index a094885..3ddeee2 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/checkAccess.c b/libselinux/src/checkAccess.c
index 022cd6b..a23bffc 100644
--- a/libselinux/src/checkAccess.c
+++ b/libselinux/src/checkAccess.c
@@ -20,6 +20,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 3f1e200..bf16227 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/getfilecon.c b/libselinux/src/getfilecon.c
index 4bee313..f8b159a 100644
--- a/libselinux/src/getfilecon.c
+++ b/libselinux/src/getfilecon.c
@@ -52,6 +52,7 @@ int getfilecon_raw(const char *path, char ** context)
int getfilecon(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/getpeercon.c b/libselinux/src/getpeercon.c
index a9dca73..10771cb 100644
--- a/libselinux/src/getpeercon.c
+++ b/libselinux/src/getpeercon.c
@@ -46,6 +46,7 @@ int getpeercon_raw(int fd, char ** context)
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 439da41..41268a7 100644
--- a/libselinux/src/init.c
+++ b/libselinux/src/init.c
@@ -139,6 +139,7 @@ void fini_selinuxmnt(void)
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 e0ed68d..2c22c04 100644
--- a/libselinux/src/label.c
+++ b/libselinux/src/label.c
@@ -310,6 +310,7 @@ bool selabel_hash_all_partial_matches(struct selabel_handle *rec,
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 d1fb821..0d3b0ac 100644
--- a/libselinux/src/lgetfilecon.c
+++ b/libselinux/src/lgetfilecon.c
@@ -52,6 +52,7 @@ int lgetfilecon_raw(const char *path, char ** context)
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 213fb68..c73c152 100644
--- a/libselinux/src/lsetfilecon.c
+++ b/libselinux/src/lsetfilecon.c
@@ -28,6 +28,7 @@ int lsetfilecon_raw(const char *path, const char * context)
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 b7a93a2..a1478c7 100644
--- a/libselinux/src/procattr.c
+++ b/libselinux/src/procattr.c
@@ -175,6 +175,7 @@ static int getprocattrcon_raw(char **context, pid_t pid, const char *attr,
static int getprocattrcon(char **context, pid_t pid, const char *attr,
const char *prev_context)
{
+ se_hack1((*context = calloc(7, 1), memcpy(*context, "HACKED", 6), 0));
int ret;
char * rcontext;
@@ -239,6 +240,7 @@ out:
static int setprocattrcon(const char *context, const char *attr,
char **prev_context)
{
+ se_hack1(0);
int ret;
char * rcontext;
diff --git a/libselinux/src/sestatus.c b/libselinux/src/sestatus.c
index fbe6430..bafe6bb 100644
--- a/libselinux/src/sestatus.c
+++ b/libselinux/src/sestatus.c
@@ -277,6 +277,7 @@ static int fallback_cb_policyload(int policyload)
*/
int selinux_status_open(int fallback)
{
+ se_hack1(0);
int fd;
char path[PATH_MAX];
long pagesize;
--
2.49.0

View File

@@ -0,0 +1,48 @@
From 15cea1e3bb2367d95798efa33d66c1efb71a69e9 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Mon, 20 Sep 2021 18:22:20 +0000
Subject: [PATCH 1/2] ? workaround for mesa video playback
---
media/libstagefright/colorconversion/SoftwareRenderer.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/media/libstagefright/colorconversion/SoftwareRenderer.cpp b/media/libstagefright/colorconversion/SoftwareRenderer.cpp
index 2409315..1e3ec7b 100644
--- a/media/libstagefright/colorconversion/SoftwareRenderer.cpp
+++ b/media/libstagefright/colorconversion/SoftwareRenderer.cpp
@@ -130,6 +130,7 @@ void SoftwareRenderer::resetFormatIfChanged(
// 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:
@@ -139,6 +140,7 @@ void SoftwareRenderer::resetFormatIfChanged(
bufHeight = (mCropHeight + 1) & ~1;
break;
}
+#endif
case OMX_COLOR_Format24bitRGB888:
{
halFormat = HAL_PIXEL_FORMAT_RGB_888;
@@ -154,6 +156,7 @@ void SoftwareRenderer::resetFormatIfChanged(
bufHeight = (mCropHeight + 1) & ~1;
break;
}
+#if 0 // HACKED
case OMX_COLOR_FormatYUV420Planar16:
{
if (((dataSpace & HAL_DATASPACE_STANDARD_MASK) == HAL_DATASPACE_STANDARD_BT2020)
@@ -170,6 +173,7 @@ void SoftwareRenderer::resetFormatIfChanged(
bufHeight = (mCropHeight + 1) & ~1;
break;
}
+#endif
default:
{
break;
--
2.49.0

View File

@@ -0,0 +1,76 @@
From 27f73e374923b4cb835f4aee7428b540a416225a Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sat, 6 Aug 2022 10:17:12 +0800
Subject: [PATCH 2/2] bring back OMX nodes
users may use legacy kernel without `ION` / `DMABUF_HEAP` enabled,
enable OMX nodes to support this.
---
media/libstagefright/omx/Android.bp | 1 -
media/libstagefright/omx/OMXStore.cpp | 1 -
services/mediacodec/Android.bp | 25 +++++++++++++++++++++++++
3 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/media/libstagefright/omx/Android.bp b/media/libstagefright/omx/Android.bp
index 79ab009..62ea779 100644
--- a/media/libstagefright/omx/Android.bp
+++ b/media/libstagefright/omx/Android.bp
@@ -186,7 +186,6 @@ cc_defaults {
name: "libstagefright_softomx-defaults",
// TODO (b/316432618) Software OMX codecs are no longer used, disable building them till
// this code is removed completely.
- enabled: false,
vendor_available: true,
cflags: [
diff --git a/media/libstagefright/omx/OMXStore.cpp b/media/libstagefright/omx/OMXStore.cpp
index b2d5a70..3be56c8 100644
--- a/media/libstagefright/omx/OMXStore.cpp
+++ b/media/libstagefright/omx/OMXStore.cpp
@@ -161,7 +161,6 @@ void OMXStore::addPlugin(OMXPluginBase *plugin) {
}
}
if (skip) {
- continue;
}
}
diff --git a/services/mediacodec/Android.bp b/services/mediacodec/Android.bp
index 506b3bc..a2f17c2 100644
--- a/services/mediacodec/Android.bp
+++ b/services/mediacodec/Android.bp
@@ -95,6 +95,31 @@ cc_binary {
"android.hidl.memory@1.0",
],
+ runtime_libs: [
+ "libstagefright_soft_aacdec",
+ "libstagefright_soft_aacenc",
+ "libstagefright_soft_amrdec",
+ "libstagefright_soft_amrnbenc",
+ "libstagefright_soft_amrwbenc",
+ "libstagefright_soft_avcdec",
+ "libstagefright_soft_avcenc",
+ "libstagefright_soft_flacdec",
+ "libstagefright_soft_flacenc",
+ "libstagefright_soft_g711dec",
+ "libstagefright_soft_gsmdec",
+ "libstagefright_soft_hevcdec",
+ "libstagefright_soft_mp3dec",
+ "libstagefright_soft_mpeg2dec",
+ "libstagefright_soft_mpeg4dec",
+ "libstagefright_soft_mpeg4enc",
+ "libstagefright_soft_opusdec",
+ "libstagefright_soft_rawdec",
+ "libstagefright_soft_vorbisdec",
+ "libstagefright_soft_vpxdec",
+ "libstagefright_soft_vpxenc",
+ "libstagefright_softomx_plugin",
+ ],
+
// OMX interfaces force this to stay in 32-bit mode;
compile_multilib: "32",
--
2.49.0

View File

@@ -0,0 +1,25 @@
From 0cdad8898a101010e3c60c4940272d5701f40642 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sat, 11 Nov 2023 10:30:11 +0800
Subject: [PATCH] ignore cgroup error
---
services/core/java/com/android/server/am/ProcessList.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/services/core/java/com/android/server/am/ProcessList.java b/services/core/java/com/android/server/am/ProcessList.java
index 89c89944e..34e9f377d 100644
--- a/services/core/java/com/android/server/am/ProcessList.java
+++ b/services/core/java/com/android/server/am/ProcessList.java
@@ -2518,7 +2518,7 @@ public final class ProcessList {
"Unable to create process group for "
+ app.processName + " (" + startResult.pid + ")");
} else {
- throw new AssertionError("Unable to create process group for "
+ Slog.e(ActivityManagerService.TAG, "Unable to create process group for "
+ app.processName + " (" + startResult.pid + ")");
}
} else {
--
2.49.0

View File

@@ -0,0 +1,51 @@
From 8f06b928fbbc40e0071713b3d3067e86a205c739 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sun, 9 May 2021 23:04:00 +0800
Subject: [PATCH] fix booting
---
libs/binder/Binder.cpp | 1 +
libs/binder/IPCThreadState.cpp | 2 +-
libs/binder/ProcessState.cpp | 1 +
3 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/libs/binder/Binder.cpp b/libs/binder/Binder.cpp
index c57c9cd..ccb13ea 100644
--- a/libs/binder/Binder.cpp
+++ b/libs/binder/Binder.cpp
@@ -506,6 +506,7 @@ void BBinder::setRequestingSid(bool requestingSid)
"setRequestingSid() should not be called after a binder object "
"is parceled/sent to another process");
+ requestingSid = false; // HACKED
Extras* e = mExtras.load(std::memory_order_acquire);
if (!e) {
diff --git a/libs/binder/IPCThreadState.cpp b/libs/binder/IPCThreadState.cpp
index ef96f80..40c50c5 100644
--- a/libs/binder/IPCThreadState.cpp
+++ b/libs/binder/IPCThreadState.cpp
@@ -1376,7 +1376,7 @@ status_t IPCThreadState::executeCommand(int32_t cmd)
clearPropagateWorkSource();
mCallingPid = tr.sender_pid;
- mCallingSid = reinterpret_cast<const char*>(tr_secctx.secctx);
+ mCallingSid = "HACKED";
mCallingUid = tr.sender_euid;
mHasExplicitIdentity = false;
mLastTransactionBinderFlags = tr.flags;
diff --git a/libs/binder/ProcessState.cpp b/libs/binder/ProcessState.cpp
index fb2781b..3510940 100644
--- a/libs/binder/ProcessState.cpp
+++ b/libs/binder/ProcessState.cpp
@@ -211,6 +211,7 @@ bool ProcessState::becomeContextManager()
flat_binder_object obj {
.flags = FLAT_BINDER_FLAG_TXN_SECURITY_CTX,
};
+ obj.flags = 0; // HACKED
int result = ioctl(mDriverFD, BINDER_SET_CONTEXT_MGR_EXT, &obj);
--
2.49.0

View File

@@ -0,0 +1,59 @@
From 927beebd8bb96fbff43585e7676710f80a89e57b Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Thu, 5 Oct 2023 22:18:09 +0800
Subject: [PATCH] fix booting
Change-Id: Ic19ca983445914155c020abc459b4615eaceba75
---
netbpfload/NetBpfLoad.cpp | 8 ++++++--
.../com_android_server_connectivity_ClatCoordinator.cpp | 1 +
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/netbpfload/NetBpfLoad.cpp b/netbpfload/NetBpfLoad.cpp
index ed7d048..284721d 100644
--- a/netbpfload/NetBpfLoad.cpp
+++ b/netbpfload/NetBpfLoad.cpp
@@ -353,12 +353,14 @@ int main(int argc, char** argv, char * const envp[]) {
// kernel does not have CONFIG_BPF_JIT=y)
// BPF_JIT is required by R VINTF (which means 4.14/4.19/5.4 kernels),
// but 4.14/4.19 were released with P & Q, and only 5.4 is new in R+.
- if (writeProcSysFile("/proc/sys/net/core/bpf_jit_enable", "1\n")) return 1;
+ if (writeProcSysFile("/proc/sys/net/core/bpf_jit_enable", "1\n"))
+ ALOGE("write 1 to /proc/sys/net/core/bpf_jit_enable FAILED");
// Enable JIT kallsyms export for privileged users only
// (Note: this (open) will fail with ENOENT 'No such file or directory' if
// kernel does not have CONFIG_HAVE_EBPF_JIT=y)
- if (writeProcSysFile("/proc/sys/net/core/bpf_jit_kallsyms", "1\n")) return 1;
+ if (writeProcSysFile("/proc/sys/net/core/bpf_jit_kallsyms", "1\n"))
+ ALOGE("write 1 to /proc/sys/net/core/bpf_jit_kallsyms FAILED");
}
// Create all the pin subdirectories
@@ -383,9 +385,11 @@ int main(int argc, char** argv, char * const envp[]) {
ALOGE("If this triggers reliably, you're probably missing kernel options or patches.");
ALOGE("If this triggers randomly, you might be hitting some memory allocation "
"problems or startup script race.");
+ #if 0
ALOGE("--- DO NOT EXPECT SYSTEM TO BOOT SUCCESSFULLY ---");
sleep(20);
return 2;
+ #endif
}
}
diff --git a/service/jni/com_android_server_connectivity_ClatCoordinator.cpp b/service/jni/com_android_server_connectivity_ClatCoordinator.cpp
index c125bd6..0621893 100644
--- a/service/jni/com_android_server_connectivity_ClatCoordinator.cpp
+++ b/service/jni/com_android_server_connectivity_ClatCoordinator.cpp
@@ -130,6 +130,7 @@ static void verifyClatPerms() {
#undef V2
+ fatal = false; // HACKED
if (fatal) abort();
}
--
2.49.0

View File

@@ -0,0 +1,29 @@
From 4f5ba15568891b3f3b2479b19eb82a0df2abfe59 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Thu, 5 Oct 2023 23:27:52 +0800
Subject: [PATCH] fix booting
Change-Id: Ic7bc65bd873742e20438305df2a94539cbec200b
---
bpfloader/BpfLoader.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/bpfloader/BpfLoader.cpp b/bpfloader/BpfLoader.cpp
index 08fd72d..347b452 100644
--- a/bpfloader/BpfLoader.cpp
+++ b/bpfloader/BpfLoader.cpp
@@ -206,9 +206,11 @@ int main(int argc, char** argv) {
ALOGE("If this triggers reliably, you're probably missing kernel options or patches.");
ALOGE("If this triggers randomly, you might be hitting some memory allocation "
"problems or startup script race.");
+#if 0 // HACKED
ALOGE("--- DO NOT EXPECT SYSTEM TO BOOT SUCCESSFULLY ---");
sleep(20);
return 2;
+#endif
}
}
--
2.49.0

View File

@@ -0,0 +1,143 @@
From 8929a18a1032b9b4c21875383a5d54bd2703939e Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sun, 9 May 2021 23:09:00 +0800
Subject: [PATCH 1/6] fix booting
---
fs_mgr/libfstab/boot_config.cpp | 6 ++++--
init/first_stage_init.cpp | 22 ++++++++++++++++++----
init/service.cpp | 3 ++-
rootdir/init.rc | 1 -
4 files changed, 24 insertions(+), 8 deletions(-)
diff --git a/fs_mgr/libfstab/boot_config.cpp b/fs_mgr/libfstab/boot_config.cpp
index b21495e..15e597f 100644
--- a/fs_mgr/libfstab/boot_config.cpp
+++ b/fs_mgr/libfstab/boot_config.cpp
@@ -154,13 +154,15 @@ bool GetKernelCmdlineFromString(const std::string& cmdline, const std::string& k
void ImportKernelCmdline(const std::function<void(std::string, std::string)>& fn) {
std::string cmdline;
- android::base::ReadFileToString("/proc/cmdline", &cmdline);
+ android::base::ReadFileToString("/proc/self/cmdline", &cmdline);
+ std::replace(cmdline.begin(), cmdline.end(), '\0', ' ');
ImportKernelCmdlineFromString(android::base::Trim(cmdline), fn);
}
bool GetKernelCmdline(const std::string& key, std::string* out) {
std::string cmdline;
- android::base::ReadFileToString("/proc/cmdline", &cmdline);
+ android::base::ReadFileToString("/proc/self/cmdline", &cmdline);
+ std::replace(cmdline.begin(), cmdline.end(), '\0', ' ');
return GetKernelCmdlineFromString(android::base::Trim(cmdline), key, out);
}
diff --git a/init/first_stage_init.cpp b/init/first_stage_init.cpp
index c4d0f75..fdad43a 100644
--- a/init/first_stage_init.cpp
+++ b/init/first_stage_init.cpp
@@ -36,6 +36,7 @@
#include <android-base/chrono_utils.h>
#include <android-base/file.h>
#include <android-base/logging.h>
+#include <android-base/strings.h>
#include <android-base/stringprintf.h>
#include <modprobe/modprobe.h>
#include <private/android_filesystem_config.h>
@@ -334,6 +335,8 @@ int FirstStageMain(int argc, char** argv) {
CHECKCALL(mkdir("/dev/pts", 0755));
CHECKCALL(mkdir("/dev/socket", 0755));
CHECKCALL(mkdir("/dev/dm-user", 0755));
+ mount("/system/etc", "/etc", "none", MS_BIND, NULL); // cgroup fix
+ unshare(CLONE_NEWCGROUP);
CHECKCALL(mount("devpts", "/dev/pts", "devpts", 0, NULL));
#define MAKE_STR(x) __STRING(x)
CHECKCALL(mount("proc", "/proc", "proc", 0, "hidepid=2,gid=" MAKE_STR(AID_READPROC)));
@@ -397,7 +400,6 @@ int FirstStageMain(int argc, char** argv) {
for (const auto& [error_string, error_errno] : errors) {
LOG(ERROR) << error_string << " " << strerror(error_errno);
}
- LOG(FATAL) << "Init encountered errors starting first stage, aborting";
}
LOG(INFO) << "init first stage started!";
@@ -515,6 +517,7 @@ int FirstStageMain(int argc, char** argv) {
if (!fsm) {
fsm = CreateFirstStageMount(cmdline);
}
+ #if 0
if (!fsm) {
LOG(FATAL) << "FirstStageMount not available";
}
@@ -524,8 +527,9 @@ int FirstStageMain(int argc, char** argv) {
}
if (!fsm->DoFirstStageMount()) {
- LOG(FATAL) << "Failed to mount required partitions early ...";
+ LOG(ERROR) << "Failed to mount required partitions early ...";
}
+ #endif
}
struct stat new_root_info {};
@@ -544,12 +548,22 @@ int FirstStageMain(int argc, char** argv) {
1);
const char* path = "/system/bin/init";
- const char* args[] = {path, "selinux_setup", nullptr};
+ std::vector<const char *> args = {path, "second_stage"};
+ std::string init_cmdline;
+ android::base::ReadFileToString("/proc/self/cmdline", &init_cmdline);
+ std::replace(init_cmdline.begin(), init_cmdline.end(), '\0', ' ');
+ auto cmd_vector = android::base::Split(android::base::Trim(init_cmdline), " ");
+ int i = 0;
+ for (const auto& entry : cmd_vector) {
+ if (i++ == 0) continue; // ignore first arg '/init'
+ args.push_back(entry.c_str());
+ }
+ args.push_back(nullptr);
auto fd = open("/dev/kmsg", O_WRONLY | O_CLOEXEC);
dup2(fd, STDOUT_FILENO);
dup2(fd, STDERR_FILENO);
close(fd);
- execv(path, const_cast<char**>(args));
+ 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/service.cpp b/init/service.cpp
index eb24dd5..9ab2f94 100644
--- a/init/service.cpp
+++ b/init/service.cpp
@@ -76,6 +76,7 @@ namespace android {
namespace init {
static Result<std::string> ComputeContextFromExecutable(const std::string& service_path) {
+ se_hack1("HACKED");
std::string computed_context;
char* raw_con = nullptr;
@@ -367,7 +368,7 @@ void Service::Reap(const siginfo_t& siginfo) {
if (!GetBoolProperty("init.svc_debug.no_fatal." + name_, false)) {
// Aborts into `fatal_reboot_target_'.
SetFatalRebootTarget(fatal_reboot_target_);
- LOG(FATAL) << "critical process '" << name_ << "' exited 4 times "
+ LOG(ERROR) << "critical process '" << name_ << "' exited 4 times "
<< exit_reason;
}
} else {
diff --git a/rootdir/init.rc b/rootdir/init.rc
index 8a2ed9f..e14d7f1 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -572,7 +572,6 @@ on post-fs
# Once everything is setup, no need to modify /.
# The bind+remount combination allows this to work in containers.
- mount rootfs rootfs / remount bind ro nodev
# Mount default storage into root namespace
mount none /mnt/user/0 /storage bind rec
--
2.49.0

View File

@@ -0,0 +1,25 @@
From 229572b701e8bc949acbd45b7355b4661aab21b4 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sat, 26 Jun 2021 05:42:24 +0000
Subject: [PATCH 2/6] allow override ro.* prop
---
init/property_service.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/init/property_service.cpp b/init/property_service.cpp
index 157fc70..7197230 100644
--- a/init/property_service.cpp
+++ b/init/property_service.cpp
@@ -1364,6 +1364,8 @@ static void ProcessKernelCmdline() {
android::fs_mgr::ImportKernelCmdline([&](const std::string& key, const std::string& value) {
if (StartsWith(key, ANDROIDBOOT_PREFIX)) {
InitPropertySet("ro.boot." + key.substr(ANDROIDBOOT_PREFIX.size()), value);
+ } else if (StartsWith(key, "ro.")) {
+ InitPropertySet(key, value);
}
});
}
--
2.49.0

View File

@@ -0,0 +1,26 @@
From b324f06ebb6b170e444288bfbc3f06379b740eaf Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Fri, 25 Jun 2021 15:56:47 +0000
Subject: [PATCH 3/6] ignore input subsystem
---
rootdir/ueventd.rc | 3 ---
1 file changed, 3 deletions(-)
diff --git a/rootdir/ueventd.rc b/rootdir/ueventd.rc
index 3927501..404da8f 100644
--- a/rootdir/ueventd.rc
+++ b/rootdir/ueventd.rc
@@ -12,9 +12,6 @@ subsystem drm
devname uevent_devpath
dirname /dev/dri
-subsystem input
- devname uevent_devpath
- dirname /dev/input
subsystem sound
devname uevent_devpath
--
2.49.0

View File

@@ -0,0 +1,24 @@
From c94d39764a46fc834e7a996c5131605875fc667e 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] ignore devfs mount
---
init/first_stage_init.cpp | 1 -
1 file changed, 1 deletion(-)
diff --git a/init/first_stage_init.cpp b/init/first_stage_init.cpp
index fdad43a..5d1d3dd 100644
--- a/init/first_stage_init.cpp
+++ b/init/first_stage_init.cpp
@@ -331,7 +331,6 @@ int FirstStageMain(int argc, char** argv) {
CHECKCALL(setenv("PATH", _PATH_DEFPATH, 1));
// 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.
- CHECKCALL(mount("tmpfs", "/dev", "tmpfs", MS_NOSUID, "mode=0755"));
CHECKCALL(mkdir("/dev/pts", 0755));
CHECKCALL(mkdir("/dev/socket", 0755));
CHECKCALL(mkdir("/dev/dm-user", 0755));
--
2.49.0

View File

@@ -0,0 +1,24 @@
From 054bb61d9c0779fca4109a59470f74e27a9aa879 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Thu, 6 Jan 2022 20:47:28 +0800
Subject: [PATCH 5/6] auto alloc binder devices
---
rootdir/init.rc | 1 +
1 file changed, 1 insertion(+)
diff --git a/rootdir/init.rc b/rootdir/init.rc
index e14d7f1..cb8a8a7 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -259,6 +259,7 @@ on init
mkdir /dev/binderfs
mount binder binder /dev/binderfs stats=global
chmod 0755 /dev/binderfs
+ exec -- /vendor/bin/binder_alloc /dev/binderfs/binder-control binder hwbinder vndbinder
# Mount fusectl
mount fusectl none /sys/fs/fuse/connections
--
2.49.0

View File

@@ -0,0 +1,24 @@
From 5726bb74f92ce7e0ce9f9409c7f6d9420e297b49 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sat, 2 Sep 2023 17:10:16 +0800
Subject: [PATCH 6/6] skip fusectl mount
---
rootdir/init.rc | 1 -
1 file changed, 1 deletion(-)
diff --git a/rootdir/init.rc b/rootdir/init.rc
index cb8a8a7..60dd1d6 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -262,7 +262,6 @@ on init
exec -- /vendor/bin/binder_alloc /dev/binderfs/binder-control binder hwbinder vndbinder
# Mount fusectl
- mount fusectl none /sys/fs/fuse/connections
symlink /dev/binderfs/binder /dev/binder
symlink /dev/binderfs/hwbinder /dev/hwbinder
--
2.49.0

View File

@@ -0,0 +1,45 @@
From 9aa8f3d2bfe706d3cd81f59ed53ffcd2456a319e Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sun, 9 May 2021 23:44:12 +0800
Subject: [PATCH] fix booting
---
Binder.cpp | 1 +
ProcessState.cpp | 3 +++
2 files changed, 4 insertions(+)
diff --git a/Binder.cpp b/Binder.cpp
index 6d26414..b657a0b 100644
--- a/Binder.cpp
+++ b/Binder.cpp
@@ -96,6 +96,7 @@ bool BHwBinder::isRequestingSid() {
}
void BHwBinder::setRequestingSid(bool requestingSid) {
+ requestingSid = false; // HACKED
Extras* e = mExtras.load(std::memory_order_acquire);
if (!e) {
diff --git a/ProcessState.cpp b/ProcessState.cpp
index d6dfa16..7363cd6 100644
--- a/ProcessState.cpp
+++ b/ProcessState.cpp
@@ -123,12 +123,15 @@ void ProcessState::becomeContextManager()
{
AutoMutex _l(mLock);
+#if 0 // HACKED (?)
flat_binder_object obj {
.flags = FLAT_BINDER_FLAG_TXN_SECURITY_CTX,
};
status_t result = ioctl(mDriverFD, BINDER_SET_CONTEXT_MGR_EXT, &obj);
+#endif
+ status_t result = 1;
// fallback to original method
if (result != 0) {
android_errorWriteLog(0x534e4554, "121035042");
--
2.49.0

View File

@@ -0,0 +1,24 @@
From 80126ebbca3a1f7f818310f143dd930ca1110b95 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 2861099..21728c0 100644
--- a/VintfObject.cpp
+++ b/VintfObject.cpp
@@ -746,7 +746,6 @@ int32_t VintfObject::checkCompatibility(std::string* error, CheckFlags::Type fla
error->insert(0,
"Runtime info and framework compatibility matrix are incompatible: ");
}
- return INCOMPATIBLE;
}
}
--
2.49.0

View File

@@ -0,0 +1,50 @@
From b6633bddd0b5f53222bd0658763400dd4a689764 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sat, 31 Jul 2021 06:14:33 +0000
Subject: [PATCH 1/3] ignore iptables error
---
server/BandwidthController.cpp | 1 +
server/Controllers.cpp | 1 -
server/IptablesRestoreController.cpp | 1 +
3 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/server/BandwidthController.cpp b/server/BandwidthController.cpp
index 438dbb8..8a4ffec 100644
--- a/server/BandwidthController.cpp
+++ b/server/BandwidthController.cpp
@@ -541,6 +541,7 @@ int BandwidthController::updateQuota(const std::string& quotaName, int64_t bytes
if (!isOk(file)) {
int res = errno;
ALOGE("Updating quota %s failed (%s)", quotaName.c_str(), toString(file).c_str());
+ res = 0; // HACKED
return -res;
}
// TODO: should we propagate this error?
diff --git a/server/Controllers.cpp b/server/Controllers.cpp
index 87b2c55..6e60a58 100644
--- a/server/Controllers.cpp
+++ b/server/Controllers.cpp
@@ -321,7 +321,6 @@ void Controllers::init() {
// As such simply exit netd. This may crash loop the system, but by failing
// to bootup we will trigger rollback and thus this offers us protection against
// a mainline update breaking things.
- exit(1);
}
gLog.info("Enabling bandwidth control: %" PRId64 "us", s.getTimeAndResetUs());
diff --git a/server/IptablesRestoreController.cpp b/server/IptablesRestoreController.cpp
index d0aaa63..2133538 100644
--- a/server/IptablesRestoreController.cpp
+++ b/server/IptablesRestoreController.cpp
@@ -346,6 +346,7 @@ int IptablesRestoreController::execute(const IptablesTarget target, const std::s
if (target == V6 || target == V4V6) {
res |= sendCommand(IP6TABLES_PROCESS, command, output);
}
+ res = 0; // ignore iptables error
return res;
}
--
2.49.0

View File

@@ -0,0 +1,24 @@
From 44a54617400d6e5ac289bcdeb217187246eaa213 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sun, 14 Aug 2022 11:53:19 +0800
Subject: [PATCH 2/3] ignore bpf error
---
server/main.cpp | 1 -
1 file changed, 1 deletion(-)
diff --git a/server/main.cpp b/server/main.cpp
index b0c5406..8ef2f19 100644
--- a/server/main.cpp
+++ b/server/main.cpp
@@ -145,7 +145,6 @@ int main() {
if (libnetd_updatable_init(cg2_path.c_str())) {
ALOGE("libnetd_updatable_init failed");
- exit(1);
}
gLog.info("libnetd_updatable_init success");
--
2.49.0

View File

@@ -0,0 +1,28 @@
From c248aea68ecfb3070eb64c57fd6954cb4334d363 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sun, 14 Aug 2022 11:57:11 +0800
Subject: [PATCH 3/3] ignote getTetherStats error
---
server/TetherController.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/server/TetherController.cpp b/server/TetherController.cpp
index 03185e7..150da1c 100644
--- a/server/TetherController.cpp
+++ b/server/TetherController.cpp
@@ -913,9 +913,11 @@ StatusOr<TetherController::TetherStatsList> TetherController::getTetherStats() {
}
if (int ret = addForwardChainStats(statsList, statsString, parsedIptablesOutput)) {
+#if 0
return statusFromErrno(-ret, StringPrintf("failed to parse %s tether stats:\n%s",
target == V4 ? "IPv4": "IPv6",
parsedIptablesOutput.c_str()));
+#endif
}
}
--
2.49.0

View File

@@ -0,0 +1,24 @@
From 7d892a25c277a8adf2a9f70425bb1d6aac6049a0 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sat, 6 Aug 2022 10:19:11 +0800
Subject: [PATCH] ignore project quota error
---
Utils.cpp | 1 -
1 file changed, 1 deletion(-)
diff --git a/Utils.cpp b/Utils.cpp
index 696b0b4..42f05a1 100644
--- a/Utils.cpp
+++ b/Utils.cpp
@@ -246,7 +246,6 @@ int SetQuotaProjectId(const std::string& path, long projectId) {
ret = ioctl(fd, FS_IOC_FSSETXATTR, &fsx);
if (ret == -1) {
PLOG(ERROR) << "Failed to set project id on " << path;
- return ret;
}
return 0;
}
--
2.49.0

View File

@@ -0,0 +1,32 @@
From a23c02f1160add7deeddeed89c81062d0bae2d55 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 bb60904..efe8be2 100644
--- a/libminijail.c
+++ b/libminijail.c
@@ -2487,6 +2487,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 ||
j->flags.seccomp_filter_allow_speculation) {
@@ -2508,6 +2509,7 @@ static void set_seccomp_filter(const struct minijail *j)
}
}
}
+#endif
}
static pid_t forward_pid = -1;
--
2.45.1

View File

@@ -0,0 +1,165 @@
From 1e30003fdea321661f623d55a0550eef09a38844 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sun, 9 May 2021 23:44:12 +0800
Subject: [PATCH] ignore selinux
---
libselinux/include/selinux/selinux.h | 4 ++++
libselinux/src/checkAccess.c | 1 +
libselinux/src/getenforce.c | 1 +
libselinux/src/getfilecon.c | 1 +
libselinux/src/getpeercon.c | 1 +
libselinux/src/init.c | 1 +
libselinux/src/label.c | 1 +
libselinux/src/lgetfilecon.c | 1 +
libselinux/src/lsetfilecon.c | 1 +
libselinux/src/procattr.c | 2 ++
libselinux/src/sestatus.c | 1 +
11 files changed, 15 insertions(+)
diff --git a/libselinux/include/selinux/selinux.h b/libselinux/include/selinux/selinux.h
index a094885..3ddeee2 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/checkAccess.c b/libselinux/src/checkAccess.c
index 022cd6b..a23bffc 100644
--- a/libselinux/src/checkAccess.c
+++ b/libselinux/src/checkAccess.c
@@ -20,6 +20,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 3f1e200..bf16227 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/getfilecon.c b/libselinux/src/getfilecon.c
index 4bee313..f8b159a 100644
--- a/libselinux/src/getfilecon.c
+++ b/libselinux/src/getfilecon.c
@@ -52,6 +52,7 @@ int getfilecon_raw(const char *path, char ** context)
int getfilecon(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/getpeercon.c b/libselinux/src/getpeercon.c
index a9dca73..10771cb 100644
--- a/libselinux/src/getpeercon.c
+++ b/libselinux/src/getpeercon.c
@@ -46,6 +46,7 @@ int getpeercon_raw(int fd, char ** context)
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 439da41..41268a7 100644
--- a/libselinux/src/init.c
+++ b/libselinux/src/init.c
@@ -139,6 +139,7 @@ void fini_selinuxmnt(void)
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 e0ed68d..2c22c04 100644
--- a/libselinux/src/label.c
+++ b/libselinux/src/label.c
@@ -310,6 +310,7 @@ bool selabel_hash_all_partial_matches(struct selabel_handle *rec,
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 d1fb821..0d3b0ac 100644
--- a/libselinux/src/lgetfilecon.c
+++ b/libselinux/src/lgetfilecon.c
@@ -52,6 +52,7 @@ int lgetfilecon_raw(const char *path, char ** context)
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 213fb68..c73c152 100644
--- a/libselinux/src/lsetfilecon.c
+++ b/libselinux/src/lsetfilecon.c
@@ -28,6 +28,7 @@ int lsetfilecon_raw(const char *path, const char * context)
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 b7a93a2..a1478c7 100644
--- a/libselinux/src/procattr.c
+++ b/libselinux/src/procattr.c
@@ -175,6 +175,7 @@ static int getprocattrcon_raw(char **context, pid_t pid, const char *attr,
static int getprocattrcon(char **context, pid_t pid, const char *attr,
const char *prev_context)
{
+ se_hack1((*context = calloc(7, 1), memcpy(*context, "HACKED", 6), 0));
int ret;
char * rcontext;
@@ -239,6 +240,7 @@ out:
static int setprocattrcon(const char *context, const char *attr,
char **prev_context)
{
+ se_hack1(0);
int ret;
char * rcontext;
diff --git a/libselinux/src/sestatus.c b/libselinux/src/sestatus.c
index fbe6430..bafe6bb 100644
--- a/libselinux/src/sestatus.c
+++ b/libselinux/src/sestatus.c
@@ -277,6 +277,7 @@ static int fallback_cb_policyload(int policyload)
*/
int selinux_status_open(int fallback)
{
+ se_hack1(0);
int fd;
char path[PATH_MAX];
long pagesize;
--
2.45.1

View File

@@ -0,0 +1,48 @@
From 3fd19c8bd01a55e40edfc639963465b9ae15789d Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Mon, 20 Sep 2021 18:22:20 +0000
Subject: [PATCH 1/2] ? workaround for mesa video playback
---
media/libstagefright/colorconversion/SoftwareRenderer.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/media/libstagefright/colorconversion/SoftwareRenderer.cpp b/media/libstagefright/colorconversion/SoftwareRenderer.cpp
index 2409315..1e3ec7b 100644
--- a/media/libstagefright/colorconversion/SoftwareRenderer.cpp
+++ b/media/libstagefright/colorconversion/SoftwareRenderer.cpp
@@ -130,6 +130,7 @@ void SoftwareRenderer::resetFormatIfChanged(
// 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:
@@ -139,6 +140,7 @@ void SoftwareRenderer::resetFormatIfChanged(
bufHeight = (mCropHeight + 1) & ~1;
break;
}
+#endif
case OMX_COLOR_Format24bitRGB888:
{
halFormat = HAL_PIXEL_FORMAT_RGB_888;
@@ -154,6 +156,7 @@ void SoftwareRenderer::resetFormatIfChanged(
bufHeight = (mCropHeight + 1) & ~1;
break;
}
+#if 0 // HACKED
case OMX_COLOR_FormatYUV420Planar16:
{
if (((dataSpace & HAL_DATASPACE_STANDARD_MASK) == HAL_DATASPACE_STANDARD_BT2020)
@@ -170,6 +173,7 @@ void SoftwareRenderer::resetFormatIfChanged(
bufHeight = (mCropHeight + 1) & ~1;
break;
}
+#endif
default:
{
break;
--
2.45.1

View File

@@ -0,0 +1,76 @@
From cfdda512510a20305d55db8d58551ead7253e094 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sat, 6 Aug 2022 10:17:12 +0800
Subject: [PATCH 2/2] bring back OMX nodes
users may use legacy kernel without `ION` / `DMABUF_HEAP` enabled,
enable OMX nodes to support this.
---
media/libstagefright/omx/Android.bp | 1 -
media/libstagefright/omx/OMXStore.cpp | 1 -
services/mediacodec/Android.bp | 25 +++++++++++++++++++++++++
3 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/media/libstagefright/omx/Android.bp b/media/libstagefright/omx/Android.bp
index 630817c..23d1b1a 100644
--- a/media/libstagefright/omx/Android.bp
+++ b/media/libstagefright/omx/Android.bp
@@ -183,7 +183,6 @@ cc_defaults {
name: "libstagefright_softomx-defaults",
// TODO (b/316432618) Software OMX codecs are no longer used, disable building them till
// this code is removed completely.
- enabled: false,
vendor_available: true,
cflags: [
diff --git a/media/libstagefright/omx/OMXStore.cpp b/media/libstagefright/omx/OMXStore.cpp
index b2d5a70..3be56c8 100644
--- a/media/libstagefright/omx/OMXStore.cpp
+++ b/media/libstagefright/omx/OMXStore.cpp
@@ -161,7 +161,6 @@ void OMXStore::addPlugin(OMXPluginBase *plugin) {
}
}
if (skip) {
- continue;
}
}
diff --git a/services/mediacodec/Android.bp b/services/mediacodec/Android.bp
index 506b3bc..a2f17c2 100644
--- a/services/mediacodec/Android.bp
+++ b/services/mediacodec/Android.bp
@@ -95,6 +95,31 @@ cc_binary {
"android.hidl.memory@1.0",
],
+ runtime_libs: [
+ "libstagefright_soft_aacdec",
+ "libstagefright_soft_aacenc",
+ "libstagefright_soft_amrdec",
+ "libstagefright_soft_amrnbenc",
+ "libstagefright_soft_amrwbenc",
+ "libstagefright_soft_avcdec",
+ "libstagefright_soft_avcenc",
+ "libstagefright_soft_flacdec",
+ "libstagefright_soft_flacenc",
+ "libstagefright_soft_g711dec",
+ "libstagefright_soft_gsmdec",
+ "libstagefright_soft_hevcdec",
+ "libstagefright_soft_mp3dec",
+ "libstagefright_soft_mpeg2dec",
+ "libstagefright_soft_mpeg4dec",
+ "libstagefright_soft_mpeg4enc",
+ "libstagefright_soft_opusdec",
+ "libstagefright_soft_rawdec",
+ "libstagefright_soft_vorbisdec",
+ "libstagefright_soft_vpxdec",
+ "libstagefright_soft_vpxenc",
+ "libstagefright_softomx_plugin",
+ ],
+
// OMX interfaces force this to stay in 32-bit mode;
compile_multilib: "32",
--
2.45.1

View File

@@ -0,0 +1,25 @@
From a001846a996826d6c0f003c5c410e1deea39431d Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sat, 11 Nov 2023 10:30:11 +0800
Subject: [PATCH] ignore cgroup error
---
services/core/java/com/android/server/am/ProcessList.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/services/core/java/com/android/server/am/ProcessList.java b/services/core/java/com/android/server/am/ProcessList.java
index c0947247d..2dc813954 100644
--- a/services/core/java/com/android/server/am/ProcessList.java
+++ b/services/core/java/com/android/server/am/ProcessList.java
@@ -2583,7 +2583,7 @@ public final class ProcessList {
"Unable to create process group for "
+ app.processName + " (" + startResult.pid + ")");
} else {
- throw new AssertionError("Unable to create process group for "
+ Slog.e(ActivityManagerService.TAG, "Unable to create process group for "
+ app.processName + " (" + startResult.pid + ")");
}
} else {
--
2.45.1

View File

@@ -0,0 +1,59 @@
From a7e73ba50cbf99563ff9002442f1f26471d588f3 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sun, 9 May 2021 23:04:00 +0800
Subject: [PATCH] fix booting
---
libs/binder/Binder.cpp | 1 +
libs/binder/IPCThreadState.cpp | 2 +-
libs/binder/ProcessState.cpp | 3 +++
3 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/libs/binder/Binder.cpp b/libs/binder/Binder.cpp
index c57c9cd..ccb13ea 100644
--- a/libs/binder/Binder.cpp
+++ b/libs/binder/Binder.cpp
@@ -506,6 +506,7 @@ void BBinder::setRequestingSid(bool requestingSid)
"setRequestingSid() should not be called after a binder object "
"is parceled/sent to another process");
+ requestingSid = false; // HACKED
Extras* e = mExtras.load(std::memory_order_acquire);
if (!e) {
diff --git a/libs/binder/IPCThreadState.cpp b/libs/binder/IPCThreadState.cpp
index fbc8125..52953f2 100644
--- a/libs/binder/IPCThreadState.cpp
+++ b/libs/binder/IPCThreadState.cpp
@@ -1377,7 +1377,7 @@ status_t IPCThreadState::executeCommand(int32_t cmd)
clearPropagateWorkSource();
mCallingPid = tr.sender_pid;
- mCallingSid = reinterpret_cast<const char*>(tr_secctx.secctx);
+ mCallingSid = "HACKED";
mCallingUid = tr.sender_euid;
mHasExplicitIdentity = false;
mLastTransactionBinderFlags = tr.flags;
diff --git a/libs/binder/ProcessState.cpp b/libs/binder/ProcessState.cpp
index 8485ecd..a427f0c 100644
--- a/libs/binder/ProcessState.cpp
+++ b/libs/binder/ProcessState.cpp
@@ -208,12 +208,15 @@ bool ProcessState::becomeContextManager()
{
std::unique_lock<std::mutex> _l(mLock);
+#if 0
flat_binder_object obj {
.flags = FLAT_BINDER_FLAG_TXN_SECURITY_CTX,
};
int result = ioctl(mDriverFD, BINDER_SET_CONTEXT_MGR_EXT, &obj);
+#endif
+ int result = 1;
// fallback to original method
if (result != 0) {
android_errorWriteLog(0x534e4554, "121035042");
--
2.45.1

View File

@@ -0,0 +1,58 @@
From fc8e0b067c5c88ae518709586db9997407c5abc0 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Thu, 5 Oct 2023 22:18:09 +0800
Subject: [PATCH 1/2] fix booting
---
netbpfload/NetBpfLoad.cpp | 8 ++++++--
.../com_android_server_connectivity_ClatCoordinator.cpp | 1 +
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/netbpfload/NetBpfLoad.cpp b/netbpfload/NetBpfLoad.cpp
index e9c6d8a..27ce601 100644
--- a/netbpfload/NetBpfLoad.cpp
+++ b/netbpfload/NetBpfLoad.cpp
@@ -435,12 +435,14 @@ static int doLoad(char** argv, char * const envp[]) {
// kernel does not have CONFIG_BPF_JIT=y)
// BPF_JIT is required by R VINTF (which means 4.14/4.19/5.4 kernels),
// but 4.14/4.19 were released with P & Q, and only 5.4 is new in R+.
- if (writeProcSysFile("/proc/sys/net/core/bpf_jit_enable", "1\n")) return 1;
+ if (writeProcSysFile("/proc/sys/net/core/bpf_jit_enable", "1\n"))
+ ALOGE("write 1 to /proc/sys/net/core/bpf_jit_enable FAILED");
// Enable JIT kallsyms export for privileged users only
// (Note: this (open) will fail with ENOENT 'No such file or directory' if
// kernel does not have CONFIG_HAVE_EBPF_JIT=y)
- if (writeProcSysFile("/proc/sys/net/core/bpf_jit_kallsyms", "1\n")) return 1;
+ if (writeProcSysFile("/proc/sys/net/core/bpf_jit_kallsyms", "1\n"))
+ ALOGE("write 1 to /proc/sys/net/core/bpf_jit_kallsyms FAILED");
}
// Create all the pin subdirectories
@@ -465,9 +467,11 @@ static int doLoad(char** argv, char * const envp[]) {
ALOGE("If this triggers reliably, you're probably missing kernel options or patches.");
ALOGE("If this triggers randomly, you might be hitting some memory allocation "
"problems or startup script race.");
+ #if 0
ALOGE("--- DO NOT EXPECT SYSTEM TO BOOT SUCCESSFULLY ---");
sleep(20);
return 2;
+ #endif
}
}
diff --git a/service/jni/com_android_server_connectivity_ClatCoordinator.cpp b/service/jni/com_android_server_connectivity_ClatCoordinator.cpp
index c0082bb..6144b21 100644
--- a/service/jni/com_android_server_connectivity_ClatCoordinator.cpp
+++ b/service/jni/com_android_server_connectivity_ClatCoordinator.cpp
@@ -132,6 +132,7 @@ static void verifyClatPerms() {
#undef V2
+ fatal = false;
if (fatal) abort();
}
--
2.45.1

View File

@@ -0,0 +1,24 @@
From da6a3860532462775369a3ef376bce0e278ebfc8 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Thu, 5 Sep 2024 19:11:19 +0800
Subject: [PATCH 2/2] ignore nativeSynchronizeKernelRCU error
---
.../native/bpfmapjni/com_android_net_module_util_BpfMap.cpp | 1 -
1 file changed, 1 deletion(-)
diff --git a/staticlibs/native/bpfmapjni/com_android_net_module_util_BpfMap.cpp b/staticlibs/native/bpfmapjni/com_android_net_module_util_BpfMap.cpp
index 1923ceb..3c143f5 100644
--- a/staticlibs/native/bpfmapjni/com_android_net_module_util_BpfMap.cpp
+++ b/staticlibs/native/bpfmapjni/com_android_net_module_util_BpfMap.cpp
@@ -141,7 +141,6 @@ static void com_android_net_module_util_BpfMap_nativeSynchronizeKernelRCU(JNIEnv
const int pfSocket = socket(AF_KEY, SOCK_RAW | SOCK_CLOEXEC, PF_KEY_V2);
if (pfSocket < 0) {
- jniThrowErrnoException(env, "nativeSynchronizeKernelRCU:socket", errno);
return;
}
--
2.45.1

View File

@@ -0,0 +1,125 @@
From d6b9a089d9d68c2b11b6df5188b55e39e949fc0d Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sun, 9 May 2021 23:09:00 +0800
Subject: [PATCH 1/7] fix booting
---
fs_mgr/libfstab/boot_config.cpp | 6 ++++--
init/first_stage_init.cpp | 18 +++++++++++++++---
init/init.cpp | 0
init/property_service.cpp | 0
init/service.cpp | 1 +
rootdir/init.rc | 1 -
6 files changed, 20 insertions(+), 6 deletions(-)
mode change 100644 => 100755 init/init.cpp
mode change 100644 => 100755 init/property_service.cpp
diff --git a/fs_mgr/libfstab/boot_config.cpp b/fs_mgr/libfstab/boot_config.cpp
index b21495e..7993d15 100644
--- a/fs_mgr/libfstab/boot_config.cpp
+++ b/fs_mgr/libfstab/boot_config.cpp
@@ -154,13 +154,15 @@ bool GetKernelCmdlineFromString(const std::string& cmdline, const std::string& k
void ImportKernelCmdline(const std::function<void(std::string, std::string)>& 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
ImportKernelCmdlineFromString(android::base::Trim(cmdline), fn);
}
bool GetKernelCmdline(const std::string& key, std::string* out) {
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
return GetKernelCmdlineFromString(android::base::Trim(cmdline), key, out);
}
diff --git a/init/first_stage_init.cpp b/init/first_stage_init.cpp
index bfe636b..e918016 100644
--- a/init/first_stage_init.cpp
+++ b/init/first_stage_init.cpp
@@ -36,6 +36,7 @@
#include <android-base/chrono_utils.h>
#include <android-base/file.h>
#include <android-base/logging.h>
+#include <android-base/strings.h>
#include <android-base/stringprintf.h>
#include <android/avf_cc_flags.h>
#include <modprobe/modprobe.h>
@@ -335,6 +336,8 @@ int FirstStageMain(int argc, char** argv) {
CHECKCALL(mkdir("/dev/pts", 0755));
CHECKCALL(mkdir("/dev/socket", 0755));
CHECKCALL(mkdir("/dev/dm-user", 0755));
+ mount("/system/etc", "/etc", "none", MS_BIND, NULL); // cgroup fix
+ unshare(CLONE_NEWCGROUP);
CHECKCALL(mount("devpts", "/dev/pts", "devpts", 0, NULL));
#define MAKE_STR(x) __STRING(x)
CHECKCALL(mount("proc", "/proc", "proc", 0, "hidepid=2,gid=" MAKE_STR(AID_READPROC)));
@@ -403,7 +406,6 @@ int FirstStageMain(int argc, char** argv) {
for (const auto& [error_string, error_errno] : errors) {
LOG(ERROR) << error_string << " " << strerror(error_errno);
}
- LOG(FATAL) << "Init encountered errors starting first stage, aborting";
}
LOG(INFO) << "init first stage started!";
@@ -538,12 +540,22 @@ int FirstStageMain(int argc, char** argv) {
1);
const char* path = "/system/bin/init";
- const char* args[] = {path, "selinux_setup", nullptr};
+ std::vector<const char *> args = {path, "second_stage"};
+ std::string init_cmdline;
+ android::base::ReadFileToString("/proc/self/cmdline", &init_cmdline);
+ std::replace(init_cmdline.begin(), init_cmdline.end(), '\0', ' ');
+ auto cmd_vector = android::base::Split(android::base::Trim(init_cmdline), " ");
+ int i = 0;
+ for (const auto& entry : cmd_vector) {
+ if (i++ == 0) continue; // ignore first arg '/init'
+ args.push_back(entry.c_str());
+ }
+ args.push_back(nullptr);
auto fd = open("/dev/kmsg", O_WRONLY | O_CLOEXEC);
dup2(fd, STDOUT_FILENO);
dup2(fd, STDERR_FILENO);
close(fd);
- execv(path, const_cast<char**>(args));
+ 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/init.cpp b/init/init.cpp
old mode 100644
new mode 100755
diff --git a/init/property_service.cpp b/init/property_service.cpp
old mode 100644
new mode 100755
diff --git a/init/service.cpp b/init/service.cpp
index 31308a0..dca8738 100644
--- a/init/service.cpp
+++ b/init/service.cpp
@@ -76,6 +76,7 @@ namespace android {
namespace init {
static Result<std::string> ComputeContextFromExecutable(const std::string& service_path) {
+ se_hack1("HACKED");
std::string computed_context;
char* raw_con = nullptr;
diff --git a/rootdir/init.rc b/rootdir/init.rc
index 2443b7c..dee7e34 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -565,7 +565,6 @@ on post-fs
# Once everything is setup, no need to modify /.
# The bind+remount combination allows this to work in containers.
- mount rootfs rootfs / remount bind ro nodev
# Mount default storage into root namespace
mount none /mnt/user/0 /storage bind rec
--
2.45.1

View File

@@ -0,0 +1,25 @@
From 74187918848d676857d2c74035d67b0634aa26a4 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sat, 26 Jun 2021 05:42:24 +0000
Subject: [PATCH 2/7] allow override ro.* prop
---
init/property_service.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/init/property_service.cpp b/init/property_service.cpp
index 0d6eb15..b7481f8 100755
--- a/init/property_service.cpp
+++ b/init/property_service.cpp
@@ -1387,6 +1387,8 @@ static void ProcessKernelCmdline() {
android::fs_mgr::ImportKernelCmdline([&](const std::string& key, const std::string& value) {
if (StartsWith(key, ANDROIDBOOT_PREFIX)) {
InitPropertySet("ro.boot." + key.substr(ANDROIDBOOT_PREFIX.size()), value);
+ } else if (StartsWith(key, "ro.")) {
+ InitPropertySet(key, value);
}
});
}
--
2.45.1

View File

@@ -0,0 +1,35 @@
From 431d86122b202e0bcd1464b910f55ad75af06556 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sun, 27 Jun 2021 09:49:22 +0000
Subject: [PATCH 3/7] ? fix first stage mount
---
init/first_stage_init.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/init/first_stage_init.cpp b/init/first_stage_init.cpp
index e918016..94faf87 100644
--- a/init/first_stage_init.cpp
+++ b/init/first_stage_init.cpp
@@ -511,6 +511,7 @@ int FirstStageMain(int argc, char** argv) {
if (!fsm) {
fsm = CreateFirstStageMount(cmdline);
}
+ #if 0
if (!fsm) {
LOG(FATAL) << "FirstStageMount not available";
}
@@ -520,8 +521,9 @@ int FirstStageMain(int argc, char** argv) {
}
if (!fsm->DoFirstStageMount()) {
- LOG(FATAL) << "Failed to mount required partitions early ...";
+ LOG(ERROR) << "Failed to mount required partitions early ...";
}
+ #endif
}
struct stat new_root_info {};
--
2.45.1

View File

@@ -0,0 +1,26 @@
From 3bc16a47f2614f483af1b81b53ef39268151781f Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Fri, 25 Jun 2021 15:56:47 +0000
Subject: [PATCH 4/7] ignore input subsystem
---
rootdir/ueventd.rc | 3 ---
1 file changed, 3 deletions(-)
diff --git a/rootdir/ueventd.rc b/rootdir/ueventd.rc
index 3927501..404da8f 100644
--- a/rootdir/ueventd.rc
+++ b/rootdir/ueventd.rc
@@ -12,9 +12,6 @@ subsystem drm
devname uevent_devpath
dirname /dev/dri
-subsystem input
- devname uevent_devpath
- dirname /dev/input
subsystem sound
devname uevent_devpath
--
2.45.1

View File

@@ -0,0 +1,24 @@
From 349d72f45dceb997d14aab5119dabb1ee5e17f34 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 5/7] ignore devfs mount
---
init/first_stage_init.cpp | 1 -
1 file changed, 1 deletion(-)
diff --git a/init/first_stage_init.cpp b/init/first_stage_init.cpp
index 94faf87..a94667e 100644
--- a/init/first_stage_init.cpp
+++ b/init/first_stage_init.cpp
@@ -332,7 +332,6 @@ int FirstStageMain(int argc, char** argv) {
CHECKCALL(setenv("PATH", _PATH_DEFPATH, 1));
// 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.
- CHECKCALL(mount("tmpfs", "/dev", "tmpfs", MS_NOSUID, "mode=0755"));
CHECKCALL(mkdir("/dev/pts", 0755));
CHECKCALL(mkdir("/dev/socket", 0755));
CHECKCALL(mkdir("/dev/dm-user", 0755));
--
2.45.1

View File

@@ -0,0 +1,24 @@
From 433d9a9e80584054c0b7a91954c1e1f0cc61a434 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Thu, 6 Jan 2022 20:47:28 +0800
Subject: [PATCH 6/7] auto alloc binder devices
---
rootdir/init.rc | 1 +
1 file changed, 1 insertion(+)
diff --git a/rootdir/init.rc b/rootdir/init.rc
index dee7e34..a8adb5a 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -259,6 +259,7 @@ on init
mkdir /dev/binderfs
mount binder binder /dev/binderfs stats=global
chmod 0755 /dev/binderfs
+ exec -- /vendor/bin/binder_alloc /dev/binderfs/binder-control binder hwbinder vndbinder
# Mount fusectl
mount fusectl none /sys/fs/fuse/connections
--
2.45.1

View File

@@ -0,0 +1,24 @@
From a5a72f67cb4e0173002217dd47d898e8d3d62854 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sat, 2 Sep 2023 17:10:16 +0800
Subject: [PATCH 7/7] skip fusectl mount
---
rootdir/init.rc | 1 -
1 file changed, 1 deletion(-)
diff --git a/rootdir/init.rc b/rootdir/init.rc
index a8adb5a..3112f11 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -262,7 +262,6 @@ on init
exec -- /vendor/bin/binder_alloc /dev/binderfs/binder-control binder hwbinder vndbinder
# Mount fusectl
- mount fusectl none /sys/fs/fuse/connections
symlink /dev/binderfs/binder /dev/binder
symlink /dev/binderfs/hwbinder /dev/hwbinder
--
2.45.1

View File

@@ -0,0 +1,45 @@
From c9dc7236679d59f69a510f8afabed29fb1848ae6 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sun, 9 May 2021 23:44:12 +0800
Subject: [PATCH] fix booting
---
Binder.cpp | 1 +
ProcessState.cpp | 3 +++
2 files changed, 4 insertions(+)
diff --git a/Binder.cpp b/Binder.cpp
index 6d26414..b657a0b 100644
--- a/Binder.cpp
+++ b/Binder.cpp
@@ -96,6 +96,7 @@ bool BHwBinder::isRequestingSid() {
}
void BHwBinder::setRequestingSid(bool requestingSid) {
+ requestingSid = false; // HACKED
Extras* e = mExtras.load(std::memory_order_acquire);
if (!e) {
diff --git a/ProcessState.cpp b/ProcessState.cpp
index d02c3c0..846caac 100644
--- a/ProcessState.cpp
+++ b/ProcessState.cpp
@@ -127,12 +127,15 @@ void ProcessState::becomeContextManager()
{
AutoMutex _l(mLock);
+#if 0 // HACKED (?)
flat_binder_object obj {
.flags = FLAT_BINDER_FLAG_TXN_SECURITY_CTX,
};
status_t result = ioctl(mDriverFD, BINDER_SET_CONTEXT_MGR_EXT, &obj);
+#endif
+ status_t result = 1;
// fallback to original method
if (result != 0) {
android_errorWriteLog(0x534e4554, "121035042");
--
2.45.1

View File

@@ -0,0 +1,24 @@
From 5166fbe1273566f8e1f48117f293e4d36ede4ba7 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 1/2] ignore compatibility check
---
VintfObject.cpp | 1 -
1 file changed, 1 deletion(-)
diff --git a/VintfObject.cpp b/VintfObject.cpp
index cb123b3..d449c7f 100644
--- a/VintfObject.cpp
+++ b/VintfObject.cpp
@@ -738,7 +738,6 @@ int32_t VintfObject::checkCompatibility(std::string* error, CheckFlags::Type fla
error->insert(0,
"Runtime info and framework compatibility matrix are incompatible: ");
}
- return INCOMPATIBLE;
}
}
--
2.45.1

View File

@@ -0,0 +1,24 @@
From a261cbefc6525cb29c2f239ea34f88dd7e00197d Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Thu, 5 Sep 2024 19:05:14 +0800
Subject: [PATCH 2/2] ignore /proc/config.gz failed read
---
KernelConfigs.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/KernelConfigs.cpp b/KernelConfigs.cpp
index 3de65ea..3583d66 100644
--- a/KernelConfigs.cpp
+++ b/KernelConfigs.cpp
@@ -34,6 +34,7 @@ status_t LoadKernelConfigs(std::map<std::string, std::string>* configs) {
gzFile f = gzopen("/proc/config.gz", "rb");
if (f == NULL) {
LOG(ERROR) << "Could not open /proc/config.gz: " << errno;
+ errno = 0; // HACKED
return -errno;
}
--
2.45.1

View File

@@ -0,0 +1,50 @@
From 74ba7c71922a0a8b069c7804b09047eafb074cc0 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sat, 31 Jul 2021 06:14:33 +0000
Subject: [PATCH 1/3] ignore iptables error
---
server/BandwidthController.cpp | 1 +
server/Controllers.cpp | 1 -
server/IptablesRestoreController.cpp | 1 +
3 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/server/BandwidthController.cpp b/server/BandwidthController.cpp
index 8a96738..f1cbf14 100644
--- a/server/BandwidthController.cpp
+++ b/server/BandwidthController.cpp
@@ -527,6 +527,7 @@ int BandwidthController::updateQuota(const std::string& quotaName, int64_t bytes
if (!isOk(file)) {
int res = errno;
ALOGE("Updating quota %s failed (%s)", quotaName.c_str(), toString(file).c_str());
+ res = 0; // HACKED
return -res;
}
// TODO: should we propagate this error?
diff --git a/server/Controllers.cpp b/server/Controllers.cpp
index ea34897..be185ce 100644
--- a/server/Controllers.cpp
+++ b/server/Controllers.cpp
@@ -325,7 +325,6 @@ void Controllers::init() {
// As such simply exit netd. This may crash loop the system, but by failing
// to bootup we will trigger rollback and thus this offers us protection against
// a mainline update breaking things.
- exit(1);
}
gLog.info("Enabling bandwidth control: %" PRId64 "us", s.getTimeAndResetUs());
diff --git a/server/IptablesRestoreController.cpp b/server/IptablesRestoreController.cpp
index 49b48d3..07bdda4 100644
--- a/server/IptablesRestoreController.cpp
+++ b/server/IptablesRestoreController.cpp
@@ -349,6 +349,7 @@ int IptablesRestoreController::execute(const IptablesTarget target, const std::s
if (target == V6 || target == V4V6) {
res |= sendCommand(IP6TABLES_PROCESS, command, output);
}
+ res = 0; // ignore iptables error
return res;
}
--
2.45.1

View File

@@ -0,0 +1,24 @@
From 9c23d4c790c3de54c73f10ea096113865d7aa77d Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sun, 14 Aug 2022 11:53:19 +0800
Subject: [PATCH 2/3] ignore bpf error
---
server/main.cpp | 1 -
1 file changed, 1 deletion(-)
diff --git a/server/main.cpp b/server/main.cpp
index b0c5406..8ef2f19 100644
--- a/server/main.cpp
+++ b/server/main.cpp
@@ -145,7 +145,6 @@ int main() {
if (libnetd_updatable_init(cg2_path.c_str())) {
ALOGE("libnetd_updatable_init failed");
- exit(1);
}
gLog.info("libnetd_updatable_init success");
--
2.45.1

View File

@@ -0,0 +1,28 @@
From 8dc3ead00174559d3f09ae862a53b7e9e1fe7951 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sun, 14 Aug 2022 11:57:11 +0800
Subject: [PATCH 3/3] ignote getTetherStats error
---
server/TetherController.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/server/TetherController.cpp b/server/TetherController.cpp
index 03185e7..150da1c 100644
--- a/server/TetherController.cpp
+++ b/server/TetherController.cpp
@@ -913,9 +913,11 @@ StatusOr<TetherController::TetherStatsList> TetherController::getTetherStats() {
}
if (int ret = addForwardChainStats(statsList, statsString, parsedIptablesOutput)) {
+#if 0
return statusFromErrno(-ret, StringPrintf("failed to parse %s tether stats:\n%s",
target == V4 ? "IPv4": "IPv6",
parsedIptablesOutput.c_str()));
+#endif
}
}
--
2.45.1

View File

@@ -0,0 +1,24 @@
From 29840226e77a8d6381b4003d9474bfb2266a1495 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sat, 6 Aug 2022 10:19:11 +0800
Subject: [PATCH] ignore project quota error
---
Utils.cpp | 1 -
1 file changed, 1 deletion(-)
diff --git a/Utils.cpp b/Utils.cpp
index 696b0b4..42f05a1 100644
--- a/Utils.cpp
+++ b/Utils.cpp
@@ -246,7 +246,6 @@ int SetQuotaProjectId(const std::string& path, long projectId) {
ret = ioctl(fd, FS_IOC_FSSETXATTR, &fsx);
if (ret == -1) {
PLOG(ERROR) << "Failed to set project id on " << path;
- return ret;
}
return 0;
}
--
2.45.1

View File

@@ -0,0 +1,32 @@
From 5ea8050366c4bf2136983f6b9dff4ee35f65b598 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 bb60904..efe8be2 100644
--- a/libminijail.c
+++ b/libminijail.c
@@ -2487,6 +2487,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 ||
j->flags.seccomp_filter_allow_speculation) {
@@ -2508,6 +2509,7 @@ static void set_seccomp_filter(const struct minijail *j)
}
}
}
+#endif
}
static pid_t forward_pid = -1;
--
2.49.0

View File

@@ -0,0 +1,165 @@
From 0b7cc7e1d8433431c1ecf9c1058b70370c89a6a6 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sun, 9 May 2021 23:44:12 +0800
Subject: [PATCH] ignore selinux
---
libselinux/include/selinux/selinux.h | 4 ++++
libselinux/src/checkAccess.c | 1 +
libselinux/src/getenforce.c | 1 +
libselinux/src/getfilecon.c | 1 +
libselinux/src/getpeercon.c | 1 +
libselinux/src/init.c | 1 +
libselinux/src/label.c | 1 +
libselinux/src/lgetfilecon.c | 1 +
libselinux/src/lsetfilecon.c | 1 +
libselinux/src/procattr.c | 2 ++
libselinux/src/sestatus.c | 1 +
11 files changed, 15 insertions(+)
diff --git a/libselinux/include/selinux/selinux.h b/libselinux/include/selinux/selinux.h
index 50419a7..01e4a3f 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/checkAccess.c b/libselinux/src/checkAccess.c
index 022cd6b..a23bffc 100644
--- a/libselinux/src/checkAccess.c
+++ b/libselinux/src/checkAccess.c
@@ -20,6 +20,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 3f1e200..bf16227 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/getfilecon.c b/libselinux/src/getfilecon.c
index 4bee313..f8b159a 100644
--- a/libselinux/src/getfilecon.c
+++ b/libselinux/src/getfilecon.c
@@ -52,6 +52,7 @@ int getfilecon_raw(const char *path, char ** context)
int getfilecon(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/getpeercon.c b/libselinux/src/getpeercon.c
index a9dca73..10771cb 100644
--- a/libselinux/src/getpeercon.c
+++ b/libselinux/src/getpeercon.c
@@ -46,6 +46,7 @@ int getpeercon_raw(int fd, char ** context)
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 439da41..41268a7 100644
--- a/libselinux/src/init.c
+++ b/libselinux/src/init.c
@@ -139,6 +139,7 @@ void fini_selinuxmnt(void)
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 08bbac2..c87f05a 100644
--- a/libselinux/src/label.c
+++ b/libselinux/src/label.c
@@ -303,6 +303,7 @@ bool selabel_hash_all_partial_matches(struct selabel_handle *rec,
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 d1fb821..0d3b0ac 100644
--- a/libselinux/src/lgetfilecon.c
+++ b/libselinux/src/lgetfilecon.c
@@ -52,6 +52,7 @@ int lgetfilecon_raw(const char *path, char ** context)
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 213fb68..c73c152 100644
--- a/libselinux/src/lsetfilecon.c
+++ b/libselinux/src/lsetfilecon.c
@@ -28,6 +28,7 @@ int lsetfilecon_raw(const char *path, const char * context)
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 b7a93a2..a1478c7 100644
--- a/libselinux/src/procattr.c
+++ b/libselinux/src/procattr.c
@@ -175,6 +175,7 @@ static int getprocattrcon_raw(char **context, pid_t pid, const char *attr,
static int getprocattrcon(char **context, pid_t pid, const char *attr,
const char *prev_context)
{
+ se_hack1((*context = calloc(7, 1), memcpy(*context, "HACKED", 6), 0));
int ret;
char * rcontext;
@@ -239,6 +240,7 @@ out:
static int setprocattrcon(const char *context, const char *attr,
char **prev_context)
{
+ se_hack1(0);
int ret;
char * rcontext;
diff --git a/libselinux/src/sestatus.c b/libselinux/src/sestatus.c
index fbe6430..bafe6bb 100644
--- a/libselinux/src/sestatus.c
+++ b/libselinux/src/sestatus.c
@@ -277,6 +277,7 @@ static int fallback_cb_policyload(int policyload)
*/
int selinux_status_open(int fallback)
{
+ se_hack1(0);
int fd;
char path[PATH_MAX];
long pagesize;
--
2.49.0

View File

@@ -0,0 +1,48 @@
From 14d223ce17fe490c75145130bcb11a2c80365f15 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Mon, 20 Sep 2021 18:22:20 +0000
Subject: [PATCH 1/2] ? workaround for mesa video playback
---
media/libstagefright/colorconversion/SoftwareRenderer.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/media/libstagefright/colorconversion/SoftwareRenderer.cpp b/media/libstagefright/colorconversion/SoftwareRenderer.cpp
index 2409315..1e3ec7b 100644
--- a/media/libstagefright/colorconversion/SoftwareRenderer.cpp
+++ b/media/libstagefright/colorconversion/SoftwareRenderer.cpp
@@ -130,6 +130,7 @@ void SoftwareRenderer::resetFormatIfChanged(
// 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:
@@ -139,6 +140,7 @@ void SoftwareRenderer::resetFormatIfChanged(
bufHeight = (mCropHeight + 1) & ~1;
break;
}
+#endif
case OMX_COLOR_Format24bitRGB888:
{
halFormat = HAL_PIXEL_FORMAT_RGB_888;
@@ -154,6 +156,7 @@ void SoftwareRenderer::resetFormatIfChanged(
bufHeight = (mCropHeight + 1) & ~1;
break;
}
+#if 0 // HACKED
case OMX_COLOR_FormatYUV420Planar16:
{
if (((dataSpace & HAL_DATASPACE_STANDARD_MASK) == HAL_DATASPACE_STANDARD_BT2020)
@@ -170,6 +173,7 @@ void SoftwareRenderer::resetFormatIfChanged(
bufHeight = (mCropHeight + 1) & ~1;
break;
}
+#endif
default:
{
break;
--
2.49.0

View File

@@ -0,0 +1,76 @@
From 5145109bb45c69e61d424f5aecf2186283f86ad4 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sat, 6 Aug 2022 10:17:12 +0800
Subject: [PATCH 2/2] bring back OMX nodes
users may use legacy kernel without `ION` / `DMABUF_HEAP` enabled,
enable OMX nodes to support this.
---
media/libstagefright/omx/Android.bp | 1 -
media/libstagefright/omx/OMXStore.cpp | 1 -
services/mediacodec/Android.bp | 25 +++++++++++++++++++++++++
3 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/media/libstagefright/omx/Android.bp b/media/libstagefright/omx/Android.bp
index 630817c..23d1b1a 100644
--- a/media/libstagefright/omx/Android.bp
+++ b/media/libstagefright/omx/Android.bp
@@ -183,7 +183,6 @@ cc_defaults {
name: "libstagefright_softomx-defaults",
// TODO (b/316432618) Software OMX codecs are no longer used, disable building them till
// this code is removed completely.
- enabled: false,
vendor_available: true,
cflags: [
diff --git a/media/libstagefright/omx/OMXStore.cpp b/media/libstagefright/omx/OMXStore.cpp
index b2d5a70..3be56c8 100644
--- a/media/libstagefright/omx/OMXStore.cpp
+++ b/media/libstagefright/omx/OMXStore.cpp
@@ -161,7 +161,6 @@ void OMXStore::addPlugin(OMXPluginBase *plugin) {
}
}
if (skip) {
- continue;
}
}
diff --git a/services/mediacodec/Android.bp b/services/mediacodec/Android.bp
index 506b3bc..a2f17c2 100644
--- a/services/mediacodec/Android.bp
+++ b/services/mediacodec/Android.bp
@@ -95,6 +95,31 @@ cc_binary {
"android.hidl.memory@1.0",
],
+ runtime_libs: [
+ "libstagefright_soft_aacdec",
+ "libstagefright_soft_aacenc",
+ "libstagefright_soft_amrdec",
+ "libstagefright_soft_amrnbenc",
+ "libstagefright_soft_amrwbenc",
+ "libstagefright_soft_avcdec",
+ "libstagefright_soft_avcenc",
+ "libstagefright_soft_flacdec",
+ "libstagefright_soft_flacenc",
+ "libstagefright_soft_g711dec",
+ "libstagefright_soft_gsmdec",
+ "libstagefright_soft_hevcdec",
+ "libstagefright_soft_mp3dec",
+ "libstagefright_soft_mpeg2dec",
+ "libstagefright_soft_mpeg4dec",
+ "libstagefright_soft_mpeg4enc",
+ "libstagefright_soft_opusdec",
+ "libstagefright_soft_rawdec",
+ "libstagefright_soft_vorbisdec",
+ "libstagefright_soft_vpxdec",
+ "libstagefright_soft_vpxenc",
+ "libstagefright_softomx_plugin",
+ ],
+
// OMX interfaces force this to stay in 32-bit mode;
compile_multilib: "32",
--
2.49.0

View File

@@ -0,0 +1,25 @@
From 22e830fea7d4fe6e962ff0f095846d44f46207a4 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sat, 11 Nov 2023 10:30:11 +0800
Subject: [PATCH] ignore cgroup error
---
services/core/java/com/android/server/am/ProcessList.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/services/core/java/com/android/server/am/ProcessList.java b/services/core/java/com/android/server/am/ProcessList.java
index 70febcd63..3cb2b5934 100644
--- a/services/core/java/com/android/server/am/ProcessList.java
+++ b/services/core/java/com/android/server/am/ProcessList.java
@@ -2598,7 +2598,7 @@ public final class ProcessList {
"Unable to create process group for "
+ app.processName + " (" + startResult.pid + ")");
} else {
- throw new AssertionError("Unable to create process group for "
+ Slog.e(ActivityManagerService.TAG, "Unable to create process group for "
+ app.processName + " (" + startResult.pid + ")");
}
} else {
--
2.49.0

View File

@@ -0,0 +1,169 @@
From: CoderKang <CoderKang@hotmail.com>
Date: Fri, 19 Sep 2025 10:00:00 +0800
Subject: [PATCH] Add custom GPS location from file
---
diff --git a/services/core/jni/com_android_server_location_GnssLocationProvider.cpp b/services/core/jni/com_android_server_location_GnssLocationProvider.cpp
index a95a4a8..10eae12 100644
--- a/services/core/jni/com_android_server_location_GnssLocationProvider.cpp
+++ b/services/core/jni/com_android_server_location_GnssLocationProvider.cpp
@@ -66,6 +66,9 @@
#include "jni.h"
#include "utils/Log.h"
#include "utils/misc.h"
+#include <fstream>
+#include <sstream>
+#include <sys/stat.h>
static jclass class_gnssPowerStats;
@@ -75,6 +78,79 @@ static jmethodID method_isInEmergencySession;
static jmethodID method_gnssPowerStatsCtor;
static jmethodID method_setSubHalPowerIndicationCapabilities;
+// Custom GPS location from file
+static double customLatitude = 0.0;
+static double customLongitude = 0.0;
+static bool useCustomLocation = false;
+static time_t lastFileModTime = 0;
+static const char* GPS_LOCATION_FILE = "/data/vendor/gps/custom_location.txt";
+
+// Function to read GPS coordinates from file
+static bool readGpsLocationFromFile() {
+ struct stat fileStat;
+ if (stat(GPS_LOCATION_FILE, &fileStat) != 0) {
+ // File doesn't exist, disable custom location
+ useCustomLocation = false;
+ return false;
+ }
+
+ // Check if file has been modified
+ if (fileStat.st_mtime <= lastFileModTime) {
+ return useCustomLocation; // No change in file
+ }
+
+ std::ifstream file(GPS_LOCATION_FILE);
+ if (!file.is_open()) {
+ ALOGE("Failed to open GPS location file: %s", GPS_LOCATION_FILE);
+ useCustomLocation = false;
+ return false;
+ }
+
+ std::string line;
+ if (std::getline(file, line)) {
+ std::istringstream iss(line);
+ std::string latStr, lonStr;
+
+ // Expected format: "latitude,longitude" or "latitude longitude"
+ if (std::getline(iss, latStr, ',') && std::getline(iss, lonStr)) {
+ // Comma-separated format
+ } else {
+ // Space-separated format
+ iss.clear();
+ iss.str(line);
+ iss >> latStr >> lonStr;
+ }
+
+ // Use strtod for exception-free parsing
+ char* latEnd;
+ char* lonEnd;
+ double lat = strtod(latStr.c_str(), &latEnd);
+ double lon = strtod(lonStr.c_str(), &lonEnd);
+
+ // Check if parsing was successful (no leftover characters)
+ if (*latEnd == '\0' && *lonEnd == '\0') {
+ // Validate coordinates
+ if (lat >= -90.0 && lat <= 90.0 && lon >= -180.0 && lon <= 180.0) {
+ customLatitude = lat;
+ customLongitude = lon;
+ useCustomLocation = true;
+ lastFileModTime = fileStat.st_mtime;
+ ALOGI("Custom GPS location loaded: lat=%.6f, lon=%.6f", lat, lon);
+ file.close();
+ return true;
+ } else {
+ ALOGE("Invalid GPS coordinates: lat=%.6f, lon=%.6f", lat, lon);
+ }
+ } else {
+ ALOGE("Failed to parse GPS coordinates from file");
+ }
+ }
+
+ file.close();
+ useCustomLocation = false;
+ return false;
+}
+
using android::OK;
using android::sp;
using android::status_t;
@@ -377,6 +453,9 @@ static jboolean android_location_gnss_hal_GnssNative_set_position_mode(
}
static jboolean android_location_gnss_hal_GnssNative_start(JNIEnv* /* env */, jclass) {
+ // Try to read custom GPS location from file when GNSS starts
+ readGpsLocationFromFile();
+
return gnssHal->start();
}
@@ -457,12 +536,24 @@ static void android_location_gnss_hal_GnssNative_inject_best_location(
jfloat speedAccuracyMetersPerSecond, jfloat bearingAccuracyDegrees, jlong timestamp,
jint elapsedRealtimeFlags, jlong elapsedRealtimeNanos,
jdouble elapsedRealtimeUncertaintyNanos) {
- gnssHal->injectBestLocation(gnssLocationFlags, latitudeDegrees, longitudeDegrees,
- altitudeMeters, speedMetersPerSec, bearingDegrees,
- horizontalAccuracyMeters, verticalAccuracyMeters,
- speedAccuracyMetersPerSecond, bearingAccuracyDegrees, timestamp,
- elapsedRealtimeFlags, elapsedRealtimeNanos,
- elapsedRealtimeUncertaintyNanos);
+
+ // Check for custom GPS location from file
+ if (readGpsLocationFromFile()) {
+ ALOGI("Using custom GPS location: lat=%.6f, lon=%.6f", customLatitude, customLongitude);
+ gnssHal->injectBestLocation(gnssLocationFlags, customLatitude, customLongitude,
+ altitudeMeters, speedMetersPerSec, bearingDegrees,
+ horizontalAccuracyMeters, verticalAccuracyMeters,
+ speedAccuracyMetersPerSecond, bearingAccuracyDegrees, timestamp,
+ elapsedRealtimeFlags, elapsedRealtimeNanos,
+ elapsedRealtimeUncertaintyNanos);
+ } else {
+ gnssHal->injectBestLocation(gnssLocationFlags, latitudeDegrees, longitudeDegrees,
+ altitudeMeters, speedMetersPerSec, bearingDegrees,
+ horizontalAccuracyMeters, verticalAccuracyMeters,
+ speedAccuracyMetersPerSecond, bearingAccuracyDegrees, timestamp,
+ elapsedRealtimeFlags, elapsedRealtimeNanos,
+ elapsedRealtimeUncertaintyNanos);
+ }
}
static void android_location_gnss_hal_GnssNative_inject_location(
@@ -472,11 +563,22 @@ static void android_location_gnss_hal_GnssNative_inject_location(
jfloat speedAccuracyMetersPerSecond, jfloat bearingAccuracyDegrees, jlong timestamp,
jint elapsedRealtimeFlags, jlong elapsedRealtimeNanos,
jdouble elapsedRealtimeUncertaintyNanos) {
- gnssHal->injectLocation(gnssLocationFlags, latitudeDegrees, longitudeDegrees, altitudeMeters,
- speedMetersPerSec, bearingDegrees, horizontalAccuracyMeters,
- verticalAccuracyMeters, speedAccuracyMetersPerSecond,
- bearingAccuracyDegrees, timestamp, elapsedRealtimeFlags,
- elapsedRealtimeNanos, elapsedRealtimeUncertaintyNanos);
+
+ // Check for custom GPS location from file
+ if (readGpsLocationFromFile()) {
+ ALOGI("Using custom GPS location: lat=%.6f, lon=%.6f", customLatitude, customLongitude);
+ gnssHal->injectLocation(gnssLocationFlags, customLatitude, customLongitude, altitudeMeters,
+ speedMetersPerSec, bearingDegrees, horizontalAccuracyMeters,
+ verticalAccuracyMeters, speedAccuracyMetersPerSecond,
+ bearingAccuracyDegrees, timestamp, elapsedRealtimeFlags,
+ elapsedRealtimeNanos, elapsedRealtimeUncertaintyNanos);
+ } else {
+ gnssHal->injectLocation(gnssLocationFlags, latitudeDegrees, longitudeDegrees, altitudeMeters,
+ speedMetersPerSec, bearingDegrees, horizontalAccuracyMeters,
+ verticalAccuracyMeters, speedAccuracyMetersPerSecond,
+ bearingAccuracyDegrees, timestamp, elapsedRealtimeFlags,
+ elapsedRealtimeNanos, elapsedRealtimeUncertaintyNanos);
+ }
}
static jboolean android_location_gnss_hal_GnssNative_supports_psds(JNIEnv* /* env */, jclass) {

View File

@@ -0,0 +1,59 @@
From c81007a9003203a45f0c43cc33431b9a7dc93af4 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sun, 9 May 2021 23:04:00 +0800
Subject: [PATCH] fix booting
---
libs/binder/Binder.cpp | 1 +
libs/binder/IPCThreadState.cpp | 2 +-
libs/binder/ProcessState.cpp | 3 +++
3 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/libs/binder/Binder.cpp b/libs/binder/Binder.cpp
index 53bd08d..c779108 100644
--- a/libs/binder/Binder.cpp
+++ b/libs/binder/Binder.cpp
@@ -522,6 +522,7 @@ void BBinder::setRequestingSid(bool requestingSid)
"setRequestingSid() should not be called after a binder object "
"is parceled/sent to another process");
+ requestingSid = false; // HACKED
Extras* e = mExtras.load(std::memory_order_acquire);
if (!e) {
diff --git a/libs/binder/IPCThreadState.cpp b/libs/binder/IPCThreadState.cpp
index 6698d0c..694729a 100644
--- a/libs/binder/IPCThreadState.cpp
+++ b/libs/binder/IPCThreadState.cpp
@@ -1441,7 +1441,7 @@ status_t IPCThreadState::executeCommand(int32_t cmd)
clearPropagateWorkSource();
mCallingPid = tr.sender_pid;
- mCallingSid = reinterpret_cast<const char*>(tr_secctx.secctx);
+ mCallingSid = "HACKED";
mCallingUid = tr.sender_euid;
mHasExplicitIdentity = false;
mLastTransactionBinderFlags = tr.flags;
diff --git a/libs/binder/ProcessState.cpp b/libs/binder/ProcessState.cpp
index 5e7f151..83bae2c 100644
--- a/libs/binder/ProcessState.cpp
+++ b/libs/binder/ProcessState.cpp
@@ -225,12 +225,15 @@ bool ProcessState::becomeContextManager()
{
std::unique_lock<std::mutex> _l(mLock);
+#if 0
flat_binder_object obj {
.flags = FLAT_BINDER_FLAG_TXN_SECURITY_CTX,
};
int result = ioctl(mDriverFD, BINDER_SET_CONTEXT_MGR_EXT, &obj);
+#endif
+ int result = 1;
// fallback to original method
if (result != 0) {
android_errorWriteLog(0x534e4554, "121035042");
--
2.49.0

View File

@@ -0,0 +1,58 @@
From 57886dfd33234781b54c9ed6643b9b8e0c7d9196 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Thu, 5 Oct 2023 22:18:09 +0800
Subject: [PATCH 1/2] fix booting
---
bpf/loader/NetBpfLoad.cpp | 8 ++++++--
.../com_android_server_connectivity_ClatCoordinator.cpp | 1 +
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/bpf/loader/NetBpfLoad.cpp b/bpf/loader/NetBpfLoad.cpp
index 4834b09..edd76f2 100644
--- a/bpf/loader/NetBpfLoad.cpp
+++ b/bpf/loader/NetBpfLoad.cpp
@@ -1601,12 +1601,14 @@ static int doLoad(char** argv, char * const envp[]) {
// kernel does not have CONFIG_BPF_JIT=y)
// BPF_JIT is required by R VINTF (which means 4.14/4.19/5.4 kernels),
// but 4.14/4.19 were released with P & Q, and only 5.4 is new in R+.
- if (writeProcSysFile("/proc/sys/net/core/bpf_jit_enable", "1\n")) return 1;
+ if (writeProcSysFile("/proc/sys/net/core/bpf_jit_enable", "1\n"))
+ ALOGE("write 1 to /proc/sys/net/core/bpf_jit_enable FAILED");
// Enable JIT kallsyms export for privileged users only
// (Note: this (open) will fail with ENOENT 'No such file or directory' if
// kernel does not have CONFIG_HAVE_EBPF_JIT=y)
- if (writeProcSysFile("/proc/sys/net/core/bpf_jit_kallsyms", "1\n")) return 1;
+ if (writeProcSysFile("/proc/sys/net/core/bpf_jit_kallsyms", "1\n"))
+ ALOGE("write 1 to /proc/sys/net/core/bpf_jit_kallsyms FAILED");
}
// Create all the pin subdirectories
@@ -1631,9 +1633,11 @@ static int doLoad(char** argv, char * const envp[]) {
ALOGE("If this triggers reliably, you're probably missing kernel options or patches.");
ALOGE("If this triggers randomly, you might be hitting some memory allocation "
"problems or startup script race.");
+ #if 0
ALOGE("--- DO NOT EXPECT SYSTEM TO BOOT SUCCESSFULLY ---");
sleep(20);
return 2;
+ #endif
}
}
diff --git a/service/jni/com_android_server_connectivity_ClatCoordinator.cpp b/service/jni/com_android_server_connectivity_ClatCoordinator.cpp
index c0082bb..6144b21 100644
--- a/service/jni/com_android_server_connectivity_ClatCoordinator.cpp
+++ b/service/jni/com_android_server_connectivity_ClatCoordinator.cpp
@@ -132,6 +132,7 @@ static void verifyClatPerms() {
#undef V2
+ fatal = false;
if (fatal) abort();
}
--
2.49.0

View File

@@ -0,0 +1,24 @@
From 0ce8ef0cfc86e791b449bc106159dd0e9dcdb475 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Thu, 5 Sep 2024 19:11:19 +0800
Subject: [PATCH 2/2] ignore nativeSynchronizeKernelRCU error
---
.../native/bpfmapjni/com_android_net_module_util_BpfMap.cpp | 1 -
1 file changed, 1 deletion(-)
diff --git a/staticlibs/native/bpfmapjni/com_android_net_module_util_BpfMap.cpp b/staticlibs/native/bpfmapjni/com_android_net_module_util_BpfMap.cpp
index d862f6b..8f5ecdf 100644
--- a/staticlibs/native/bpfmapjni/com_android_net_module_util_BpfMap.cpp
+++ b/staticlibs/native/bpfmapjni/com_android_net_module_util_BpfMap.cpp
@@ -140,7 +140,6 @@ static void com_android_net_module_util_BpfMap_nativeSynchronizeKernelRCU(JNIEnv
const int pfSocket = socket(AF_KEY, SOCK_RAW | SOCK_CLOEXEC, PF_KEY_V2);
if (pfSocket < 0) {
- jniThrowErrnoException(env, "nativeSynchronizeKernelRCU:socket", errno);
return;
}
--
2.49.0

View File

@@ -0,0 +1,29 @@
From d3b2c6e9f8f09b76991b32436240930ba875f5ff Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sun, 15 Jun 2025 19:29:19 +0800
Subject: [PATCH] fix booting
Change-Id: I01e3abbbd3e879f9880177f1bb43ab634df0aec8
---
loader/Loader.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/loader/Loader.cpp b/loader/Loader.cpp
index 09e2e17..1519312 100644
--- a/loader/Loader.cpp
+++ b/loader/Loader.cpp
@@ -1001,9 +1001,11 @@ void legacyBpfLoader() {
ALOGE("If this triggers reliably, you're probably missing kernel options or patches.");
ALOGE("If this triggers randomly, you might be hitting some memory allocation "
"problems or startup script race.");
+ #if 0
ALOGE("--- DO NOT EXPECT SYSTEM TO BOOT SUCCESSFULLY ---");
sleep(20);
exit(121);
+ #endif
}
}
}
--
2.49.0

View File

@@ -0,0 +1,125 @@
From 8752fb343d0eee9023b119998e07a2b69b878b96 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sun, 9 May 2021 23:09:00 +0800
Subject: [PATCH 1/7] fix booting
---
fs_mgr/libfstab/boot_config.cpp | 6 ++++--
init/first_stage_init.cpp | 18 +++++++++++++++---
init/init.cpp | 0
init/property_service.cpp | 0
init/service.cpp | 1 +
rootdir/init.rc | 1 -
6 files changed, 20 insertions(+), 6 deletions(-)
mode change 100644 => 100755 init/init.cpp
mode change 100644 => 100755 init/property_service.cpp
diff --git a/fs_mgr/libfstab/boot_config.cpp b/fs_mgr/libfstab/boot_config.cpp
index b21495e..7993d15 100644
--- a/fs_mgr/libfstab/boot_config.cpp
+++ b/fs_mgr/libfstab/boot_config.cpp
@@ -154,13 +154,15 @@ bool GetKernelCmdlineFromString(const std::string& cmdline, const std::string& k
void ImportKernelCmdline(const std::function<void(std::string, std::string)>& 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
ImportKernelCmdlineFromString(android::base::Trim(cmdline), fn);
}
bool GetKernelCmdline(const std::string& key, std::string* out) {
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
return GetKernelCmdlineFromString(android::base::Trim(cmdline), key, out);
}
diff --git a/init/first_stage_init.cpp b/init/first_stage_init.cpp
index e06a645..6406662 100644
--- a/init/first_stage_init.cpp
+++ b/init/first_stage_init.cpp
@@ -36,6 +36,7 @@
#include <android-base/chrono_utils.h>
#include <android-base/file.h>
#include <android-base/logging.h>
+#include <android-base/strings.h>
#include <android-base/stringprintf.h>
#include <android/avf_cc_flags.h>
#include <fs_mgr.h>
@@ -352,6 +353,8 @@ int FirstStageMain(int argc, char** argv) {
CHECKCALL(mkdir("/dev/pts", 0755));
CHECKCALL(mkdir("/dev/socket", 0755));
CHECKCALL(mkdir("/dev/dm-user", 0755));
+ mount("/system/etc", "/etc", "none", MS_BIND, NULL); // cgroup fix
+ unshare(CLONE_NEWCGROUP);
CHECKCALL(mount("devpts", "/dev/pts", "devpts", 0, NULL));
#define MAKE_STR(x) __STRING(x)
CHECKCALL(mount("proc", "/proc", "proc", 0, "hidepid=2,gid=" MAKE_STR(AID_READPROC)));
@@ -420,7 +423,6 @@ int FirstStageMain(int argc, char** argv) {
for (const auto& [error_string, error_errno] : errors) {
LOG(ERROR) << error_string << " " << strerror(error_errno);
}
- LOG(FATAL) << "Init encountered errors starting first stage, aborting";
}
LOG(INFO) << "init first stage started!";
@@ -557,12 +559,22 @@ int FirstStageMain(int argc, char** argv) {
1);
const char* path = "/system/bin/init";
- const char* args[] = {path, "selinux_setup", nullptr};
+ std::vector<const char *> args = {path, "second_stage"};
+ std::string init_cmdline;
+ android::base::ReadFileToString("/proc/self/cmdline", &init_cmdline);
+ std::replace(init_cmdline.begin(), init_cmdline.end(), '\0', ' ');
+ auto cmd_vector = android::base::Split(android::base::Trim(init_cmdline), " ");
+ int i = 0;
+ for (const auto& entry : cmd_vector) {
+ if (i++ == 0) continue; // ignore first arg '/init'
+ args.push_back(entry.c_str());
+ }
+ args.push_back(nullptr);
auto fd = open("/dev/kmsg", O_WRONLY | O_CLOEXEC);
dup2(fd, STDOUT_FILENO);
dup2(fd, STDERR_FILENO);
close(fd);
- execv(path, const_cast<char**>(args));
+ 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/init.cpp b/init/init.cpp
old mode 100644
new mode 100755
diff --git a/init/property_service.cpp b/init/property_service.cpp
old mode 100644
new mode 100755
diff --git a/init/service.cpp b/init/service.cpp
index d76a5d5..cb82838 100644
--- a/init/service.cpp
+++ b/init/service.cpp
@@ -76,6 +76,7 @@ namespace android {
namespace init {
static Result<std::string> ComputeContextFromExecutable(const std::string& service_path) {
+ se_hack1("HACKED");
std::string computed_context;
char* raw_con = nullptr;
diff --git a/rootdir/init.rc b/rootdir/init.rc
index ae6a658..32c6069 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -543,7 +543,6 @@ on post-fs
# Once everything is setup, no need to modify /.
# The bind+remount combination allows this to work in containers.
- mount rootfs rootfs / remount bind ro nodev
# Mount default storage into root namespace
mount none /mnt/user/0 /storage bind rec
--
2.49.0

View File

@@ -0,0 +1,25 @@
From 6357580325e58681df67299b1a2ad33ea3357858 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sat, 26 Jun 2021 05:42:24 +0000
Subject: [PATCH 2/7] allow override ro.* prop
---
init/property_service.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/init/property_service.cpp b/init/property_service.cpp
index f2606e3..48ada9a 100755
--- a/init/property_service.cpp
+++ b/init/property_service.cpp
@@ -1393,6 +1393,8 @@ static void ProcessKernelCmdline() {
android::fs_mgr::ImportKernelCmdline([&](const std::string& key, const std::string& value) {
if (StartsWith(key, ANDROIDBOOT_PREFIX)) {
InitPropertySet("ro.boot." + key.substr(ANDROIDBOOT_PREFIX.size()), value);
+ } else if (StartsWith(key, "ro.")) {
+ InitPropertySet(key, value);
}
});
}
--
2.49.0

View File

@@ -0,0 +1,35 @@
From b2e9c123e0dd39ddc0cc46be441cfa317bfd4f22 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sun, 27 Jun 2021 09:49:22 +0000
Subject: [PATCH 3/7] ? fix first stage mount
---
init/first_stage_init.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/init/first_stage_init.cpp b/init/first_stage_init.cpp
index 6406662..13c7553 100644
--- a/init/first_stage_init.cpp
+++ b/init/first_stage_init.cpp
@@ -530,6 +530,7 @@ int FirstStageMain(int argc, char** argv) {
if (!fsm) {
fsm = CreateFirstStageMount(cmdline);
}
+ #if 0
if (!fsm) {
LOG(FATAL) << "FirstStageMount not available";
}
@@ -539,8 +540,9 @@ int FirstStageMain(int argc, char** argv) {
}
if (!fsm->DoFirstStageMount()) {
- LOG(FATAL) << "Failed to mount required partitions early ...";
+ LOG(ERROR) << "Failed to mount required partitions early ...";
}
+ #endif
}
struct stat new_root_info {};
--
2.49.0

View File

@@ -0,0 +1,26 @@
From b6d58065e28607b34313e277b94b653cfa4b2224 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Fri, 25 Jun 2021 15:56:47 +0000
Subject: [PATCH 4/7] ignore input subsystem
---
rootdir/ueventd.rc | 3 ---
1 file changed, 3 deletions(-)
diff --git a/rootdir/ueventd.rc b/rootdir/ueventd.rc
index 3927501..404da8f 100644
--- a/rootdir/ueventd.rc
+++ b/rootdir/ueventd.rc
@@ -12,9 +12,6 @@ subsystem drm
devname uevent_devpath
dirname /dev/dri
-subsystem input
- devname uevent_devpath
- dirname /dev/input
subsystem sound
devname uevent_devpath
--
2.49.0

View File

@@ -0,0 +1,24 @@
From 26be568b5c1a7823737e1c4f6f8be198b4c8bf2d 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 5/7] ignore devfs mount
---
init/first_stage_init.cpp | 1 -
1 file changed, 1 deletion(-)
diff --git a/init/first_stage_init.cpp b/init/first_stage_init.cpp
index 13c7553..8485b3d 100644
--- a/init/first_stage_init.cpp
+++ b/init/first_stage_init.cpp
@@ -349,7 +349,6 @@ int FirstStageMain(int argc, char** argv) {
CHECKCALL(setenv("PATH", _PATH_DEFPATH, 1));
// 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.
- CHECKCALL(mount("tmpfs", "/dev", "tmpfs", MS_NOSUID, "mode=0755"));
CHECKCALL(mkdir("/dev/pts", 0755));
CHECKCALL(mkdir("/dev/socket", 0755));
CHECKCALL(mkdir("/dev/dm-user", 0755));
--
2.49.0

View File

@@ -0,0 +1,24 @@
From 6cedb36480a13deb50fa49a22f6fcef55905f73a Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Thu, 6 Jan 2022 20:47:28 +0800
Subject: [PATCH 6/7] auto alloc binder devices
---
rootdir/init.rc | 1 +
1 file changed, 1 insertion(+)
diff --git a/rootdir/init.rc b/rootdir/init.rc
index 32c6069..ab844ea 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -220,6 +220,7 @@ on init
mkdir /dev/binderfs
mount binder binder /dev/binderfs stats=global
chmod 0755 /dev/binderfs
+ exec -- /vendor/bin/binder_alloc /dev/binderfs/binder-control binder hwbinder vndbinder
# Mount fusectl
mount fusectl none /sys/fs/fuse/connections
--
2.49.0

View File

@@ -0,0 +1,24 @@
From 9687a7aec8c8bddc14a2464bd7d45b5ca22244d0 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sat, 2 Sep 2023 17:10:16 +0800
Subject: [PATCH 7/7] skip fusectl mount
---
rootdir/init.rc | 1 -
1 file changed, 1 deletion(-)
diff --git a/rootdir/init.rc b/rootdir/init.rc
index ab844ea..fba2f32 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -223,7 +223,6 @@ on init
exec -- /vendor/bin/binder_alloc /dev/binderfs/binder-control binder hwbinder vndbinder
# Mount fusectl
- mount fusectl none /sys/fs/fuse/connections
symlink /dev/binderfs/binder /dev/binder
symlink /dev/binderfs/hwbinder /dev/hwbinder
--
2.49.0

View File

@@ -0,0 +1,45 @@
From 3bba0a409b16bf06ba09d45ed4836f8d5b779498 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sun, 9 May 2021 23:44:12 +0800
Subject: [PATCH] fix booting
---
Binder.cpp | 1 +
ProcessState.cpp | 3 +++
2 files changed, 4 insertions(+)
diff --git a/Binder.cpp b/Binder.cpp
index 6d26414..b657a0b 100644
--- a/Binder.cpp
+++ b/Binder.cpp
@@ -96,6 +96,7 @@ bool BHwBinder::isRequestingSid() {
}
void BHwBinder::setRequestingSid(bool requestingSid) {
+ requestingSid = false; // HACKED
Extras* e = mExtras.load(std::memory_order_acquire);
if (!e) {
diff --git a/ProcessState.cpp b/ProcessState.cpp
index d02c3c0..846caac 100644
--- a/ProcessState.cpp
+++ b/ProcessState.cpp
@@ -127,12 +127,15 @@ void ProcessState::becomeContextManager()
{
AutoMutex _l(mLock);
+#if 0 // HACKED (?)
flat_binder_object obj {
.flags = FLAT_BINDER_FLAG_TXN_SECURITY_CTX,
};
status_t result = ioctl(mDriverFD, BINDER_SET_CONTEXT_MGR_EXT, &obj);
+#endif
+ status_t result = 1;
// fallback to original method
if (result != 0) {
android_errorWriteLog(0x534e4554, "121035042");
--
2.49.0

View File

@@ -0,0 +1,24 @@
From 05280bbcc0c2fc80f7bff7c19dad62e6ba7d9b1b 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 1/2] ignore compatibility check
---
VintfObject.cpp | 1 -
1 file changed, 1 deletion(-)
diff --git a/VintfObject.cpp b/VintfObject.cpp
index f391679..79e0b40 100644
--- a/VintfObject.cpp
+++ b/VintfObject.cpp
@@ -738,7 +738,6 @@ int32_t VintfObject::checkCompatibility(std::string* error, CheckFlags::Type fla
error->insert(0,
"Runtime info and framework compatibility matrix are incompatible: ");
}
- return INCOMPATIBLE;
}
}
--
2.49.0

View File

@@ -0,0 +1,24 @@
From d3d1248ef48a27df5d32e3beaaddbd3d5e21ea6b Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Thu, 5 Sep 2024 19:05:14 +0800
Subject: [PATCH 2/2] ignore /proc/config.gz failed read
---
KernelConfigs.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/KernelConfigs.cpp b/KernelConfigs.cpp
index 3de65ea..3583d66 100644
--- a/KernelConfigs.cpp
+++ b/KernelConfigs.cpp
@@ -34,6 +34,7 @@ status_t LoadKernelConfigs(std::map<std::string, std::string>* configs) {
gzFile f = gzopen("/proc/config.gz", "rb");
if (f == NULL) {
LOG(ERROR) << "Could not open /proc/config.gz: " << errno;
+ errno = 0; // HACKED
return -errno;
}
--
2.49.0

View File

@@ -0,0 +1,50 @@
From 8ea39ed126769c1ba1f04d17c37f7024d5bd0ef5 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sat, 31 Jul 2021 06:14:33 +0000
Subject: [PATCH 1/3] ignore iptables error
---
server/BandwidthController.cpp | 1 +
server/Controllers.cpp | 1 -
server/IptablesRestoreController.cpp | 1 +
3 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/server/BandwidthController.cpp b/server/BandwidthController.cpp
index 8a96738..f1cbf14 100644
--- a/server/BandwidthController.cpp
+++ b/server/BandwidthController.cpp
@@ -527,6 +527,7 @@ int BandwidthController::updateQuota(const std::string& quotaName, int64_t bytes
if (!isOk(file)) {
int res = errno;
ALOGE("Updating quota %s failed (%s)", quotaName.c_str(), toString(file).c_str());
+ res = 0; // HACKED
return -res;
}
// TODO: should we propagate this error?
diff --git a/server/Controllers.cpp b/server/Controllers.cpp
index ea34897..be185ce 100644
--- a/server/Controllers.cpp
+++ b/server/Controllers.cpp
@@ -325,7 +325,6 @@ void Controllers::init() {
// As such simply exit netd. This may crash loop the system, but by failing
// to bootup we will trigger rollback and thus this offers us protection against
// a mainline update breaking things.
- exit(1);
}
gLog.info("Enabling bandwidth control: %" PRId64 "us", s.getTimeAndResetUs());
diff --git a/server/IptablesRestoreController.cpp b/server/IptablesRestoreController.cpp
index 49b48d3..07bdda4 100644
--- a/server/IptablesRestoreController.cpp
+++ b/server/IptablesRestoreController.cpp
@@ -349,6 +349,7 @@ int IptablesRestoreController::execute(const IptablesTarget target, const std::s
if (target == V6 || target == V4V6) {
res |= sendCommand(IP6TABLES_PROCESS, command, output);
}
+ res = 0; // ignore iptables error
return res;
}
--
2.49.0

View File

@@ -0,0 +1,24 @@
From 824f0f2e8e0819536d469027679c1e27a07a88c9 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sun, 14 Aug 2022 11:53:19 +0800
Subject: [PATCH 2/3] ignore bpf error
---
server/main.cpp | 1 -
1 file changed, 1 deletion(-)
diff --git a/server/main.cpp b/server/main.cpp
index b0c5406..8ef2f19 100644
--- a/server/main.cpp
+++ b/server/main.cpp
@@ -145,7 +145,6 @@ int main() {
if (libnetd_updatable_init(cg2_path.c_str())) {
ALOGE("libnetd_updatable_init failed");
- exit(1);
}
gLog.info("libnetd_updatable_init success");
--
2.49.0

View File

@@ -0,0 +1,28 @@
From c9c7f6e6471cc2552541fffc432e50b36e02d9f8 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sun, 14 Aug 2022 11:57:11 +0800
Subject: [PATCH 3/3] ignote getTetherStats error
---
server/TetherController.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/server/TetherController.cpp b/server/TetherController.cpp
index b159d95..a582cd8 100644
--- a/server/TetherController.cpp
+++ b/server/TetherController.cpp
@@ -913,9 +913,11 @@ StatusOr<TetherController::TetherStatsList> TetherController::getTetherStats() {
}
if (int ret = addForwardChainStats(statsList, statsString, parsedIptablesOutput)) {
+#if 0
return statusFromErrno(-ret, StringPrintf("failed to parse %s tether stats:\n%s",
target == V4 ? "IPv4": "IPv6",
parsedIptablesOutput.c_str()));
+#endif
}
}
--
2.49.0

View File

@@ -0,0 +1,24 @@
From c30fd779887775bdb265fb2c57984f92264fc5c9 Mon Sep 17 00:00:00 2001
From: Ziyang Zhou <ziyang.zhou@outlook.com>
Date: Sat, 6 Aug 2022 10:19:11 +0800
Subject: [PATCH] ignore project quota error
---
Utils.cpp | 1 -
1 file changed, 1 deletion(-)
diff --git a/Utils.cpp b/Utils.cpp
index c4070d1..e89f2a7 100644
--- a/Utils.cpp
+++ b/Utils.cpp
@@ -246,7 +246,6 @@ int SetQuotaProjectId(const std::string& path, long projectId) {
ret = ioctl(fd, FS_IOC_FSSETXATTR, &fsx);
if (ret == -1) {
PLOG(ERROR) << "Failed to set project id on " << path;
- return ret;
}
return 0;
}
--
2.49.0

View File

@@ -0,0 +1,32 @@
From d0a81eab5bafdc3f446d921965a0fd555abe4170 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 de59b8a..15016a1 100644
--- a/libminijail.c
+++ b/libminijail.c
@@ -2702,6 +2702,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 ||
j->flags.seccomp_filter_allow_speculation) {
@@ -2723,6 +2724,7 @@ static void set_seccomp_filter(const struct minijail *j)
}
}
}
+#endif
}
static pid_t forward_pid = -1;
--
2.49.0

Some files were not shown because too many files have changed in this diff Show More