diff --git a/docs/README.md b/docs/README.md
index 7131a49a951c..0128cd3d221e 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -1,4 +1,4 @@
-**English** | [Español](README_ES.md) | [简体中文](README_CN.md) | [繁體中文](README_TW.md) | [日本語](README_JP.md) | [Polski](README_PL.md) | [Português (Brasil)](README_PT-BR.md) | [Türkçe](README_TR.md) | [Русский](README_RU.md) | [Tiếng Việt](README_VI.md) | [Indonesia](README_ID.md) | [עברית](README_IW.md) | [हिंदी](README_IN.md)
+**English** | [Español](README_ES.md) | [简体中文](README_CN.md) | [繁體中文](README_TW.md) | [日本語](README_JP.md) | [한국어](README_KR.md) | [Polski](README_PL.md) | [Português (Brasil)](README_PT-BR.md) | [Türkçe](README_TR.md) | [Русский](README_RU.md) | [Tiếng Việt](README_VI.md) | [Indonesia](README_ID.md) | [עברית](README_IW.md) | [हिंदी](README_IN.md)
# KernelSU
diff --git a/docs/README_CN.md b/docs/README_CN.md
index 50bbd71780ea..dc34b86ab139 100644
--- a/docs/README_CN.md
+++ b/docs/README_CN.md
@@ -1,4 +1,4 @@
-[English](README.md) | [Español](README_ES.md) | **简体中文** | [繁體中文](README_TW.md) | [日本語](README_JP.md) | [Polski](README_PL.md) | [Português (Brasil)](README_PT-BR.md) | [Türkçe](README_TR.md) | [Русский](README_RU.md) | [Tiếng Việt](README_VI.md) | [Indonesia](README_ID.md) | [עברית](README_IW.md) | [हिंदी](README_IN.md)
+[English](README.md) | [Español](README_ES.md) | **简体中文** | [繁體中文](README_TW.md) | [日本語](README_JP.md) | [한국어](README_KR.md) | [Polski](README_PL.md) | [Português (Brasil)](README_PT-BR.md) | [Türkçe](README_TR.md) | [Русский](README_RU.md) | [Tiếng Việt](README_VI.md) | [Indonesia](README_ID.md) | [עברית](README_IW.md) | [हिंदी](README_IN.md)
# KernelSU
diff --git a/docs/README_ES.md b/docs/README_ES.md
index 518800989525..ed4f699b791d 100644
--- a/docs/README_ES.md
+++ b/docs/README_ES.md
@@ -1,4 +1,4 @@
-[English](README.md) | **Español** | [简体中文](README_CN.md) | [繁體中文](README_TW.md) | [日本語](README_JP.md) | [Polski](README_PL.md) | [Português (Brasil)](README_PT-BR.md) | [Türkçe](README_TR.md) | [Русский](README_RU.md) | [Tiếng Việt](README_VI.md) | [Indonesia](README_ID.md) | [עברית](README_IW.md) | [हिंदी](README_IN.md)
+[English](README.md) | **Español** | [简体中文](README_CN.md) | [繁體中文](README_TW.md) | [日本語](README_JP.md) | [한국어](README_KR.md) | [Polski](README_PL.md) | [Português (Brasil)](README_PT-BR.md) | [Türkçe](README_TR.md) | [Русский](README_RU.md) | [Tiếng Việt](README_VI.md) | [Indonesia](README_ID.md) | [עברית](README_IW.md) | [हिंदी](README_IN.md)
# KernelSU
diff --git a/docs/README_ID.md b/docs/README_ID.md
index 3a077ab910f5..511683a7503d 100644
--- a/docs/README_ID.md
+++ b/docs/README_ID.md
@@ -1,4 +1,4 @@
-[English](README.md) | [Español](README_ES.md) | [简体中文](README_CN.md) | [繁體中文](README_TW.md) | [日本語](README_JP.md) | [Polski](README_PL.md) | [Português (Brasil)](README_PT-BR.md) | [Türkçe](README_TR.md) | [Русский](README_RU.md) | [Tiếng Việt](README_VI.md) | **Indonesia** | [עברית](README_IW.md) | [हिंदी](README_IN.md)
+[English](README.md) | [Español](README_ES.md) | [简体中文](README_CN.md) | [繁體中文](README_TW.md) | [日本語](README_JP.md) | [한국어](README_KR.md) | [Polski](README_PL.md) | [Português (Brasil)](README_PT-BR.md) | [Türkçe](README_TR.md) | [Русский](README_RU.md) | [Tiếng Việt](README_VI.md) | **Indonesia** | [עברית](README_IW.md) | [हिंदी](README_IN.md)
# KernelSU
diff --git a/docs/README_IN.md b/docs/README_IN.md
index 33ddde5e55a5..7396ab5c2b10 100644
--- a/docs/README_IN.md
+++ b/docs/README_IN.md
@@ -1,4 +1,4 @@
-[English](README.md) | [Español](README_ES.md) | [简体中文](README_CN.md) | [繁體中文](README_TW.md) | [日本語](README_JP.md) | [Polski](README_PL.md) | [Português (Brasil)](README_PT-BR.md) | [Türkçe](README_TR.md) | [Русский](README_RU.md) | [Tiếng Việt](README_VI.md) | [Indonesia](README_ID.md) | [עברית](README_IW.md) | **हिंदी**
+[English](README.md) | [Español](README_ES.md) | [简体中文](README_CN.md) | [繁體中文](README_TW.md) | [日本語](README_JP.md) | [한국어](README_KR.md) | [Polski](README_PL.md) | [Português (Brasil)](README_PT-BR.md) | [Türkçe](README_TR.md) | [Русский](README_RU.md) | [Tiếng Việt](README_VI.md) | [Indonesia](README_ID.md) | [עברית](README_IW.md) | **हिंदी**
# KernelSU
diff --git a/docs/README_IW.md b/docs/README_IW.md
index 83bd4f1e3473..5997487e2a08 100644
--- a/docs/README_IW.md
+++ b/docs/README_IW.md
@@ -1,4 +1,4 @@
-[English](README.md) | [Español](README_ES.md) | [简体中文](README_CN.md) | [繁體中文](README_TW.md) | [日本語](README_JP.md) | [Polski](README_PL.md) | [Português (Brasil)](README_PT-BR.md) | [Türkçe](README_TR.md) | [Русский](README_RU.md) | [Tiếng Việt](README_VI.md) | [Indonesia](README_ID.md) | **עברית** | [हिंदी](README_IN.md)
+[English](README.md) | [Español](README_ES.md) | [简体中文](README_CN.md) | [繁體中文](README_TW.md) | [日本語](README_JP.md) | [한국어](README_KR.md) | [Polski](README_PL.md) | [Português (Brasil)](README_PT-BR.md) | [Türkçe](README_TR.md) | [Русский](README_RU.md) | [Tiếng Việt](README_VI.md) | [Indonesia](README_ID.md) | **עברית** | [हिंदी](README_IN.md)
# KernelSU
diff --git a/docs/README_JP.md b/docs/README_JP.md
index 60ccf2e8bb60..093618753775 100644
--- a/docs/README_JP.md
+++ b/docs/README_JP.md
@@ -1,4 +1,4 @@
-[English](README.md) | [Español](README_ES.md) | [简体中文](README_CN.md) | [繁體中文](README_TW.md) | **日本語** | [Polski](README_PL.md) | [Português (Brasil)](README_PT-BR.md) | [Türkçe](README_TR.md) | [Русский](README_RU.md) | [Tiếng Việt](README_VI.md) | [Indonesia](README_ID.md) | [עברית](README_IW.md) | [हिंदी](README_IN.md)
+[English](README.md) | [Español](README_ES.md) | [简体中文](README_CN.md) | [繁體中文](README_TW.md) | **日本語** | [한국어](README_KR.md) | [Polski](README_PL.md) | [Português (Brasil)](README_PT-BR.md) | [Türkçe](README_TR.md) | [Русский](README_RU.md) | [Tiếng Việt](README_VI.md) | [Indonesia](README_ID.md) | [עברית](README_IW.md) | [हिंदी](README_IN.md)
# KernelSU
diff --git a/docs/README_KR.md b/docs/README_KR.md
new file mode 100644
index 000000000000..3226008920a1
--- /dev/null
+++ b/docs/README_KR.md
@@ -0,0 +1,57 @@
+[English](README.md) | [Español](README_ES.md) | [简体中文](README_CN.md) | [繁體中文](README_TW.md) | [日本語](README_JP.md) | **한국어** | [Polski](README_PL.md) | [Português (Brasil)](README_PT-BR.md) | [Türkçe](README_TR.md) | [Русский](README_RU.md) | [Tiếng Việt](README_VI.md) | [Indonesia](README_ID.md) | [עברית](README_IW.md) | [हिंदी](README_IN.md)
+
+# KernelSU
+
+
+
+안드로이드 기기에서 사용되는 커널 기반 루팅 솔루션입니다.
+
+[![Latest release](https://img.shields.io/github/v/release/tiann/KernelSU?label=Release&logo=github)](https://github.com/tiann/KernelSU/releases/latest)
+[![Weblate](https://img.shields.io/badge/Localization-Weblate-teal?logo=weblate)](https://hosted.weblate.org/engage/kernelsu)
+[![Channel](https://img.shields.io/badge/Follow-Telegram-blue.svg?logo=telegram)](https://t.me/KernelSU)
+[![License: GPL v2](https://img.shields.io/badge/License-GPL%20v2-orange.svg?logo=gnu)](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html)
+[![GitHub License](https://img.shields.io/github/license/tiann/KernelSU?logo=gnu)](/LICENSE)
+
+## 기능들
+
+1. 커널 기반 `su` 및 루트 액세스 관리.
+2. [OverlayFS](https://en.wikipedia.org/wiki/OverlayFS) 기반 모듈 시스템.
+3. [App Profile](https://kernelsu.org/guide/app-profile.html): 루트 권한을 케이지에 가둡니다.
+
+## 호환 상태
+
+KernelSU는 공식적으로 안드로이드 GKI 2.0 디바이스(커널 5.10 이상)를 지원합니다. 오래된 커널(4.14 이상)도 사용할 수 있지만, 커널을 수동으로 빌드해야 합니다.
+
+KernelSU는 WSA, ChromeOS, 컨테이너 기반 안드로이드 모두를 지원합니다.
+
+현재는 `arm64-v8a`와 `x86_64`만 지원됩니다.
+
+## 사용 방법
+
+- [설치 방법](https://kernelsu.org/guide/installation.html)
+- [어떻게 빌드하나요?](https://kernelsu.org/guide/how-to-build.html)
+- [공식 웹사이트](https://kernelsu.org/)
+
+## 번역
+
+KernelSU 번역을 돕거나 기존 번역을 개선하려면 [Weblate](https://hosted.weblate.org/engage/kernelsu/)를 이용해 주세요. 매니저의 번역은 Weblate와 충돌할 수 있으므로 더 이상 허용되지 않습니다.
+
+## 토론
+
+- 텔레그램: [@KernelSU](https://t.me/KernelSU)
+
+## 보안
+
+KernelSU의 보안 취약점 보고에 대한 자세한 내용은 [SECURITY.md](/SECURITY.md)를 참조하세요.
+
+## 저작권
+
+- `kernel` 디렉터리 아래의 파일은 [GPL-2.0 전용](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html)입니다.
+- `kernel` 디렉토리를 제외한 다른 모든 부분은 [GPL-3.0-이상](https://www.gnu.org/licenses/gpl-3.0.html)입니다.
+
+## 크래딧
+
+- [kernel-assisted-superuser](https://git.zx2c4.com/kernel-assisted-superuser/about/): KernelSU의 아이디어.
+- [Magisk](https://github.com/topjohnwu/Magisk): 강력한 루팅 도구.
+- [genuine](https://github.com/brevent/genuine/): apk v2 서명 유효성 검사.
+- [Diamorphine](https://github.com/m0nad/Diamorphine): 일부 rootkit 스킬.
diff --git a/docs/README_PL.md b/docs/README_PL.md
index 69d7fa2ae722..ab9066296dd9 100644
--- a/docs/README_PL.md
+++ b/docs/README_PL.md
@@ -1,4 +1,4 @@
-[English](README.md) | [Español](README_ES.md) | [简体中文](README_CN.md) | [繁體中文](README_TW.md) | [日本語](README_JP.md) | **Polski** | [Português (Brasil)](README_PT-BR.md) | [Türkçe](README_TR.md) | [Русский](README_RU.md) | [Tiếng Việt](README_VI.md) | [Indonesia](README_ID.md) | [עברית](README_IW.md) | [हिंदी](README_IN.md)
+[English](README.md) | [Español](README_ES.md) | [简体中文](README_CN.md) | [繁體中文](README_TW.md) | [日本語](README_JP.md) | [한국어](README_KR.md) | **Polski** | [Português (Brasil)](README_PT-BR.md) | [Türkçe](README_TR.md) | [Русский](README_RU.md) | [Tiếng Việt](README_VI.md) | [Indonesia](README_ID.md) | [עברית](README_IW.md) | [हिंदी](README_IN.md)
# KernelSU
diff --git a/docs/README_PT-BR.md b/docs/README_PT-BR.md
index c7b2ead64b85..b5421e7f9be0 100644
--- a/docs/README_PT-BR.md
+++ b/docs/README_PT-BR.md
@@ -1,4 +1,4 @@
-[English](README.md) | [Español](README_ES.md) | [简体中文](README_CN.md) | [繁體中文](README_TW.md) | [日本語](README_JP.md) | [Polski](README_PL.md) | **Português (Brasil)** | [Türkçe](README_TR.md) | [Русский](README_RU.md) | [Tiếng Việt](README_VI.md) | [Indonesia](README_ID.md) | [עברית](README_IW.md) | [हिंदी](README_IN.md)
+[English](README.md) | [Español](README_ES.md) | [简体中文](README_CN.md) | [繁體中文](README_TW.md) | [日本語](README_JP.md) | [한국어](README_KR.md) | [Polski](README_PL.md) | **Português (Brasil)** | [Türkçe](README_TR.md) | [Русский](README_RU.md) | [Tiếng Việt](README_VI.md) | [Indonesia](README_ID.md) | [עברית](README_IW.md) | [हिंदी](README_IN.md)
# KernelSU
diff --git a/docs/README_RU.md b/docs/README_RU.md
index 7fdb275e40c9..7e50f47adfe5 100644
--- a/docs/README_RU.md
+++ b/docs/README_RU.md
@@ -1,4 +1,4 @@
-[English](README.md) | [Español](README_ES.md) | [简体中文](README_CN.md) | [繁體中文](README_TW.md) | [日本語](README_JP.md) | [Polski](README_PL.md) | [Português (Brasil)](README_PT-BR.md) | [Türkçe](README_TR.md) | **Русский** | [Tiếng Việt](README_VI.md) | [Indonesia](README_ID.md) | [עברית](README_IW.md) | [हिंदी](README_IN.md)
+[English](README.md) | [Español](README_ES.md) | [简体中文](README_CN.md) | [繁體中文](README_TW.md) | [日本語](README_JP.md) | [한국어](README_KR.md) | [Polski](README_PL.md) | [Português (Brasil)](README_PT-BR.md) | [Türkçe](README_TR.md) | **Русский** | [Tiếng Việt](README_VI.md) | [Indonesia](README_ID.md) | [עברית](README_IW.md) | [हिंदी](README_IN.md)
# KernelSU
diff --git a/docs/README_TR.md b/docs/README_TR.md
index 41febd9a013e..bc3363e8b490 100644
--- a/docs/README_TR.md
+++ b/docs/README_TR.md
@@ -1,4 +1,4 @@
-[English](README.md) | [Español](README_ES.md) | [简体中文](README_CN.md) | [繁體中文](README_TW.md) | [日本語](README_JP.md) | [Polski](README_PL.md) | [Português (Brasil)](README_PT-BR.md) | **Türkçe** | [Русский](README_RU.md) | [Tiếng Việt](README_VI.md) | [Indonesia](README_ID.md) | [עברית](README_IW.md) | [हिंदी](README_IN.md)
+[English](README.md) | [Español](README_ES.md) | [简体中文](README_CN.md) | [繁體中文](README_TW.md) | [日本語](README_JP.md) | [한국어](README_KR.md) | [Polski](README_PL.md) | [Português (Brasil)](README_PT-BR.md) | **Türkçe** | [Русский](README_RU.md) | [Tiếng Việt](README_VI.md) | [Indonesia](README_ID.md) | [עברית](README_IW.md) | [हिंदी](README_IN.md)
# KernelSU
diff --git a/docs/README_TW.md b/docs/README_TW.md
index 262b46dd4a95..d025e1742a67 100644
--- a/docs/README_TW.md
+++ b/docs/README_TW.md
@@ -1,4 +1,4 @@
-[English](README.md) | [Español](README_ES.md) | [简体中文](README_CN.md) | **繁體中文** | [日本語](README_JP.md) | [Polski](README_PL.md) | [Português (Brasil)](README_PT-BR.md) | [Türkçe](README_TR.md) | [Русский](README_RU.md) | [Tiếng Việt](README_VI.md) | [Indonesia](README_ID.md) | [עברית](README_IW.md) | [हिंदी](README_IN.md)
+[English](README.md) | [Español](README_ES.md) | [简体中文](README_CN.md) | **繁體中文** | [日本語](README_JP.md) | [한국어](README_KR.md) | [Polski](README_PL.md) | [Português (Brasil)](README_PT-BR.md) | [Türkçe](README_TR.md) | [Русский](README_RU.md) | [Tiếng Việt](README_VI.md) | [Indonesia](README_ID.md) | [עברית](README_IW.md) | [हिंदी](README_IN.md)
# KernelSU
diff --git a/docs/README_VI.md b/docs/README_VI.md
index d2c8be442a9d..7dd3b4227aec 100644
--- a/docs/README_VI.md
+++ b/docs/README_VI.md
@@ -1,4 +1,4 @@
-[English](README.md) | [Español](README_ES.md) | [简体中文](README_CN.md) | [繁體中文](README_TW.md) | [日本語](README_JP.md) | [Polski](README_PL.md) | [Português (Brasil)](README_PT-BR.md) | [Türkçe](README_TR.md) | [Русский](README_RU.md) | **Tiếng Việt** | [Indonesia](README_ID.md) | [עברית](README_IW.md) | [हिंदी](README_IN.md)
+[English](README.md) | [Español](README_ES.md) | [简体中文](README_CN.md) | [繁體中文](README_TW.md) | [日本語](README_JP.md) | [한국어](README_KR.md) | [Polski](README_PL.md) | [Português (Brasil)](README_PT-BR.md) | [Türkçe](README_TR.md) | [Русский](README_RU.md) | **Tiếng Việt** | [Indonesia](README_ID.md) | [עברית](README_IW.md) | [हिंदी](README_IN.md)
# KernelSU
diff --git a/kernel/ksud.c b/kernel/ksud.c
index 5a50a2fef275..fc73d935d286 100644
--- a/kernel/ksud.c
+++ b/kernel/ksud.c
@@ -64,6 +64,8 @@ bool ksu_execveat_hook __read_mostly = true;
bool ksu_input_hook __read_mostly = true;
#endif
+u32 ksu_devpts_sid;
+
void on_post_fs_data(void)
{
static bool done = false;
@@ -76,6 +78,9 @@ void on_post_fs_data(void)
ksu_load_allow_list();
// sanity check, this may influence the performance
stop_input_hook();
+
+ ksu_devpts_sid = ksu_get_devpts_sid();
+ pr_info("devpts sid: %d\n", ksu_devpts_sid);
}
#define MAX_ARG_STRINGS 0x7FFFFFFF
diff --git a/kernel/ksud.h b/kernel/ksud.h
index eafb31472f12..cc2df243a8f0 100644
--- a/kernel/ksud.h
+++ b/kernel/ksud.h
@@ -9,4 +9,6 @@ void on_post_fs_data(void);
bool ksu_is_safe_mode(void);
+extern u32 ksu_devpts_sid;
+
#endif
diff --git a/kernel/selinux/rules.c b/kernel/selinux/rules.c
index 0461b921967a..b0fb15fb67aa 100644
--- a/kernel/selinux/rules.c
+++ b/kernel/selinux/rules.c
@@ -130,12 +130,6 @@ void apply_kernelsu_rules()
// Allow all binder transactions
ksu_allow(db, ALL, KERNEL_SU_DOMAIN, "binder", ALL);
- // Allow system server devpts
- ksu_allow(db, "system_server", "untrusted_app_all_devpts", "chr_file",
- "read");
- ksu_allow(db, "system_server", "untrusted_app_all_devpts", "chr_file",
- "write");
-
// Allow system server kill su process
ksu_allow(db, "system_server", KERNEL_SU_DOMAIN, "process", "getpgid");
ksu_allow(db, "system_server", KERNEL_SU_DOMAIN, "process", "sigkill");
diff --git a/kernel/selinux/selinux.c b/kernel/selinux/selinux.c
index e13198897dd8..b35379000f99 100644
--- a/kernel/selinux/selinux.c
+++ b/kernel/selinux/selinux.c
@@ -129,4 +129,17 @@ bool is_zygote(void *sec)
result = strncmp("u:r:zygote:s0", domain, seclen) == 0;
security_release_secctx(domain, seclen);
return result;
+}
+
+#define DEVPTS_DOMAIN "u:object_r:devpts:s0"
+
+u32 ksu_get_devpts_sid()
+{
+ u32 devpts_sid = 0;
+ int err = security_secctx_to_secid(DEVPTS_DOMAIN, strlen(DEVPTS_DOMAIN),
+ &devpts_sid);
+ if (err) {
+ pr_info("get devpts sid err %d\n", err);
+ }
+ return devpts_sid;
}
\ No newline at end of file
diff --git a/kernel/selinux/selinux.h b/kernel/selinux/selinux.h
index 0c4978568af7..07120c253268 100644
--- a/kernel/selinux/selinux.h
+++ b/kernel/selinux/selinux.h
@@ -20,4 +20,6 @@ bool is_zygote(void *cred);
void apply_kernelsu_rules();
+u32 ksu_get_devpts_sid();
+
#endif
diff --git a/kernel/sucompat.c b/kernel/sucompat.c
index f43c20633eeb..7dd3a41961f3 100644
--- a/kernel/sucompat.c
+++ b/kernel/sucompat.c
@@ -1,3 +1,5 @@
+#include
+#include
#include
#include
#include
@@ -12,6 +14,7 @@
#include
#endif
+#include "objsec.h"
#include "allowlist.h"
#include "arch.h"
#include "klog.h" // IWYU pragma: keep
@@ -47,7 +50,7 @@ static char __user *ksud_user_path(void)
}
int ksu_handle_faccessat(int *dfd, const char __user **filename_user, int *mode,
- int * __unused_flags)
+ int *__unused_flags)
{
const char su[] = SU_PATH;
@@ -87,7 +90,7 @@ int ksu_handle_stat(int *dfd, const char __user **filename_user, int *flags)
// it becomes a `struct filename *` after 5.18
// https://elixir.bootlin.com/linux/v5.18/source/fs/stat.c#L216
const char sh[] = SH_PATH;
- struct filename *filename = * ((struct filename **) filename_user);
+ struct filename *filename = *((struct filename **)filename_user);
if (IS_ERR(filename)) {
return 0;
}
@@ -109,7 +112,8 @@ int ksu_handle_stat(int *dfd, const char __user **filename_user, int *flags)
// the call from execve_handler_pre won't provided correct value for __never_use_argument, use them after fix execve_handler_pre, keeping them for consistence for manually patched code
int ksu_handle_execveat_sucompat(int *fd, struct filename **filename_ptr,
- void *__never_use_argv, void *__never_use_envp, int *__never_use_flags)
+ void *__never_use_argv, void *__never_use_envp,
+ int *__never_use_flags)
{
struct filename *filename;
const char sh[] = KSUD_PATH;
@@ -138,7 +142,8 @@ int ksu_handle_execveat_sucompat(int *fd, struct filename **filename_ptr,
}
int ksu_handle_execve_sucompat(int *fd, const char __user **filename_user,
- void *__never_use_argv, void *__never_use_envp, int *__never_use_flags)
+ void *__never_use_argv, void *__never_use_envp,
+ int *__never_use_flags)
{
const char su[] = SU_PATH;
char path[sizeof(su) + 1];
@@ -163,9 +168,41 @@ int ksu_handle_execve_sucompat(int *fd, const char __user **filename_user,
return 0;
}
+int ksu_handle_devpts(struct inode *inode)
+{
+ if (!current->mm) {
+ return 0;
+ }
+
+ uid_t uid = current_uid().val;
+ if (uid % 100000 < 10000) {
+ // not untrusted_app, ignore it
+ return 0;
+ }
+
+ if (!ksu_is_allow_uid(uid))
+ return 0;
+
+ if (ksu_devpts_sid) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0)
+ struct inode_security_struct *sec = selinux_inode(inode);
+#else
+ struct inode_security_struct *sec = (struct inode_security_struct *) inode->i_security;
+#endif
+ if (sec) {
+ sec->sid = ksu_devpts_sid;
+ inode->i_uid.val = 0;
+ inode->i_gid.val = 0;
+ }
+ }
+
+ return 0;
+}
+
#ifdef CONFIG_KPROBES
-__maybe_unused static int faccessat_handler_pre(struct kprobe *p, struct pt_regs *regs)
+__maybe_unused static int faccessat_handler_pre(struct kprobe *p,
+ struct pt_regs *regs)
{
int *dfd = (int *)&PT_REGS_PARM1(regs);
const char __user **filename_user = (const char **)&PT_REGS_PARM2(regs);
@@ -180,21 +217,23 @@ static int sys_faccessat_handler_pre(struct kprobe *p, struct pt_regs *regs)
{
struct pt_regs *real_regs = PT_REAL_REGS(regs);
int *dfd = (int *)&PT_REGS_PARM1(real_regs);
- const char __user **filename_user = (const char **)&PT_REGS_PARM2(real_regs);
+ const char __user **filename_user =
+ (const char **)&PT_REGS_PARM2(real_regs);
int *mode = (int *)&PT_REGS_PARM3(real_regs);
return ksu_handle_faccessat(dfd, filename_user, mode, NULL);
}
-__maybe_unused static int newfstatat_handler_pre(struct kprobe *p, struct pt_regs *regs)
+__maybe_unused static int newfstatat_handler_pre(struct kprobe *p,
+ struct pt_regs *regs)
{
int *dfd = (int *)&PT_REGS_PARM1(regs);
const char __user **filename_user = (const char **)&PT_REGS_PARM2(regs);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
-// static int vfs_statx(int dfd, const char __user *filename, int flags, struct kstat *stat, u32 request_mask)
+ // static int vfs_statx(int dfd, const char __user *filename, int flags, struct kstat *stat, u32 request_mask)
int *flags = (int *)&PT_REGS_PARM3(regs);
#else
-// int vfs_fstatat(int dfd, const char __user *filename, struct kstat *stat,int flag)
+ // int vfs_fstatat(int dfd, const char __user *filename, struct kstat *stat,int flag)
int *flags = (int *)&PT_REGS_CCALL_PARM4(regs);
#endif
@@ -205,7 +244,8 @@ static int sys_newfstatat_handler_pre(struct kprobe *p, struct pt_regs *regs)
{
struct pt_regs *real_regs = PT_REAL_REGS(regs);
int *dfd = (int *)&PT_REGS_PARM1(real_regs);
- const char __user **filename_user = (const char **)&PT_REGS_PARM2(real_regs);
+ const char __user **filename_user =
+ (const char **)&PT_REGS_PARM2(real_regs);
int *flags = (int *)&PT_REGS_SYSCALL_PARM4(real_regs);
return ksu_handle_stat(dfd, filename_user, flags);
@@ -224,9 +264,11 @@ static int execve_handler_pre(struct kprobe *p, struct pt_regs *regs)
static int sys_execve_handler_pre(struct kprobe *p, struct pt_regs *regs)
{
struct pt_regs *real_regs = PT_REAL_REGS(regs);
- const char __user **filename_user = (const char **)&PT_REGS_PARM1(real_regs);
+ const char __user **filename_user =
+ (const char **)&PT_REGS_PARM1(real_regs);
- return ksu_handle_execve_sucompat(AT_FDCWD, filename_user, NULL, NULL, NULL);
+ return ksu_handle_execve_sucompat(AT_FDCWD, filename_user, NULL, NULL,
+ NULL);
}
#if 1
@@ -279,6 +321,23 @@ static struct kprobe execve_kp = {
};
#endif
+static int devpts_get_priv_pre(struct kprobe *p, struct pt_regs *regs)
+{
+ struct inode *inode;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
+ struct dentry *dentry = (struct dentry *)PT_REGS_PARM1(regs);
+ inode = dentry->d_inode;
+#else
+ inode = (struct inode *)PT_REGS_PARM1(regs);
+#endif
+
+ return ksu_handle_devpts(inode);
+}
+
+static struct kprobe devpts_get_priv_kp = { .symbol_name = "devpts_get_priv",
+ .pre_handler =
+ devpts_get_priv_pre };
+
#endif
// sucompat: permited process can execute 'su' to gain root access.
@@ -292,13 +351,17 @@ void ksu_sucompat_init()
pr_info("sucompat: newfstatat_kp: %d\n", ret);
ret = register_kprobe(&faccessat_kp);
pr_info("sucompat: faccessat_kp: %d\n", ret);
+ ret = register_kprobe(&devpts_get_priv_kp);
+ pr_info("sucompat: devpts_kp: %d\n", ret);
#endif
}
-void ksu_sucompat_exit() {
+void ksu_sucompat_exit()
+{
#ifdef CONFIG_KPROBES
unregister_kprobe(&execve_kp);
unregister_kprobe(&newfstatat_kp);
unregister_kprobe(&faccessat_kp);
+ unregister_kprobe(&devpts_get_priv_kp);
#endif
}
diff --git a/manager/app/src/main/res/values-fr/strings.xml b/manager/app/src/main/res/values-fr/strings.xml
index 163e8b596b22..1c3c3d5b919c 100644
--- a/manager/app/src/main/res/values-fr/strings.xml
+++ b/manager/app/src/main/res/values-fr/strings.xml
@@ -120,4 +120,15 @@
Sélectionner une KMI
Minimiser l\'image clairsemée
Redimensionne l\'image clairsemée où se trouve le module à sa taille réelle. Notez que cela peut entraîner un dysfonctionnement du module, alors utilisez cette fonctionnalité uniquement lorsque nécessaire (pour la sauvegarde, par exemple)
+ Désinstaller
+ Désinstaller temporairement
+ Désinstaller définitivement
+ Restaurer l\'image stock
+ Restaurer l\'image stock d\'usine (s\'il en existe une sauvegarde), option généralement utilisée avant une mise à jour OTA ; si vous avez besoin de désinstaller KernelSU, utilisez plutôt l\'option « Désinstaller définitivement ».
+ Flash en cours
+ Flash réussi
+ Échec du flash
+ lkm sélectionné : %s
+ Désinstallation complète et permanente de KernelSU (root et tous les modules).
+ Désinstaller KernelSU temporairement et rétablir l\'état original au redémarrage suivant.
\ No newline at end of file
diff --git a/manager/app/src/main/res/values-it/strings.xml b/manager/app/src/main/res/values-it/strings.xml
index bf224c17fd25..885f5d8fdf63 100644
--- a/manager/app/src/main/res/values-it/strings.xml
+++ b/manager/app/src/main/res/values-it/strings.xml
@@ -11,7 +11,7 @@
KernelSU ora supporta solo i kernel GKI
Kernel
Versione del manager
- Impronta
+ Impronta della build di Android
Stato di SELinux
Disabilitato
Enforcing
diff --git a/manager/app/src/main/res/values-ja/strings.xml b/manager/app/src/main/res/values-ja/strings.xml
index f1c5c401cd34..d210e0e19df6 100644
--- a/manager/app/src/main/res/values-ja/strings.xml
+++ b/manager/app/src/main/res/values-ja/strings.xml
@@ -118,15 +118,15 @@
\n続く?
直接インストール (推奨)
ファイルを選択してください
- まばらな画像を最小限に抑える
- モジュールが配置されているスパース イメージのサイズを実際のサイズに変更します。 モジュールが正常に動作しなくなる可能性がありますので、必要な場合(バックアップ等)にのみご使用ください
+ スパースイメージを最小化
+ モジュールが配置されているスパースイメージのサイズを実際のサイズに変更します。 モジュールが正常に動作しなくなる可能性がありますので、必要な場合にのみご使用ください
完全にアンインストールする
- ストック图像を復元
+ ストックイメージを復元
一時的にアンインストールする
アンインストール
KernelSU を一時的にアンインストールし、次回の再起動後に元の状態に戻します。
KernelSU (ルートおよびすべてのモジュール) を完全かつ永久にアンインストールします。
- 通常、OTA の前に使用される工場出荷時のイメージを復元します (バックアップが存在する場合)。 KernelSUをアンインストールする必要がある場合は、「永久アンインストール」を使用してください。
+ バックアップが存在する場合、工場出荷時のイメージを復元できます (OTA の前に使用してください)。KernelSU をアンインストールする必要がある場合は、「完全にアンインストールする」を使用してください。
フラッシュ
フラッシュ成功
フラッシュ失敗
diff --git a/manager/app/src/main/res/values-lv/strings.xml b/manager/app/src/main/res/values-lv/strings.xml
index f185a312b3f3..70c2fe269e87 100644
--- a/manager/app/src/main/res/values-lv/strings.xml
+++ b/manager/app/src/main/res/values-lv/strings.xml
@@ -17,7 +17,7 @@
Superlietotāji: %d
Moduļi: %d
Neatbalstīts
- KernelSU tagad atbalsta tikai GKI kodolus
+ KernelSU atbalsta tikai GKI kodolus
Kodols
Pārvaldnieka versija
Pirkstu nospiedums
@@ -51,7 +51,7 @@
https://kernelsu.org/guide/what-is-kernelsu.html
Uzzināt, kā instalēt KernelSU un izmantot moduļus
Atbalsti mūs
- Skatiet avota kodu vietnē %1$s
Pievienojies mūsu %2$s kanālam
+ Skatiet avota kodu vietnē %1$s
Pievienojies mūsu %2$s kanālam
Noklusējums
Veidne
Pielāgots
@@ -101,4 +101,33 @@
Grupas
Globāli
Pašreizējā KernelSU versija %d ir pārāk zema, lai pārvaldnieks darbotos pareizi. Lūdzu, atjauniniet uz versiju %d vai jaunāku!
+ Iespējot WebView atkļūdošanu
+ Ieteicams %1$s nodalījuma attēls
+ Nākamais
+ Mantots
+ Izvēlieties failu
+ Instalēt neaktīvajā slotā (pēc OTA)
+ Pēc restartēšanas jūsu ierīce tiks **PIESPIESTI** palaista pašreizējā neaktīvajā slotā!
+\nIzmantojiet šo opciju tikai pēc OTA pabeigšanas
+\nTurpināt?
+ Tiešā instalēšana (Ieteicams)
+ Atinstalēt
+ Pagaidu atinstalēšana
+ Atjaunot oriģinālo attēlu
+ Īslaicīgi atinstalēt KernelSU, pēc nākamās restartēšanas atjaunot sākotnējo stāvokli.
+ KernelSU (saknes un visu moduļu) pilnīga atinstalēšana.
+ Atjaunojot rūpnīcas attēlu (ja ir dublējums), ko parasti izmanto pirms OTA; ja nepieciešams atinstalēt KernelSU, lūdzu, izmantojiet \"Neatgriezeniski atinstalēt\".
+ Izvēlētais lkm: %s
+ Neizdevās piešķirt sakni!
+ Atvērt
+ Pārbaudīt atjauninājumus
+ Automātiski pārbaudīt atjauninājumus atverot aplikāciju
+ Var izmantot WebUI atkļūdošanai, lūdzu, izmantot tikai tad, kad tas ir nepieciešams.
+ Izvēlieties KMI
+ Neatgriezeniski atinstalēt
+ Instalē
+ Instalēts veiksmīgi
+ Instalēšana neizdevās
+ Samazināt reto attēlu
+ Mainīt retā attēla izmēru, kurā atrodas modulis, līdz tā faktiskajam izmēram. Ņemiet vērā, ka tas var izraisīt moduļa neparastu darbību, tāpēc, lūdzu, izmantojiet tikai nepieciešamības gadījumā (piemēram, dublēšanai)
\ No newline at end of file
diff --git a/manager/app/src/main/res/values-nl/strings.xml b/manager/app/src/main/res/values-nl/strings.xml
index 8e82e2af05b4..791bf4739cbe 100644
--- a/manager/app/src/main/res/values-nl/strings.xml
+++ b/manager/app/src/main/res/values-nl/strings.xml
@@ -119,4 +119,10 @@
\nGebruik deze optie alleen nadat OTA is voltooid.
\nDoorgaan?
Installeren in inactief slot (na OTA)
+ KMI selecteren
+ Desinstalleren
+ Tijdelijk verwijderen
+ Permanent verwijderen
+ Herstel stockafbeelding
+ Verwijder KernelSU tijdelijk en herstel het naar de oorspronkelijke staat na de volgende herstart.
\ No newline at end of file
diff --git a/manager/app/src/main/res/values-ro/strings.xml b/manager/app/src/main/res/values-ro/strings.xml
index 933108910714..4a991ef72713 100644
--- a/manager/app/src/main/res/values-ro/strings.xml
+++ b/manager/app/src/main/res/values-ro/strings.xml
@@ -125,4 +125,7 @@
Dezinstalează definitiv
Dezinstalare KernelSU (Root și toate modulele) complet și permanent.
Restaurează imaginea stoc din fabrică (dacă există o copie de rezervă), utilizată de obicei înainte de OTA; dacă trebuie să dezinstalezi KernelSU, utilizează „Dezinstalare permanentă”.
+ Instalare
+ Instalare reușită
+ Instalarea a eșuat
\ No newline at end of file
diff --git a/manager/app/src/main/res/values-ru/strings.xml b/manager/app/src/main/res/values-ru/strings.xml
index b22f275919cc..f07ef3e2eb8c 100644
--- a/manager/app/src/main/res/values-ru/strings.xml
+++ b/manager/app/src/main/res/values-ru/strings.xml
@@ -130,8 +130,8 @@
Удалить
Восстановить Сток образ
Восстановить стоковый заводской образ (если существует резервная копия), обычно используется перед OTA; если вам нужно удалить KernelSU, используйте «Удалить Навсегда».
- Прошивка выполнена
- Прошивка
- Прошивка не выполнена
+ Установка выполнена
+ Установка
+ Установка не выполнена
Выбран lkm: %s
\ No newline at end of file
diff --git a/manager/gradle/libs.versions.toml b/manager/gradle/libs.versions.toml
index 0cf1201a985e..5fdfaa014758 100644
--- a/manager/gradle/libs.versions.toml
+++ b/manager/gradle/libs.versions.toml
@@ -1,9 +1,9 @@
[versions]
-agp = "8.3.2"
+agp = "8.4.0"
kotlin = "1.9.23"
ksp = "1.9.23-1.0.20"
compose-compiler = "1.5.11"
-compose-bom = "2024.04.01"
+compose-bom = "2024.05.00"
lifecycle = "2.7.0"
accompanist = "0.34.0"
navigation = "2.7.7"
@@ -13,7 +13,7 @@ coil-compose = "2.6.0"
compose-destination = "1.10.2"
sheets-compose-dialogs = "1.3.0"
markdown = "4.6.2"
-webkit = "1.10.0"
+webkit = "1.11.0"
appiconloader-coil = "1.5.0"
parcelablelist = "2.0.1"
libsu = "5.2.2"
diff --git a/userspace/ksud/Cargo.lock b/userspace/ksud/Cargo.lock
index 1490e7ad14ff..d3ddd289da25 100644
--- a/userspace/ksud/Cargo.lock
+++ b/userspace/ksud/Cargo.lock
@@ -499,6 +499,17 @@ dependencies = [
"subtle",
]
+[[package]]
+name = "displaydoc"
+version = "0.2.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.58",
+]
+
[[package]]
name = "either"
version = "1.10.0"
@@ -543,6 +554,12 @@ dependencies = [
"log",
]
+[[package]]
+name = "equivalent"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
+
[[package]]
name = "errno"
version = "0.2.8"
@@ -637,6 +654,12 @@ version = "0.28.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253"
+[[package]]
+name = "hashbrown"
+version = "0.14.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
+
[[package]]
name = "heck"
version = "0.5.0"
@@ -746,6 +769,16 @@ dependencies = [
"proc-macro-hack",
]
+[[package]]
+name = "indexmap"
+version = "2.2.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26"
+dependencies = [
+ "equivalent",
+ "hashbrown",
+]
+
[[package]]
name = "inout"
version = "0.1.3"
@@ -844,7 +877,7 @@ dependencies = [
"sha256",
"tempdir",
"which",
- "zip 1.1.3",
+ "zip 1.2.1",
"zip-extensions",
]
@@ -963,6 +996,27 @@ dependencies = [
"autocfg",
]
+[[package]]
+name = "num_enum"
+version = "0.7.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "02339744ee7253741199f897151b38e72257d13802d4ee837285cc2990a90845"
+dependencies = [
+ "num_enum_derive",
+]
+
+[[package]]
+name = "num_enum_derive"
+version = "0.7.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b"
+dependencies = [
+ "proc-macro-crate",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.58",
+]
+
[[package]]
name = "object"
version = "0.32.2"
@@ -1025,6 +1079,15 @@ version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
+[[package]]
+name = "proc-macro-crate"
+version = "3.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284"
+dependencies = [
+ "toml_edit",
+]
+
[[package]]
name = "proc-macro-hack"
version = "0.5.20+deprecated"
@@ -1458,6 +1521,23 @@ dependencies = [
"pin-project-lite",
]
+[[package]]
+name = "toml_datetime"
+version = "0.6.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1"
+
+[[package]]
+name = "toml_edit"
+version = "0.21.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1"
+dependencies = [
+ "indexmap",
+ "toml_datetime",
+ "winnow",
+]
+
[[package]]
name = "typenum"
version = "1.17.0"
@@ -1682,6 +1762,15 @@ version = "0.52.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8"
+[[package]]
+name = "winnow"
+version = "0.5.40"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876"
+dependencies = [
+ "memchr",
+]
+
[[package]]
name = "winsafe"
version = "0.0.19"
@@ -1710,17 +1799,20 @@ dependencies = [
[[package]]
name = "zip"
-version = "1.1.3"
+version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2e6cb8909b2e8e6733c9ef67d35be1a27105644d362aafb5f8b2ba395727adf6"
+checksum = "006d078b7b6fc587bb25e022ad39e7086f44e5c4fef6076964ea601533241beb"
dependencies = [
"arbitrary",
- "byteorder",
"bzip2",
"crc32fast",
"crossbeam-utils",
"deflate64",
+ "displaydoc",
"flate2",
+ "indexmap",
+ "num_enum",
+ "thiserror",
"time",
"zstd 0.13.1",
]
diff --git a/userspace/ksud/Cargo.toml b/userspace/ksud/Cargo.toml
index 3aaf32d41d32..51bc29789a3b 100644
--- a/userspace/ksud/Cargo.toml
+++ b/userspace/ksud/Cargo.toml
@@ -10,7 +10,7 @@ rust-version = "1.77.2"
anyhow = "1"
clap = { version = "4", features = ["derive"] }
const_format = "0.2"
-zip = { version = "1.1", features = [
+zip = { version = "1.2", features = [
"deflate",
"deflate64",
"bzip2",
diff --git a/website/docs/guide/how-to-integrate-for-non-gki.md b/website/docs/guide/how-to-integrate-for-non-gki.md
index 18ba342b837a..69e332093852 100644
--- a/website/docs/guide/how-to-integrate-for-non-gki.md
+++ b/website/docs/guide/how-to-integrate-for-non-gki.md
@@ -264,6 +264,8 @@ index 2ff887661237..e758d7db7663 100644
return -EINVAL;
```
+### Safe Mode
+
To enable KernelSU's builtin SafeMode, You should also modify `input_handle_event` in `drivers/input/input.c`:
:::tip
@@ -297,6 +299,38 @@ index 45306f9ef247..815091ebfca4 100755
add_input_randomness(type, code, value);
```
+:::info Entering safe mode accidiently?
+If you use manual integration and do not disable `CONFIG_KPROBES`, then the user may trigger safe mode by pressing the volume down button after booting! Therefore if using manual integration you need to disable `CONFIG_KPROBES`!
+:::
+
+### Failed to execute `pm` in terminal?
+
+You should modify `fs/devpts/inode.c`, reference:
+
+```diff
+diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
+index 32f6f1c68..d69d8eca2 100644
+--- a/fs/devpts/inode.c
++++ b/fs/devpts/inode.c
+@@ -602,6 +602,8 @@ struct dentry *devpts_pty_new(struct pts_fs_info *fsi, int index, void *priv)
+ return dentry;
+ }
+
++extern int ksu_handle_devpts(struct inode*);
++
+ /**
+ * devpts_get_priv -- get private data for a slave
+ * @pts_inode: inode of the slave
+@@ -610,6 +612,7 @@ struct dentry *devpts_pty_new(struct pts_fs_info *fsi, int index, void *priv)
+ */
+ void *devpts_get_priv(struct dentry *dentry)
+ {
++ ksu_handle_devpts(dentry->d_inode);
+ if (dentry->d_sb->s_magic != DEVPTS_SUPER_MAGIC)
+ return NULL;
+ return dentry->d_fsdata;
+```
+
### How to backport path_umount
You can get module umount feature working on pre-GKI kernels by manually backporting `path_umount` from 5.9. You can use this patch as reference:
@@ -347,7 +381,3 @@ You can get module umount feature working on pre-GKI kernels by manually backpor
```
Finally, build your kernel again, KernelSU should work well.
-
-:::info Entering safe mode accidiently?
-If you use manual integration and do not disable `CONFIG_KPROBES`, then the user may trigger safe mode by pressing the volume down button after booting! Therefore if using manual integration you need to disable `CONFIG_KPROBES`!
-:::
diff --git a/website/docs/zh_CN/guide/how-to-integrate-for-non-gki.md b/website/docs/zh_CN/guide/how-to-integrate-for-non-gki.md
index 4fc98a0883c9..6118756a25f5 100644
--- a/website/docs/zh_CN/guide/how-to-integrate-for-non-gki.md
+++ b/website/docs/zh_CN/guide/how-to-integrate-for-non-gki.md
@@ -258,12 +258,18 @@ index 2ff887661237..e758d7db7663 100644
return -EINVAL;
```
+### 安全模式
+
要使用 KernelSU 内置的安全模式,你还需要修改 `drivers/input/input.c` 中的 `input_handle_event` 方法:
:::tip
强烈建议开启此功能,对用户救砖会非常有帮助!
:::
+:::info 莫名其妙进入安全模式?
+如果你采用手动集成的方式,并且没有禁用`CONFIG_KPROBES`,那么用户在开机之后按音量下,也可能触发安全模式!因此如果使用手动集成,你需要关闭 `CONFIG_KPROBES`!
+:::
+
```diff
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 45306f9ef247..815091ebfca4 100755
@@ -291,7 +297,35 @@ index 45306f9ef247..815091ebfca4 100755
add_input_randomness(type, code, value);
```
-### 如何backport(向旧版本移植) path_umount {#how-to-backport-path-umount}
+### pm 命令执行失败?
+
+你需要同时修改 `fs/devpts/inode.c`,补丁如下:
+
+```diff
+diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
+index 32f6f1c68..d69d8eca2 100644
+--- a/fs/devpts/inode.c
++++ b/fs/devpts/inode.c
+@@ -602,6 +602,8 @@ struct dentry *devpts_pty_new(struct pts_fs_info *fsi, int index, void *priv)
+ return dentry;
+ }
+
++extern int ksu_handle_devpts(struct inode*);
++
+ /**
+ * devpts_get_priv -- get private data for a slave
+ * @pts_inode: inode of the slave
+@@ -610,6 +612,7 @@ struct dentry *devpts_pty_new(struct pts_fs_info *fsi, int index, void *priv)
+ */
+ void *devpts_get_priv(struct dentry *dentry)
+ {
++ ksu_handle_devpts(dentry->d_inode);
+ if (dentry->d_sb->s_magic != DEVPTS_SUPER_MAGIC)
+ return NULL;
+ return dentry->d_fsdata;
+```
+
+### path_umount {#how-to-backport-path-umount}
你可以通过从K5.9向旧版本移植`path_umount`,在GKI之前的内核上获得卸载模块的功能。你可以通过以下补丁作为参考:
@@ -341,7 +375,3 @@ index 45306f9ef247..815091ebfca4 100755
```
改完之后重新编译内核即可。
-
-:::info 莫名其妙进入安全模式?
-如果你采用手动集成的方式,并且没有禁用`CONFIG_KPROBES`,那么用户在开机之后按音量下,也可能触发安全模式!因此如果使用手动集成,你需要关闭 `CONFIG_KPROBES`!
-:::