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

BinderWrapper 遇到 IBinder.FLAG_ONEWAY 导致鉴权错误 #35

Open
Mufanc opened this issue Apr 8, 2022 · 2 comments
Open

BinderWrapper 遇到 IBinder.FLAG_ONEWAY 导致鉴权错误 #35

Mufanc opened this issue Apr 8, 2022 · 2 comments

Comments

@Mufanc
Copy link

Mufanc commented Apr 8, 2022

  该 Demo 的功能是设置 MIUI 的进程白名单,成功时会输出如下日志:

D/ProcessManager: update CL:[com.netease.cloudmusic]

  使用 Shizuku 时功能正常,输出如下日志:

D/Service: transact: uid=10527, descriptor=miui.IProcessManager, code=8

  使用 Sui 时发生鉴权错误,找到如下日志:

W/Service: Permission Denial: transactRemote from pid=0 is not an attached client

  已在多台设备上进行测试,均产生此问题。

  定位到打日志的位置,发现该错误由 clientRecord == null 引起,向上继续定位到 ClientManager#findClient(int uid, int pid)

public ClientRecord findClient(int uid, int pid) {
    for (ClientRecord clientRecord : clientRecords) {
        if (clientRecord.pid == pid && clientRecord.uid == uid) {
            return clientRecord;
        }
    }
    return null;
}

  可能是由于 oneway 导致此处 获取到的 pid 为 0,导致没有匹配到正确的 clientRecord

  不知道我的猜想是否正确,还请开发者帮忙看看。

RikkaW added a commit that referenced this issue Apr 9, 2022
@RikkaW
Copy link
Member

RikkaW commented Apr 9, 2022

@Mufanc
Copy link
Author

Mufanc commented Apr 9, 2022

正常了,非常感谢!

RikkaW added a commit to RikkaApps/Shizuku-API that referenced this issue Oct 29, 2022
When FLAG_ONEWAY is used, Binder#getCallingUid/Pid returns 0.

RikkaApps/Sui#35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants