国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

Android :user版本賦予su權(quán)限

這篇具有很好參考價(jià)值的文章主要介紹了Android :user版本賦予su權(quán)限。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

1. userdebug和user版本

2. 關(guān)閉selinux

system/core

diff --git a/init/selinux.cpp b/init/selinux.cpp
index 5a0255acd..787917274 100644
--- a/init/selinux.cpp
+++ b/init/selinux.cpp
@@ -104,6 +104,8 @@ EnforcingStatus StatusFromCmdline() {
 }
bool IsEnforcing() {
+    return false;    
+
     if (ALLOW_PERMISSIVE_SELINUX) {
         return StatusFromCmdline() == SELINUX_ENFORCING;
     }

3. 修改su.cpp,注釋用戶組權(quán)限檢測(cè)

system/extras/su/su.cpp

 diff --git a/su/su.cpp b/su/su.cpp
 index 1a1ab6bf..af3d2a68 100644--- a/su/su.cpp
 +++ b/su/su.cpp
 @@ -80,8 +80,8 @@ void extract_uidgids(const char* uidgids, uid_t* uid, gid_t* gid, gid_t* gids, i
 }
 int main(int argc, char** argv) {
-    uid_t current_uid = getuid();
-    if (current_uid != AID_ROOT && current_uid != AID_SHELL) error(1, 0, "not 
allowed");
+    //uid_t current_uid = getuid();
+    //if (current_uid != AID_ROOT && current_uid != AID_SHELL) error(1, 0, "not 
allowed");       
    // Handle -h and --help.
    ++argv;

4. 給 su 文件默認(rèn)授予 root 權(quán)限

system/core/libcutils/fs_config.cpp

diff --git a/libcutils/fs_config.cpp b/libcutils/fs_config.cpp
index 5805a4d19..92e93e76f 100644
--- a/libcutils/fs_config.cpp
+++ b/libcutils/fs_config.cpp
@@ -86,7 +86,7 @@ static const struct fs_path_config android_dirs[] = {
    { 00751, AID_ROOT,    AID_SHELL,    0, "system/bin" },
    { 00755, AID_ROOT,    AID_ROOT,     0, "system/etc/ppp" },
    { 00755, AID_ROOT,    AID_SHELL,    0, "system/vendor" },
-   { 00750, AID_ROOT,    AID_SHELL,    0, "system/xbin" },
+   { 00755, AID_ROOT,    AID_SHELL,    0, "system/xbin" },        
    { 00751, AID_ROOT,    AID_SHELL,    0, "system/apex/*/bin" },   
    { 00751, AID_ROOT,    AID_SHELL,    0, "system_ext/bin" }, 
    { 00751, AID_ROOT,    AID_SHELL,    0, "system_ext/apex/*/bin" },
 
@@ -190,7 +190,7 @@ static const struct fs_path_config android_files[] = {
 // the following two files are INTENTIONALLY set-uid, but they
 // are NOT included on user builds.
    { 06755, AID_ROOT,  AID_ROOT,       0, "system/xbin/procmem" },   
-   { 04750, AID_ROOT,  AID_SHELL,      0, "system/xbin/su" },
+   { 06755, AID_ROOT,  AID_SHELL,      0, "system/xbin/su" }, 
    
  

 

frameworks/base/core/jni/com_android_internal_os_Zygote.cpp

diff --git a/core/jni/com_android_internal_os_Zygote.cpp 
b/core/jni/com_android_internal_os_Zygote.cpp
index 9eede83e21e5..694eec2a40ac 100644
--- a/core/jni/com_android_internal_os_Zygote.cpp
+++ b/core/jni/com_android_internal_os_Zygote.cpp
@@ -656,6 +656,7 @@ static void EnableKeepCapabilities(fail_fn_t fail_fn) {
 }

 static void DropCapabilitiesBoundingSet(fail_fn_t fail_fn) {
+/*
    for (int i = 0; prctl(PR_CAPBSET_READ, i, 0, 0, 0) >= 0; i++) {;
        if (prctl(PR_CAPBSET_DROP, i, 0, 0, 0) == -1) {
            if (errno == EINVAL) {
@@ -666,6 +667,7 @@ static void DropCapabilitiesBoundingSet(fail_fn_t fail_fn) {
            }
        }    
     }
+  */
 }

kernel/security/commoncap.c

diff --git a/security/commoncap.c b/security/commoncap.c
index f86557a8e43f6..19124dd6239a1 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -1147,12 +1147,12 @@ int cap_task_setnice(struct task_struct *p, int nice)
 static int cap_prctl_drop(unsigned long cap)
 {
     struct cred *new;
-
+/*
     if (!ns_capable(current_user_ns(), CAP_SETPCAP))
         return -EPERM;
     if (!cap_valid(cap))
         return -EINVAL;
-
+*/
     new = prepare_creds();
     if (!new)
         return -ENOMEM;

5. user版本需要把su編進(jìn)系統(tǒng)

build/core文章來源地址http://www.zghlxwxcb.cn/news/detail-783478.html

diff --git a/target/product/base_system.mk b/target/product/base_system.mk
index 4569bceff9..5c8eaaa87c 100644
--- a/target/product/base_system.mk
+++ b/target/product/base_system.mk
@@ -273,6 +273,7 @@ PRODUCT_PACKAGES += \
    wificond \
    wifi.rc \
    wm \
+   su \

# VINTF data for system image
PRODUCT_PACKAGES += \

@@ -378,7 +379,6 @@ PRODUCT_PACKAGES_DEBUG := \
     ss \
     start_with_lockagent \
     strace \
-    su \
     sanitizer-status \
     tracepath \
     tracepath6 \

到了這里,關(guān)于Android :user版本賦予su權(quán)限的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • [SM6225][Android13]user版本默認(rèn)允許root和remount

    芯片: ?高通SM6225 版本: ?Android?13 kernel: ?msm-5.15 ? ? ? ?剛剛從Framework踏入性能的小殿堂,User版本默認(rèn)是不會(huì)開啟root權(quán)限的,而且一般調(diào)試需要設(shè)置一下CPU GPU DDR performance模式或者修改一些schedule util等調(diào)核調(diào)頻節(jié)點(diǎn)去對(duì)比復(fù)測(cè),userdebug版本的話本身整機(jī)性能就比user卡很多,

    2024年02月09日
    瀏覽(43)
  • Android 修改 SELinux avc 權(quán)限的方法

    Android 修改 SELinux avc 權(quán)限的方法

    系統(tǒng)版本:Android 11.0???? 平???????? 臺(tái):RK3568 在 Android 系統(tǒng)的開發(fā)及適配過程中,我們常常需要對(duì) SELinux avc? 權(quán)限進(jìn)行修改,以下是我對(duì) SELinux avc? 權(quán)限修改總結(jié)的方法。 一、驗(yàn)證功能是否存在 selinux 權(quán)限問題 #進(jìn)入Android終端 adb shell #獲取root權(quán)限 su #查看系統(tǒng)當(dāng)前 s

    2024年02月09日
    瀏覽(29)
  • MTK Android13 user版本進(jìn)入engineermode的Bluetooth測(cè)試項(xiàng)時(shí)閃退

    平臺(tái):MT6771 android13 問題描述:進(jìn)入到工模,點(diǎn)擊進(jìn)入Bluetooth測(cè)試項(xiàng)直接閃退 Log如下: 從日志咱們可以看到: 很明顯這個(gè)服務(wù)沒有注冊(cè),找到編譯規(guī)則s0_vnd/device/mediatek/vendor/common/device.mk,可以看到以下: 可以看到只有在編譯eng,userdebug版本時(shí)會(huì)編譯em_hidl,那在編譯規(guī)則中加

    2024年02月05日
    瀏覽(25)
  • Android所有版本的存儲(chǔ)權(quán)限適配

    ? ? ? ? ? ? ?第一步:在Manifest文件添加如下權(quán)限 ?? ? ? ? uses-permission android:name=\\\"android.permission.WRITE_EXTERNAL_STORAGE\\\" android:maxSdkVersion=\\\"28\\\" tools:ignore=\\\"ScopedStorage\\\"/ ? ? ? ? ? ? ?uses-permission android:name=\\\"android.permission.MANAGE_EXTERNAL_STORAGE\\\"/ ?? ? ? ? uses-permission android:name=\\\"android.p

    2024年01月17日
    瀏覽(28)
  • Android版本實(shí)現(xiàn)root權(quán)限(本辦法適用于所有android平臺(tái))

    本方法適用于所有Android版本 userdebug和user版本 關(guān)閉selinux system/core 修改su.cpp,注釋用戶組權(quán)限檢測(cè) system/extras/su/su.cpp diff --git a/su/su.cpp b/su/su.cpp index 1a1ab6bf..af3d2a68 100644 --- a/su/su.cpp +++ b/su/su.cpp @@ -80,8 +80,8 @@ void extract_uidgids(const char* uidgids, uid_t* uid, gid_t* gid, gid_t* gids, i } int ma

    2024年02月06日
    瀏覽(18)
  • android 高版本sd卡目錄讀寫權(quán)限

    1、從安卓11不允許訪問sd目錄,官方說明如下: https://developer.android.com/about/versions/11/privacy/storage?hl=zh-cn 2、使用MediaStore方法 一手遮天 Android - 存儲(chǔ): Android 11 通過 MediaStore 管理文件 - webabcd - 博客園 (cnblogs.com)? 3、關(guān)于權(quán)限的文章 (31條消息) Android 10、11分區(qū)存儲(chǔ)適配踩坑總結(jié)_安

    2024年02月15日
    瀏覽(17)
  • 一篇文章搞定Android權(quán)限問題(全版本)

    一篇文章搞定Android權(quán)限問題(全版本)

    文章內(nèi)容如下: 如果你只是想快速的完成你Android權(quán)限申請(qǐng)的工作,那么直接上工具PermissionX 如果是想真正的了解Android的權(quán)限問題,那么建議你用15分鐘通讀一下本文。(可以不去實(shí)驗(yàn),收藏以備后用) 首先了解Android版本和SDK的關(guān)系,幫助我們分辨后面的權(quán)限版本。 其次把最常

    2023年04月20日
    瀏覽(20)
  • 一篇文章搞定《Android權(quán)限問題(全版本)》

    一篇文章搞定《Android權(quán)限問題(全版本)》

    文章內(nèi)容如下: 如果你只是想快速的完成你Android權(quán)限申請(qǐng)的工作,那么直接上工具PermissionX 如果是想真正的了解Android的權(quán)限問題,那么建議你用15分鐘通讀一下本文。(可以不去實(shí)驗(yàn),收藏以備后用) 首先了解Android版本和SDK的關(guān)系,幫助我們分辨后面的權(quán)限版本。 其次把最常

    2024年02月03日
    瀏覽(67)
  • Linux系統(tǒng)知識(shí)4—Linux的root用戶,su 和 exit 命令,sudo 命令,用戶和用戶組管理,getent,查看權(quán)限控制,修改權(quán)限控制 -chmod,修改權(quán)限控制-chown

    Linux系統(tǒng)知識(shí)4—Linux的root用戶,su 和 exit 命令,sudo 命令,用戶和用戶組管理,getent,查看權(quán)限控制,修改權(quán)限控制 -chmod,修改權(quán)限控制-chown

    目錄 一.Linux的root用戶 1.1 root用戶(超級(jí)管理員) 1.2?su 和 exit 命令 1.3 sudo?命令 1.為普通用戶配置?sudo?認(rèn)證 二.用戶和用戶組管理 2.1用戶,用戶組 2.2用戶組的管理 2.3用戶管理 2.4.getent 三.查看權(quán)限控制 3.1認(rèn)知權(quán)限信息 1.序號(hào)1,表示文件,文件夾的權(quán)限控制信息 2. 序號(hào)2,表

    2024年01月17日
    瀏覽(91)
  • android studio開發(fā)——android11版本以上權(quán)限動(dòng)態(tài)申請(qǐng)問題,包括文件讀寫、圖片、相機(jī)的調(diào)用

    用于android手機(jī)的升級(jí),現(xiàn)在已經(jīng)是android13版本了,對(duì)于權(quán)限問題可能更加敏感了,前段時(shí)間開發(fā)發(fā)現(xiàn)之前的方法已經(jīng)不再適用于android11以后的版本了 讀寫權(quán)限申請(qǐng)最好是跳轉(zhuǎn)到設(shè)置中進(jìn)行才是最好了,下面我們開始進(jìn)行 首先是AndroidManifest.xml文件的權(quán)限 然后這里講解一下權(quán)

    2024年02月10日
    瀏覽(21)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包