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

Vivo手机因未知安全策略导致的无法正常启动ksud和su #1289

Open
3 tasks done
Bot-wxt1221 opened this issue Jan 15, 2024 · 242 comments
Open
3 tasks done

Vivo手机因未知安全策略导致的无法正常启动ksud和su #1289

Bot-wxt1221 opened this issue Jan 15, 2024 · 242 comments

Comments

@Bot-wxt1221
Copy link
Contributor

Bot-wxt1221 commented Jan 15, 2024

Please check before submitting an issue

  • I have searched the issues and haven't found anything relevant
  • I will upload bugreport file in KernelSU Manager - Settings - Report log
  • I know how to reproduce the issue which may not be specific to my device

Describe the bug

init: Command 'exec u:r:su:s0 root -- /data/adb/ksud boot-completed' action=sys.boot_completed=1 (/system/etc/init/atrace.rc:13) took 0ms and failed: Could not start exec service: Cannot find '/data/adb/ksud': Permission denied

关键日志,管理器提取的日志大小全为0,su正常,模块提示不支持OverLayFS,5.10.149-gki iqoo9 originos3 ,adb中把dmesg提出来了。

dmesg.txt

https://github.com/wxt1221/KernelSU/issues/9

记录了排错过程。

To Reproduce

我刷入ksu的img后会卡开机,刷入ak3后su正常使用

Expected behavior

正常使用模块功能,init能启动ksud

Screenshots

No response

Logs

如上

Device info

如上

Additional context

SELinux的锅大概是

@Bot-wxt1221
Copy link
Contributor Author

Bot-wxt1221 commented Jan 15, 2024

估计其他阶段的ksud也无法正常启动只是因为日志缓冲区没完全打出来,不过看这个也能看

@ItosEO
Copy link

ItosEO commented Jan 15, 2024

su不正常使用,超级用户列表无法加载(一直转圈)

@tiann
Copy link
Owner

tiann commented Jan 15, 2024

/data/system/packages.txt 提供一下

@Bot-wxt1221
Copy link
Contributor Author

@ItosEO

@tiann
Copy link
Owner

tiann commented Jan 15, 2024

可以把 SELinux 关了看下是否正常

@Bot-wxt1221
Copy link
Contributor Author

关过了,就是关了模块就好了,但是应用列表不正常

@Bot-wxt1221
Copy link
Contributor Author

所以我才说是SELinux的问题

@tiann
Copy link
Owner

tiann commented Jan 15, 2024

chcon u:object_r:system_file:s0 /data/adb/ksud 然后重启看下

@Bot-wxt1221
Copy link
Contributor Author

@ItosEO 这个人的手机,你看它在不在

@Bot-wxt1221
Copy link
Contributor Author

chcon u:object_r:system_file:s0 /data/adb/ksud 然后重启看下

但是是init爆的权限的问题啊

@tiann
Copy link
Owner

tiann commented Jan 15, 2024

用这个 e934bfb 再试一下

@ItosEO
Copy link

ItosEO commented Jan 15, 2024

您好,我在学校,但是我找到一个可以参与测试的人,我让他试试
我看到action还在build,稍后我会让他测试

@ItosEO
Copy link

ItosEO commented Jan 15, 2024

设备状态:已安装ksu-0.7.5(ak3刷入,和magisk共存)
/data/system/没有找的package.txt,所以我把package开头的文件都打包了
package.zip

@ItosEO
Copy link

ItosEO commented Jan 15, 2024

chcon u:object_r:system_file:s0 /data/adb/ksud 然后重启看下

提示找不到文件 /data/adb/ksud @tiann @wxt1221

@ItosEO
Copy link

ItosEO commented Jan 15, 2024

今天我会让他尝试使用e934bfb

@ItosEO
Copy link

ItosEO commented Jan 16, 2024

用这个 e934bfb 再试一下

已尝试,没有任何变化,仍然提示找不到ksud
6c30f6c9498f5b4497d92b8d3593e0c5_720

@tiann
Copy link
Owner

tiann commented Jan 16, 2024

用这个 e934bfb 再试一下

已尝试,没有任何变化,仍然提示找不到ksud 6c30f6c9498f5b4497d92b8d3593e0c5_720

再发一份 dmesg 看看;另外,你可能需要在 adb shell 里操作

@ItosEO
Copy link

ItosEO commented Jan 16, 2024

测试人员现在没有电脑,我让他先抓demsg,然后等他有电脑了再尝试adb shell执行
chcon u:object_r:system_file:s0 /data/adb/ksud

@ItosEO
Copy link

ItosEO commented Jan 16, 2024

离谱
db1926f37ba86f6c799b59c5a9d93b09_720
[ 23.608184] init: Command 'exec u:r:su:s0 root -- /data/adb/ksud boot-completed' action=sys
.boot_completed=1 (/system/etc/init/atrace.rc:13) took 0ms and failed: Could not start exec service: Cannot find '/data/adb/ksud': No such file or directory
dmes.log
@tiann

@Bot-wxt1221
Copy link
Contributor Author

用magisk的root看看/data/adb里有什么东西 @ItosEO

@ItosEO
Copy link

ItosEO commented Jan 16, 2024

c15e60121e3064b681a3eaa889c269ab_720
如图,我专门让他先还原了一下没刷ksu前的boot然后重刷ak3,依然是这样,管理器显示已安装ksu @tiann @wxt1221

@tiann
Copy link
Owner

tiann commented Jan 16, 2024

管理器没有 root 权限,导致 ksud 释放失败;你用 adb shell 手动copy一个 ksud 放到 /data/adb 下看下。

@ItosEO
Copy link

ItosEO commented Jan 16, 2024

管理器没有 root 权限,导致 ksud 释放失败;你用 adb shell 手动copy一个 ksud 放到 /data/adb 下看下。

我需要设置什么身份组以及文件权限,另外,我在哪里找ksud文件
是这里的第一个吗
image

@Bot-wxt1221
Copy link
Contributor Author

Y

@Bot-wxt1221
Copy link
Contributor Author

文件权限777,用户只有root才能放

@ItosEO
Copy link

ItosEO commented Jan 16, 2024

chcon u:object_r:system_file:s0 /data/adb/ksud 然后重启看下

已尝试手动copy ksud,dmesg貌似没问题,但是ksu管理器仍提示不支持overlayfs,超级用户列表无法加载
也尝试了执行这行代码重启(未报错),没有任何变化
dmesg.log
@tiann @wxt1221

@tiann
Copy link
Owner

tiann commented Jan 16, 2024

chcon u:object_r:system_file:s0 /data/adb/ksud 然后重启看下

已尝试手动copy ksud,dmesg貌似没问题,但是ksu管理器仍提示不支持overlayfs,超级用户列表无法加载 也尝试了执行这行代码重启(未报错),没有任何变化 dmesg.log @tiann @wxt1221

打开管理器,然后再发一下 dmesg,看一下管理器启动的日志

@ItosEO
Copy link

ItosEO commented Jan 16, 2024

chcon u:object_r:system_file:s0 /data/adb/ksud 然后重启看下

已尝试手动copy ksud,dmesg貌似没问题,但是ksu管理器仍提示不支持overlayfs,超级用户列表无法加载 也尝试了执行这行代码重启(未报错),没有任何变化 dmesg.log @tiann @wxt1221

打开管理器,然后再发一下 dmesg,看一下管理器启动的日志

dmesg.log
有些新东西
@tiann @wxt1221

@tiann
Copy link
Owner

tiann commented Jan 17, 2024

用 adb shell 执行 chcon u:object_r:adb_data_file:s0 /data/adb/ksud 再打开管理器试下

@ItosEO
Copy link

ItosEO commented Jan 17, 2024

ok,下午给您日志,这个手动copy进去的ksud我文件用户组设置的都是root-0,没错吧 @tiann @wxt1221

@Bot-wxt1221
Copy link
Contributor Author

Bot-wxt1221 commented Apr 5, 2024

@ItosEO 不是啊,fix-vivo这个分支就是从最新拉过来的,把整个dmesg传上来吧,应该是ksud没有释放,仍然是没有搞到root,你把之前编译内核时留下的关于输出kill的内核日志保留一下。

@ItosEO
Copy link

ItosEO commented Apr 5, 2024

你把之前编译内核时留下的关于输出kill的内核日志保留一下。

你把之前编译内核时留下的关于输出kill的内核日志保留一下。这是啥意思 @Bot-wxt1221

@Bot-wxt1221
Copy link
Contributor Author

Bot-wxt1221 commented Apr 5, 2024

你需要对kernel/signal.c 加上 include/cred.h 的引用,然后把__send_signal改成这样:

static int __send_signal(int sig, struct kernel_siginfo *info, struct task_struct *t,
			enum pid_type type, bool force)
{
	struct sigpending *pending;
	struct sigqueue *q;
	int override_rlimit;
	int ret = 0, result;

	assert_spin_locked(&t->sighand->siglock);

	result = TRACE_SIGNAL_IGNORED;
	if (!prepare_signal(sig, t, force))
		goto ret;

	pending = (type != PIDTYPE_PID) ? &t->signal->shared_pending : &t->pending;
	/*
	 * Short-circuit ignored signals and support queuing
	 * exactly one non-rt signal, so that we can get more
	 * detailed information about the cause of the signal.
	 */
	result = TRACE_SIGNAL_ALREADY_PENDING;
	if (legacy_queue(pending, sig))
		goto ret;

	result = TRACE_SIGNAL_DELIVERED;

        // ------------------此次过滤了kill信号
  const struct cred *cred = rcu_dereference_protected(t->cred,1);
	if (sig == SIGKILL&&cred->uid==0&&cred->gid==0) {
		printk("[Kill_Debug] dump stack");
		// 在函数中打印当前堆栈信息
    	        dump_stack();
		goto ret;
	}

@18-Xtreme把我改炸了

@18-Xtreme like this

@ItosEO
Copy link

ItosEO commented Apr 5, 2024

你需要对kernel/signal.c 加上 include/cred.h 的引用,然后把__send_signal改成这样:

static int __send_signal(int sig, struct kernel_siginfo *info, struct task_struct *t,
			enum pid_type type, bool force)
{
	struct sigpending *pending;
	struct sigqueue *q;
	int override_rlimit;
	int ret = 0, result;

	assert_spin_locked(&t->sighand->siglock);

	result = TRACE_SIGNAL_IGNORED;
	if (!prepare_signal(sig, t, force))
		goto ret;

	pending = (type != PIDTYPE_PID) ? &t->signal->shared_pending : &t->pending;
	/*
	 * Short-circuit ignored signals and support queuing
	 * exactly one non-rt signal, so that we can get more
	 * detailed information about the cause of the signal.
	 */
	result = TRACE_SIGNAL_ALREADY_PENDING;
	if (legacy_queue(pending, sig))
		goto ret;

	result = TRACE_SIGNAL_DELIVERED;

        // ------------------此次过滤了kill信号
  const struct cred *cred = rcu_dereference_protected(t->cred,1);
	if (sig == SIGKILL&&cred->uid==0&&cred->gid==0) {
		printk("[Kill_Debug] dump stack");
		// 在函数中打印当前堆栈信息
    	        dump_stack();
		goto ret;
	}

@18-Xtreme把我改炸了

@18-Xtreme like this

寄,不会

@Bot-wxt1221
Copy link
Contributor Author

@ItosEO 自己构建内核,你不是之前弄过吗

@ItosEO
Copy link

ItosEO commented Apr 5, 2024

@ItosEO 自己构建内核,你不是之前弄过吗

没啊,我内核方面算是小白 @Bot-wxt1221

@Bot-wxt1221
Copy link
Contributor Author

@ItosEO 内核压缩格式是啥

@Bot-wxt1221
Copy link
Contributor Author

Image.zip
Image2.zip

@ItosEO
Copy link

ItosEO commented Apr 5, 2024

@ItosEO 内核压缩格式是啥

无压缩

@Bot-wxt1221
Copy link
Contributor Author

对不起,我还没集成ksu

@ItosEO
Copy link

ItosEO commented Apr 5, 2024

等你

对不起,我还没集成ksu

@Bot-wxt1221
Copy link
Contributor Author

AK3.zip

@ItosEO
Copy link

ItosEO commented Apr 5, 2024

AK3.zip

我直接刷吗

@Bot-wxt1221
Copy link
Contributor Author

Y

@ItosEO
Copy link

ItosEO commented Apr 5, 2024

Y

ok,稍等

@Bot-wxt1221
Copy link
Contributor Author

启动了把dmesg放出来

@ItosEO
Copy link

ItosEO commented Apr 5, 2024

启动了把dmesg放出来

@Bot-wxt1221
Copy link
Contributor Author

启动了把dmesg放出来

OK了吗,还是砖了

@ItosEO
Copy link

ItosEO commented Apr 5, 2024

启动了把dmesg放出来

刷了,不开机

@ItosEO
Copy link

ItosEO commented Apr 5, 2024

Contributor Author

@Bot-wxt1221
Copy link
Contributor Author

Contributor Author

我可能把内核版本搞错了,你的内核版本多少

@Bot-wxt1221
Copy link
Contributor Author

之前刷的是什么

@ItosEO
Copy link

ItosEO commented Apr 5, 2024

Contributor Author

我可能把内核版本搞错了,你的内核版本多少

5.10.177

@Bot-wxt1221
Copy link
Contributor Author

Bot-wxt1221 commented Apr 5, 2024

搞错了(,明天来弄

@ItosEO
Copy link

ItosEO commented Apr 5, 2024

搞错了(,明天来弄

请早上,下午要回学校,谢谢啦

@ItosEO
Copy link

ItosEO commented Apr 12, 2024

搞错了(,明天来弄

哥,如何了,明天下午我可以来测试了 @Bot-wxt1221

@tufeigunchu
Copy link

我只听说vivo不准解锁BL,想不到内核加固也挺有一套。

@ItosEO
Copy link

ItosEO commented Apr 24, 2024

搞错了(,明天来弄

如何了

@ItosEO
Copy link

ItosEO commented May 7, 2024

@tiann @Bot-wxt1221 可以跟进下吗

@tiann
Copy link
Owner

tiann commented May 8, 2024

没兴趣

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

7 participants