android-11.0.0_r48 patches
This commit is contained in:
32
android-11.0.0_r48/external/minijail/0001-disable-seccomp.patch
vendored
Normal file
32
android-11.0.0_r48/external/minijail/0001-disable-seccomp.patch
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
From 564fafdc09a5a9d376df4ebc03c74ceae428c48f 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 7a82ccc..cb5cdcd 100644
|
||||
--- a/libminijail.c
|
||||
+++ b/libminijail.c
|
||||
@@ -2075,6 +2075,7 @@ static void set_seccomp_filter(const struct minijail *j)
|
||||
/*
|
||||
* Install the syscall filter.
|
||||
*/
|
||||
+#if 0 // HACKED
|
||||
if (j->flags.seccomp_filter) {
|
||||
if (j->flags.seccomp_filter_tsync) {
|
||||
if (sys_seccomp(SECCOMP_SET_MODE_FILTER,
|
||||
@@ -2089,6 +2090,7 @@ static void set_seccomp_filter(const struct minijail *j)
|
||||
}
|
||||
}
|
||||
}
|
||||
+#endif
|
||||
}
|
||||
|
||||
static pid_t forward_pid = -1;
|
||||
--
|
||||
2.34.1
|
||||
|
||||
223
android-11.0.0_r48/external/selinux/0001-ignore-selinux.patch
vendored
Normal file
223
android-11.0.0_r48/external/selinux/0001-ignore-selinux.patch
vendored
Normal file
@@ -0,0 +1,223 @@
|
||||
From accfc25b2e790fee5b45227115829812dd6b9e09 Mon Sep 17 00:00:00 2001
|
||||
From: Ziyang Zhou <ziyang.zhou@outlook.com>
|
||||
Date: Sun, 9 May 2021 23:12:46 +0800
|
||||
Subject: [PATCH] ignore selinux
|
||||
|
||||
---
|
||||
libselinux/include/selinux/selinux.h | 4 ++++
|
||||
libselinux/src/android/android.c | 1 +
|
||||
libselinux/src/android/android_platform.c | 5 +++++
|
||||
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 +
|
||||
13 files changed, 21 insertions(+)
|
||||
|
||||
diff --git a/libselinux/include/selinux/selinux.h b/libselinux/include/selinux/selinux.h
|
||||
index 7922d96..c99ea2a 100644
|
||||
--- a/libselinux/include/selinux/selinux.h
|
||||
+++ b/libselinux/include/selinux/selinux.h
|
||||
@@ -4,6 +4,10 @@
|
||||
#include <sys/types.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
+#define SE_HACK
|
||||
+#define se_hack() if (1) return
|
||||
+#define se_hack1(p) if (1) return p
|
||||
+
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
diff --git a/libselinux/src/android/android.c b/libselinux/src/android/android.c
|
||||
index 2e70ceb..991a153 100644
|
||||
--- a/libselinux/src/android/android.c
|
||||
+++ b/libselinux/src/android/android.c
|
||||
@@ -67,6 +67,7 @@ struct selabel_handle* selinux_android_service_open_context_handle(const struct
|
||||
|
||||
sehandle = selabel_open(SELABEL_CTX_ANDROID_SERVICE,
|
||||
seopts_service, nopts);
|
||||
+ se_hack1(sehandle);
|
||||
|
||||
if (!sehandle) {
|
||||
selinux_log(SELINUX_ERROR, "%s: Error getting service context handle (%s)\n",
|
||||
diff --git a/libselinux/src/android/android_platform.c b/libselinux/src/android/android_platform.c
|
||||
index 20bb4a9..4029726 100644
|
||||
--- a/libselinux/src/android/android_platform.c
|
||||
+++ b/libselinux/src/android/android_platform.c
|
||||
@@ -85,6 +85,7 @@ static struct selabel_handle* selinux_android_file_context(const struct selinux_
|
||||
|
||||
struct selabel_handle* selinux_android_file_context_handle(void)
|
||||
{
|
||||
+ se_hack1(NULL);
|
||||
struct selinux_opt seopts_file[MAX_FILE_CONTEXT_SIZE];
|
||||
int size = 0;
|
||||
unsigned int i;
|
||||
@@ -957,6 +958,7 @@ oom:
|
||||
|
||||
int selinux_android_setcon(const char *con)
|
||||
{
|
||||
+ se_hack1(0);
|
||||
int ret = setcon(con);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -973,6 +975,7 @@ int selinux_android_setcontext(uid_t uid,
|
||||
const char *seinfo,
|
||||
const char *pkgname)
|
||||
{
|
||||
+ se_hack1(0);
|
||||
char *orig_ctx_str = NULL, *ctx_str;
|
||||
context_t ctx = NULL;
|
||||
int rc = -1;
|
||||
@@ -1363,6 +1366,7 @@ static int selinux_android_restorecon_common(const char* pathname_orig,
|
||||
uid_t uid,
|
||||
unsigned int flags)
|
||||
{
|
||||
+ se_hack1(0);
|
||||
bool nochange = (flags & SELINUX_ANDROID_RESTORECON_NOCHANGE) ? true : false;
|
||||
bool verbose = (flags & SELINUX_ANDROID_RESTORECON_VERBOSE) ? true : false;
|
||||
bool recurse = (flags & SELINUX_ANDROID_RESTORECON_RECURSE) ? true : false;
|
||||
@@ -1605,6 +1609,7 @@ void selinux_android_set_sehandle(const struct selabel_handle *hndl)
|
||||
|
||||
int selinux_android_load_policy()
|
||||
{
|
||||
+ se_hack1(0);
|
||||
int fd = -1;
|
||||
|
||||
fd = open(sepolicy_file, O_RDONLY | O_NOFOLLOW | O_CLOEXEC);
|
||||
diff --git a/libselinux/src/checkAccess.c b/libselinux/src/checkAccess.c
|
||||
index 7227ffe..31a9e62 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 d909dce..fb782b7 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 20bee8a..ebbae3c 100644
|
||||
--- a/libselinux/src/getfilecon.c
|
||||
+++ b/libselinux/src/getfilecon.c
|
||||
@@ -53,6 +53,7 @@ hidden_def(getfilecon_raw)
|
||||
|
||||
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 3a77a2d..f8dab8e 100644
|
||||
--- a/libselinux/src/getpeercon.c
|
||||
+++ b/libselinux/src/getpeercon.c
|
||||
@@ -47,6 +47,7 @@ hidden_def(getpeercon_raw)
|
||||
|
||||
int getpeercon(int fd, char ** context)
|
||||
{
|
||||
+ se_hack1((*context = calloc(7, 1), memcpy(*context, "HACKED", 6), 0));
|
||||
int ret;
|
||||
char * rcontext;
|
||||
|
||||
diff --git a/libselinux/src/init.c b/libselinux/src/init.c
|
||||
index 083638c..476c127 100644
|
||||
--- a/libselinux/src/init.c
|
||||
+++ b/libselinux/src/init.c
|
||||
@@ -142,6 +142,7 @@ hidden_def(fini_selinuxmnt)
|
||||
|
||||
void set_selinuxmnt(const char *mnt)
|
||||
{
|
||||
+ se_hack();
|
||||
selinux_mnt = strdup(mnt);
|
||||
}
|
||||
|
||||
diff --git a/libselinux/src/label.c b/libselinux/src/label.c
|
||||
index eac6e36..16bb963 100644
|
||||
--- a/libselinux/src/label.c
|
||||
+++ b/libselinux/src/label.c
|
||||
@@ -309,6 +309,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 db67bc6..7123480 100644
|
||||
--- a/libselinux/src/lgetfilecon.c
|
||||
+++ b/libselinux/src/lgetfilecon.c
|
||||
@@ -53,6 +53,7 @@ hidden_def(lgetfilecon_raw)
|
||||
|
||||
int lgetfilecon(const char *path, char ** context)
|
||||
{
|
||||
+ se_hack1((*context = calloc(7, 1), memcpy(*context, "HACKED", 6), 0));
|
||||
int ret;
|
||||
char * rcontext = NULL;
|
||||
|
||||
diff --git a/libselinux/src/lsetfilecon.c b/libselinux/src/lsetfilecon.c
|
||||
index 1d3b28a..7062703 100644
|
||||
--- a/libselinux/src/lsetfilecon.c
|
||||
+++ b/libselinux/src/lsetfilecon.c
|
||||
@@ -29,6 +29,7 @@ hidden_def(lsetfilecon_raw)
|
||||
|
||||
int lsetfilecon(const char *path, const char *context)
|
||||
{
|
||||
+ se_hack1(0);
|
||||
int ret;
|
||||
char * rcontext;
|
||||
|
||||
diff --git a/libselinux/src/procattr.c b/libselinux/src/procattr.c
|
||||
index c6799ef..1f7d9c3 100644
|
||||
--- a/libselinux/src/procattr.c
|
||||
+++ b/libselinux/src/procattr.c
|
||||
@@ -195,6 +195,7 @@ static int getprocattrcon_raw(char ** context,
|
||||
static int getprocattrcon(char ** context,
|
||||
pid_t pid, const char *attr)
|
||||
{
|
||||
+ se_hack1((*context = calloc(7, 1), memcpy(*context, "HACKED", 6), 0));
|
||||
int ret;
|
||||
char * rcontext;
|
||||
|
||||
@@ -280,6 +281,7 @@ out:
|
||||
static int setprocattrcon(const char * context,
|
||||
pid_t pid, const char *attr)
|
||||
{
|
||||
+ se_hack1(0);
|
||||
int ret;
|
||||
char * rcontext;
|
||||
|
||||
diff --git a/libselinux/src/sestatus.c b/libselinux/src/sestatus.c
|
||||
index ede5a28..a2f092e 100644
|
||||
--- a/libselinux/src/sestatus.c
|
||||
+++ b/libselinux/src/sestatus.c
|
||||
@@ -254,6 +254,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.34.1
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
From 58f9b29cf0cba770e5619ed8a187fdb4afe242eb 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] video playback workaround
|
||||
|
||||
---
|
||||
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 4711315615..af596e8168 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.34.1
|
||||
|
||||
25
android-11.0.0_r48/frameworks/base/0001-fix-booting.patch
Normal file
25
android-11.0.0_r48/frameworks/base/0001-fix-booting.patch
Normal file
@@ -0,0 +1,25 @@
|
||||
From 535d331cfbbdb3e4c4ab36911d04127ce877f157 Mon Sep 17 00:00:00 2001
|
||||
From: Ziyang Zhou <ziyang.zhou@outlook.com>
|
||||
Date: Tue, 16 Nov 2021 01:30:29 +0800
|
||||
Subject: [PATCH 1/2] fix booting
|
||||
|
||||
---
|
||||
.../SystemUI/src/com/android/systemui/BatteryMeterView.java | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java b/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java
|
||||
index fc30be416c0f..486c00f1eae2 100644
|
||||
--- a/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java
|
||||
+++ b/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java
|
||||
@@ -386,7 +386,7 @@ public class BatteryMeterView extends LinearLayout implements
|
||||
}
|
||||
|
||||
private void setPercentTextAtCurrentLevel() {
|
||||
- mBatteryPercentView.setText(
|
||||
+ if (mBatteryPercentView != null) mBatteryPercentView.setText(
|
||||
NumberFormat.getPercentInstance().format(mLevel / 100f));
|
||||
setContentDescription(
|
||||
getContext().getString(mCharging ? R.string.accessibility_battery_level_charging
|
||||
--
|
||||
2.34.1
|
||||
|
||||
24
android-11.0.0_r48/frameworks/base/0002-mocked-WiFi.patch
Normal file
24
android-11.0.0_r48/frameworks/base/0002-mocked-WiFi.patch
Normal file
@@ -0,0 +1,24 @@
|
||||
From e3b83668686b1f79f86cc046d80e805676f5229c Mon Sep 17 00:00:00 2001
|
||||
From: Ziyang Zhou <ziyang.zhou@outlook.com>
|
||||
Date: Wed, 4 May 2022 22:03:51 +0800
|
||||
Subject: [PATCH 2/2] mocked WiFi
|
||||
|
||||
---
|
||||
core/java/android/net/ConnectivityManager.java | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java
|
||||
index ed03f5198d6f..43505179e5de 100644
|
||||
--- a/core/java/android/net/ConnectivityManager.java
|
||||
+++ b/core/java/android/net/ConnectivityManager.java
|
||||
@@ -1200,6 +1200,7 @@ public class ConnectivityManager {
|
||||
@Nullable
|
||||
public NetworkInfo getNetworkInfo(int networkType) {
|
||||
try {
|
||||
+ if (networkType == ConnectivityManager.TYPE_WIFI) networkType = ConnectivityManager.TYPE_ETHERNET;
|
||||
return mService.getNetworkInfo(networkType);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
--
|
||||
2.34.1
|
||||
|
||||
45
android-11.0.0_r48/frameworks/native/0001-fix-booting.patch
Normal file
45
android-11.0.0_r48/frameworks/native/0001-fix-booting.patch
Normal file
@@ -0,0 +1,45 @@
|
||||
From 49c46872df11d334a46b87bb579e3a19bbcebf0c Mon Sep 17 00:00:00 2001
|
||||
From: Ziyang Zhou <ziyang.zhou@outlook.com>
|
||||
Date: Sun, 9 May 2021 23:01:00 +0800
|
||||
Subject: [PATCH] fix booting
|
||||
|
||||
---
|
||||
libs/binder/Binder.cpp | 1 +
|
||||
libs/binder/ProcessState.cpp | 3 +++
|
||||
2 files changed, 4 insertions(+)
|
||||
|
||||
diff --git a/libs/binder/Binder.cpp b/libs/binder/Binder.cpp
|
||||
index 6ca3b16324..b90fa1bb7a 100644
|
||||
--- a/libs/binder/Binder.cpp
|
||||
+++ b/libs/binder/Binder.cpp
|
||||
@@ -261,6 +261,7 @@ bool BBinder::isRequestingSid()
|
||||
|
||||
void BBinder::setRequestingSid(bool requestingSid)
|
||||
{
|
||||
+ requestingSid = false; // HACKED
|
||||
Extras* e = mExtras.load(std::memory_order_acquire);
|
||||
|
||||
if (!e) {
|
||||
diff --git a/libs/binder/ProcessState.cpp b/libs/binder/ProcessState.cpp
|
||||
index 4b773e816f..3f30c08ffe 100644
|
||||
--- a/libs/binder/ProcessState.cpp
|
||||
+++ b/libs/binder/ProcessState.cpp
|
||||
@@ -138,12 +138,15 @@ bool ProcessState::becomeContextManager(context_check_func checkFunc, void* user
|
||||
mBinderContextCheckFunc = checkFunc;
|
||||
mBinderContextUserData = userData;
|
||||
|
||||
+#if 0 // HACKED (?)
|
||||
flat_binder_object obj {
|
||||
.flags = FLAT_BINDER_FLAG_TXN_SECURITY_CTX,
|
||||
};
|
||||
|
||||
int 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.34.1
|
||||
|
||||
24
android-11.0.0_r48/system/bpf/0001-fix-booting.patch
Normal file
24
android-11.0.0_r48/system/bpf/0001-fix-booting.patch
Normal file
@@ -0,0 +1,24 @@
|
||||
From e8c5556f165a7fa0c37507a7ab84fbbd1103ce38 Mon Sep 17 00:00:00 2001
|
||||
From: Ziyang Zhou <ziyang.zhou@outlook.com>
|
||||
Date: Fri, 25 Jun 2021 15:04:35 +0000
|
||||
Subject: [PATCH] fix booting
|
||||
|
||||
---
|
||||
bpfloader/BpfLoader.cpp | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/bpfloader/BpfLoader.cpp b/bpfloader/BpfLoader.cpp
|
||||
index e67c469..92fa1b6 100644
|
||||
--- a/bpfloader/BpfLoader.cpp
|
||||
+++ b/bpfloader/BpfLoader.cpp
|
||||
@@ -89,7 +89,6 @@ int main() {
|
||||
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 ---");
|
||||
- return 2;
|
||||
}
|
||||
|
||||
if (android::base::SetProperty("bpf.progs_loaded", "1") == false) {
|
||||
--
|
||||
2.34.1
|
||||
|
||||
116
android-11.0.0_r48/system/core/0001-fix-booting.patch
Normal file
116
android-11.0.0_r48/system/core/0001-fix-booting.patch
Normal file
@@ -0,0 +1,116 @@
|
||||
From b9b0be77870bd70461f4f3dae8c4026a04d3e2dd Mon Sep 17 00:00:00 2001
|
||||
From: Ziyang Zhou <ziyang.zhou@outlook.com>
|
||||
Date: Sun, 9 May 2021 23:27:12 +0800
|
||||
Subject: [PATCH 1/7] fix booting
|
||||
|
||||
---
|
||||
init/first_stage_init.cpp | 18 +++++++++++++++---
|
||||
init/service.cpp | 3 ++-
|
||||
init/util.cpp | 3 ++-
|
||||
rootdir/init.rc | 1 -
|
||||
4 files changed, 19 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/init/first_stage_init.cpp b/init/first_stage_init.cpp
|
||||
index 021557697..8a16cd7d0 100644
|
||||
--- a/init/first_stage_init.cpp
|
||||
+++ b/init/first_stage_init.cpp
|
||||
@@ -34,6 +34,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>
|
||||
|
||||
@@ -192,6 +193,8 @@ int FirstStageMain(int argc, char** argv) {
|
||||
CHECKCALL(mount("tmpfs", "/dev", "tmpfs", MS_NOSUID, "mode=0755"));
|
||||
CHECKCALL(mkdir("/dev/pts", 0755));
|
||||
CHECKCALL(mkdir("/dev/socket", 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)));
|
||||
@@ -246,7 +249,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!";
|
||||
@@ -319,12 +321,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 69f944eb2..7e61129ad 100644
|
||||
--- a/init/service.cpp
|
||||
+++ b/init/service.cpp
|
||||
@@ -63,6 +63,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;
|
||||
@@ -319,7 +320,7 @@ void Service::Reap(const siginfo_t& siginfo) {
|
||||
if (++crash_count_ > 4) {
|
||||
if (flags_ & SVC_CRITICAL) {
|
||||
// Aborts into bootloader
|
||||
- LOG(FATAL) << "critical process '" << name_ << "' exited 4 times "
|
||||
+ LOG(ERROR) << "critical process '" << name_ << "' exited 4 times "
|
||||
<< (boot_completed ? "in 4 minutes" : "before boot completed");
|
||||
} else {
|
||||
LOG(ERROR) << "updatable process '" << name_ << "' exited 4 times "
|
||||
diff --git a/init/util.cpp b/init/util.cpp
|
||||
index 255434a1b..a9ac09d78 100644
|
||||
--- a/init/util.cpp
|
||||
+++ b/init/util.cpp
|
||||
@@ -236,7 +236,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);
|
||||
+ std::replace(cmdline.begin(), cmdline.end(), '\0', ' ');
|
||||
|
||||
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 a9af0b094..183c8cc20 100644
|
||||
--- a/rootdir/init.rc
|
||||
+++ b/rootdir/init.rc
|
||||
@@ -457,7 +457,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
|
||||
|
||||
# Make sure /sys/kernel/debug (if present) is labeled properly
|
||||
# Note that tracefs may be mounted under debug, so we need to cross filesystems
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
From 30253820d549e09ac21495983370d32dc3429397 Mon Sep 17 00:00:00 2001
|
||||
From: Ziyang Zhou <ziyang.zhou@outlook.com>
|
||||
Date: Sun, 9 May 2021 23:29:12 +0800
|
||||
Subject: [PATCH 2/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 a89504e59..0ba7602e3 100644
|
||||
--- a/init/property_service.cpp
|
||||
+++ b/init/property_service.cpp
|
||||
@@ -1047,6 +1047,8 @@ static void ProcessKernelCmdline() {
|
||||
for_emulator = true;
|
||||
} else if (StartsWith(key, "androidboot.")) {
|
||||
InitPropertySet("ro.boot." + key.substr(12), value);
|
||||
+ } else if (StartsWith(key, "ro.")) {
|
||||
+ InitPropertySet(key, value);
|
||||
}
|
||||
});
|
||||
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
From 60326b60976aa1477b8d1d242327e00c8f90ee51 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/7] ignore input subsystem
|
||||
|
||||
---
|
||||
rootdir/ueventd.rc | 3 ---
|
||||
1 file changed, 3 deletions(-)
|
||||
|
||||
diff --git a/rootdir/ueventd.rc b/rootdir/ueventd.rc
|
||||
index 9c2cdf27f..425a5f412 100644
|
||||
--- a/rootdir/ueventd.rc
|
||||
+++ b/rootdir/ueventd.rc
|
||||
@@ -9,9 +9,6 @@ subsystem drm
|
||||
devname uevent_devpath
|
||||
dirname /dev/dri
|
||||
|
||||
-subsystem input
|
||||
- devname uevent_devpath
|
||||
- dirname /dev/input
|
||||
|
||||
subsystem sound
|
||||
devname uevent_devpath
|
||||
--
|
||||
2.34.1
|
||||
|
||||
24
android-11.0.0_r48/system/core/0004-ignore-devfs-mount.patch
Normal file
24
android-11.0.0_r48/system/core/0004-ignore-devfs-mount.patch
Normal file
@@ -0,0 +1,24 @@
|
||||
From ea66dde5d548554c9a0871f4db4a0f92303909f2 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/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 8a16cd7d0..2dd3ec587 100644
|
||||
--- a/init/first_stage_init.cpp
|
||||
+++ b/init/first_stage_init.cpp
|
||||
@@ -190,7 +190,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));
|
||||
mount("/system/etc", "/etc", "none", MS_BIND, NULL); // cgroup fix
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
From d26ba9b0e4a999e5c5c1daa6469e7044f4b96367 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/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 183c8cc20..d1cd120db 100644
|
||||
--- a/rootdir/init.rc
|
||||
+++ b/rootdir/init.rc
|
||||
@@ -176,6 +176,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.34.1
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
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
|
||||
|
||||
24
android-11.0.0_r48/system/core/0007-skip-fusectl-mount.patch
Normal file
24
android-11.0.0_r48/system/core/0007-skip-fusectl-mount.patch
Normal file
@@ -0,0 +1,24 @@
|
||||
From d8145b3fb540ea511eb985eb45ba2eb6397043d7 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 d1cd120db..37548614c 100644
|
||||
--- a/rootdir/init.rc
|
||||
+++ b/rootdir/init.rc
|
||||
@@ -179,7 +179,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.34.1
|
||||
|
||||
45
android-11.0.0_r48/system/libhwbinder/0001-fix-booting.patch
Normal file
45
android-11.0.0_r48/system/libhwbinder/0001-fix-booting.patch
Normal file
@@ -0,0 +1,45 @@
|
||||
From 770e2da85d3a6d4e2692f18a89f0fe733891f52f 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 9edd27b..7badbce 100644
|
||||
--- a/Binder.cpp
|
||||
+++ b/Binder.cpp
|
||||
@@ -90,6 +90,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 694efd1..811f0de 100644
|
||||
--- a/ProcessState.cpp
|
||||
+++ b/ProcessState.cpp
|
||||
@@ -166,12 +166,15 @@ bool ProcessState::becomeContextManager(context_check_func checkFunc, void* user
|
||||
mBinderContextCheckFunc = checkFunc;
|
||||
mBinderContextUserData = userData;
|
||||
|
||||
+#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.34.1
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
From 6783a207d24cf9af937ea458b6f85e2777694be2 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 13e2f5c..cd39281 100644
|
||||
--- a/VintfObject.cpp
|
||||
+++ b/VintfObject.cpp
|
||||
@@ -591,7 +591,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.34.1
|
||||
|
||||
46
android-11.0.0_r48/system/netd/0001-fix-networking.patch
Normal file
46
android-11.0.0_r48/system/netd/0001-fix-networking.patch
Normal file
@@ -0,0 +1,46 @@
|
||||
From c3ddb62620fc63af06e57377f6c49fdd6e74ce18 Mon Sep 17 00:00:00 2001
|
||||
From: Ziyang Zhou <ziyang.zhou@outlook.com>
|
||||
Date: Mon, 26 Apr 2021 23:09:01 +0800
|
||||
Subject: [PATCH] ? fix networking
|
||||
|
||||
---
|
||||
server/IptablesRestoreController.cpp | 1 +
|
||||
server/TrafficController.cpp | 3 +--
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/server/IptablesRestoreController.cpp b/server/IptablesRestoreController.cpp
|
||||
index 10cedfa3..e2550b55 100644
|
||||
--- a/server/IptablesRestoreController.cpp
|
||||
+++ b/server/IptablesRestoreController.cpp
|
||||
@@ -362,6 +362,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;
|
||||
}
|
||||
|
||||
diff --git a/server/TrafficController.cpp b/server/TrafficController.cpp
|
||||
index 3839962f..f3485745 100644
|
||||
--- a/server/TrafficController.cpp
|
||||
+++ b/server/TrafficController.cpp
|
||||
@@ -777,7 +777,7 @@ Status TrafficController::swapActiveStatsMap() {
|
||||
if (!oldConfiguration.ok()) {
|
||||
ALOGE("Cannot read the old configuration from map: %s",
|
||||
oldConfiguration.error().message().c_str());
|
||||
- return Status(oldConfiguration.error().code(), oldConfiguration.error().message());
|
||||
+ return netdutils::status::ok; // HACKED
|
||||
}
|
||||
|
||||
// Write to the configuration map to inform the kernel eBPF program to switch
|
||||
@@ -802,7 +802,6 @@ Status TrafficController::swapActiveStatsMap() {
|
||||
int ret = synchronizeKernelRCU();
|
||||
if (ret) {
|
||||
ALOGE("map swap synchronize_rcu() ended with failure: %s", strerror(-ret));
|
||||
- return statusFromErrno(-ret, "map swap synchronize_rcu() failed");
|
||||
}
|
||||
return netdutils::status::ok;
|
||||
}
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
From 945ad97a303cef1760cfd61a42768a513b5f17e8 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] fix remote-android/redroid-doc#42 ignore project quota error
|
||||
|
||||
Change-Id: I97dc074c6e0119eeb1b2463839ee9cda5c7fa8b4
|
||||
---
|
||||
Utils.cpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Utils.cpp b/Utils.cpp
|
||||
index 17921e8e..817f63c4 100644
|
||||
--- a/Utils.cpp
|
||||
+++ b/Utils.cpp
|
||||
@@ -240,7 +240,7 @@ int SetQuotaProjectId(const std::string& path, long projectId) {
|
||||
}
|
||||
|
||||
fsx.fsx_projid = projectId;
|
||||
- return ioctl(fd, FS_IOC_FSSETXATTR, &fsx);
|
||||
+ return (ioctl(fd, FS_IOC_FSSETXATTR, &fsx), 0);
|
||||
}
|
||||
|
||||
int PrepareDirWithProjectId(const std::string& path, mode_t mode, uid_t uid, gid_t gid,
|
||||
--
|
||||
2.34.1
|
||||
|
||||
Reference in New Issue
Block a user