sealdice-android icon indicating copy to clipboard operation
sealdice-android copied to clipboard

[Bug]: 一种部分手机上的内置客户端 sched_setaffinity 权限问题,以及一种可能的方案

Open fy0 opened this issue 10 months ago • 2 comments

在提问之前...

  • [X] 我理解 Issue 是用于反馈和解决问题的,而非吐槽评论区,将尽可能提供更多信息帮助问题解决
  • [X] 我填写了简短且清晰明确的标题,以便开发者在翻阅 issue 列表时能快速确定大致问题。而不是“一个建议”、“卡住了”等
  • [X] 我已查看master branch或最新测试版的更新内容,并未提及该 bug 已被修复的情况
  • [X] 已有issue中并没有看见其他人与我反馈相同的问题

问题描述

报错:

7972  <... rt_sigprocmask resumed>NULL, 8) = 0
7974  <... sched_getaffinity resumed>[0 1 2 3 4 5 6 7]) = 8
7972  futex(0x7fe95c02d4, FUTEX_WAIT_PRIVATE, 2, NULL <unfinished ...>
7974  sched_setaffinity(0, 128, [0 1 2 3 4 5 6 7]) = -1 EPERM (Operation not permitted)
7974  futex(0x7fe95c02d4, FUTEX_WAKE_PRIVATE, 1) = 1
7972  <... futex resumed>)              = 0
7974  rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1 RT_2],  <unfinished ...>
7972  rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1 RT_2],  <unfinished ...>
7974  <... rt_sigprocmask resumed>[RTMIN], 8) = 0
7972  <... rt_sigprocmask resumed>[RTMIN], 8) = 0
7974  rt_sigprocmask(SIG_BLOCK, ~[],  <unfinished ...>
7972  futex(0x3f000c2e58, FUTEX_WAIT, 7974, NULL <unfinished ...>
7974  <... rt_sigprocmask resumed>~[KILL STOP RT_1 RT_2], 8) = 0
7974  munmap(0x7054a88000, 1585152)     = 0
7974  exit(0)                           = ?
7974  +++ exited with 0 +++
7972  <... futex resumed>)              = 0
7972  rt_sigprocmask(SIG_SETMASK, [RTMIN], NULL, 8) = 0
7972  writev(2, [{iov_base="", iov_len=0}, {iov_base="Failed to create CoreCLR, HRESULT: 0x8007054F", iov_len=45}], 2) = 45
7972  writev(2, [{iov_base="", iov_len=0}, {iov_base="\n", iov_len=1}], 2) = 1

sched_setaffinity 函数用于设置程序使用的cpu核心,但是只有在root下可用。 但是容器的root权限关闭了之后,仍然出这个问题。

一种方案: 使用 LD_PRELOAD 功能,重写 sched_setaffinity 为空函数

参考: https://github.com/termux/termux-exec

如何复现

添加内置客户端即可复现

你期望发生的

正常运行

实际上发生的

Failed to create CoreCLR, HRESULT: 0x8007054F

日志文件

截图

No response

App版本

0.6.0

海豹核心版本

1.4.5

设备信息

红米12t hyperOS

帐号类型

QQ

使用协议

No response

附加内容

No response

fy0 avatar Apr 05 '24 11:04 fy0

看不懂(

Szzrain avatar Apr 06 '24 04:04 Szzrain

follow up,目前仍然存在相关情况。(issue提到的设备为本人设备)

kenichiLyon avatar Aug 11 '24 15:08 kenichiLyon