Skip to content

APatch su shell does not inject right groups #1473

@mokurin000

Description

@mokurin000

Please check before submitting an issue | 在提交 Issue 前请检查

  • I searched the issues and didn't found anything relevant | 我已经搜索了 Issues 列表,没有发现于本问题相关内容
  • If the patch fails or the image cannot be booted after flashing the new boot.img, visit KernelPatch to clarify your doubts | 修复失败或刷入修补后镜像不能启动,请前往 KernelPatch 提问
  • I will upload the bug report file in APatch Manager > Settings > Send logs | 我会上传 Bug Report 文件从 APatch 管理器 > 设置 > 发送日志
  • I know how to reproduce the issue, which might not be specific to my device | 我知道如何重新复现这个问题

Version requirements | 版本要求

  • I'm using the latest CI version of APatch Manager | 我正在使用最新 CI 版本

Bug description | 描述 Bug

APatch /system/bin/su does not inject right gid, groups for non-root privileged user like shell.

This will only affect users who want to run a script/executable with ADB(shell) permission but not the root permission, limiting unnessacary privilege.

Reproduce method | 复现方法

In any terminal emulator,

Open a shell with shell (2000):

/system/bin/su shell

Then run id to inspect current uid, gid, groups.

Expected behavior | 预期行为

The actual ADB shell gives:

uid=2000(shell) gid=2000(shell) groups=2000(shell),1004(input),1007(log),1011(adb),1015(sdcard_rw),1028(sdcard_r),1078(ext_data_rw),1079(ext_obb_rw),3001(net_bt_admin),3002(net_bt),3003(inet),3006(net_bw_stats),3009(readproc),3011(uhid),3012(readtracefs) context=u:r:shell:s0

Actual behavior | 实际行为

uid=2000(shell) gid=0(root) groups=0(root) context=u:r:magisk:s0

Screenshots | 截图

No response

Logs | 日志

No response

Device name | 设备名称

PJE100

OS version | 系统版本

LineageOS 23

APatch version | APatch 版本

11142

Kernel version | 内核版本

5.15.202-g4e22ad8d830b

KernelPatch version | KernelPatch 版本

0.12.2

Other information | 其他信息

APatch_bugreport_2026-05-21_19_56.tar.gz

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions