Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App进程maps所有者和所属组被修改为root #260

Closed
Res2013 opened this issue Nov 8, 2023 · 5 comments
Closed

App进程maps所有者和所属组被修改为root #260

Res2013 opened this issue Nov 8, 2023 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@Res2013
Copy link

Res2013 commented Nov 8, 2023

Koom版本:master分支最新代码
模块:Koom Native Leak模块
真机信息:小米12S和IQOO 10(两个机器系统都是Android13),两个手机均未root
复现步骤:运行Koom源码的koom-demo模块,在首页点击"TEST NATIVE LEAK",跳转到新页面后点击"START NATIVE LEAK MONITOR"
结果:adb shell进入shell环境后,ps查看demo的pid,然后cd /proc/{pid}/,最后ls -al查看maps和smaps等文件的所有者和所属组,结果都是root。
期望:调用LeakMonitor.INSTANCE.start()后,/proc/{pid}/maps文件所有者和所属组是用户级而非root级的。

@Res2013
Copy link
Author

Res2013 commented Nov 8, 2023

补充一点:修改memory_analyzer.cpp文件中MemoryAnalyzer::CollectUnreachableMem()函数中的代码如下:
if (IsValid()) {// This is a test!
// ALOGE("MemoryAnalyzer NOT valid");
return std::move(unreachable_mem);
}
则没有出现上述问题。

@lbtrace
Copy link
Contributor

lbtrace commented Nov 8, 2023

补充一点:修改memory_analyzer.cpp文件中MemoryAnalyzer::CollectUnreachableMem()函数中的代码如下: if (IsValid()) {// This is a test! // ALOGE("MemoryAnalyzer NOT valid"); return std::move(unreachable_mem); } 则没有出现上述问题。

感谢反馈问题,你这个修改的意思是注释掉 MemoryAnalyzer::CollectUnreachableMem() 中的 “ ALOGE("MemoryAnalyzer NOT valid");” 就不会出现?

@Res2013
Copy link
Author

Res2013 commented Nov 8, 2023

补充一点:修改memory_analyzer.cpp文件中MemoryAnalyzer::CollectUnreachableMem()函数中的代码如下: if (IsValid()) {// This is a test! // ALOGE("MemoryAnalyzer NOT valid"); return std::move(unreachable_mem); } 则没有出现上述问题。

感谢反馈问题,你这个修改的意思是注释掉 MemoryAnalyzer::CollectUnreachableMem() 中的 “ ALOGE("MemoryAnalyzer NOT valid");” 就不会出现?

把if (!IsValid())改为if (IsValid())就不会出现

@Res2013
Copy link
Author

Res2013 commented Nov 9, 2023

查看了文档Linux manual page中的如下描述
#The files inside each /proc/pid directory are normally wned by the effective user and effective group ID of the process.However, as a security measure, the ownership is made root:root if the process's "dumpable" attribute is set to a value other than 1.

由于我是Debug包中使用,我把prctl(PR_SET_DUMPABLE, 0, 0, 0, 0);代码给注释掉了,也不存在上述问题。

@lbtrace
Copy link
Contributor

lbtrace commented Nov 9, 2023

查看了文档Linux manual page中的如下描述 #The files inside each /proc/pid directory are normally wned by the effective user and effective group ID of the process.However, as a security measure, the ownership is made root:root if the process's "dumpable" attribute is set to a value other than 1.

由于我是Debug包中使用,我把prctl(PR_SET_DUMPABLE, 0, 0, 0, 0);代码给注释掉了,也不存在上述问题。

Debug 包(默认 PR_SET_DUMPABLE 1)由于设置 PR_SET_DUMPABLE 为 0,确实改变了 /proc/pid 的 owner and group ID;我周末改成 prctl(PR_SET_DUMPABLE, original, 0, 0, 0) 吧兼容下 debug 包

@lbtrace lbtrace added the enhancement New feature or request label Nov 9, 2023
@lbtrace lbtrace self-assigned this Nov 9, 2023
lbtrace added a commit that referenced this issue Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants