Skip to content

Refactor cred_security_struct, find_task_by_vpid and strncpy_from_user_nofault.#3299

Open
shadichy wants to merge 5 commits intotiann:mainfrom
shadichy:refactor
Open

Refactor cred_security_struct, find_task_by_vpid and strncpy_from_user_nofault.#3299
shadichy wants to merge 5 commits intotiann:mainfrom
shadichy:refactor

Conversation

@shadichy
Copy link
Copy Markdown
Contributor

No description provided.

Define `cred_security_struct` as `task_security_struct` for kernel versions older than 6.18. This  simplifies the code by removing conditional variable declarations.

Signed-off-by: shadichy <shadichy@blisslabs.org>
…ID)` in place of `find_task_by_vpid`

Since `find_task_by_vpid` is a non-exported symbol, but it's just a wrapper of the sequence `rcu_read_lock` -> `pid_task(find_vpid(pid), PIDTYPE_PID)` -> `rcu_read_unlock`, it's better to just call its content directly as we already wrap it in a sequence of `rcu_read_lock` and `rcu_read_unlock`.

Signed-off-by: shadichy <shadichy@blisslabs.org>
Comment thread kernel/ksud.c
@aviraxp
Copy link
Copy Markdown
Collaborator

aviraxp commented Mar 16, 2026

What's the usage of this commit? ksuinit can resolve symbol address on the fly.

Replaces `strncpy_from_user_nofault` with a wrapper that does the same task, since it is not an exported symbol.

Signed-off-by: shadichy <shadichy@blisslabs.org>
@shadichy
Copy link
Copy Markdown
Contributor Author

What's the usage of this commit? ksuinit can resolve symbol address on the fly.

It's not just or kernelsu, but also for waydroid. Since probing on non-android linux requires something similar to ksuinit, and this creates some overhead delays on grepping symbols.

@aviraxp
Copy link
Copy Markdown
Collaborator

aviraxp commented Mar 16, 2026

Are these all the symbols you need for it to load without ksuinit?

@shadichy
Copy link
Copy Markdown
Contributor Author

Are these all the symbols you need for it to load without ksuinit?

No of course, not enough. KSU uses a lot of non-exported symbols, most of them are unresolvable. These are just list of resolvable/replaceable ones.

Signed-off-by: shadichy <shadichy@blisslabs.org>
Signed-off-by: shadichy <shadichy@blisslabs.org>
@Ylarod Ylarod force-pushed the main branch 4 times, most recently from f99db52 to b3d034d Compare March 27, 2026 13:38
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

Successfully merging this pull request may close these issues.

3 participants