Skip to content

kernel: ksud: dont create structs just to deconstruct them for a string #2595

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

Closed
wants to merge 1 commit into from

Conversation

backslashxx
Copy link
Contributor

@backslashxx backslashxx commented May 18, 2025

No description provided.

sys_execve_handler_pre was building a fake struct filename just
to pass it to ksu_handle_execveat_ksud, which immediately does...
filename->name. ??

All we ever needed was filename->name, but we kept doing this meme where
we manually built a struct filename, passed it around, then immediately
ripped out the string again. ??

refactor this so that __ksu_handle_execveat_ksud, takes plain char *.
The old ksu_handle_execveat_ksud is now a shim that unpacks the struct and
hands off the string like we should’ve been doing from the start.

Also mark ksu_handle_execveat_ksud as maybe unused as this will actually be
unused on syscall-only builds.

This also makes integration easier on kernels that don’t have struct filename.

Signed-off-by: backslashxx <[email protected]>
@backslashxx backslashxx force-pushed the struct-deconstruct branch from e4b8dc4 to fb61235 Compare May 18, 2025 12:14
@tiann
Copy link
Owner

tiann commented May 18, 2025

This also makes integration easier on kernels that don’t have struct filename.

Which kernels lack this struct?

@backslashxx
Copy link
Contributor Author

ah yeah, that is actually irrelevant for current ksu, but this is introduced on 3.7-rc1

@tiann
Copy link
Owner

tiann commented May 18, 2025

This is not good, it transforms an explicit dependency into an implicit one.

@backslashxx
Copy link
Contributor Author

which? this is the only part on kprobes that needs filename struct, execve_sucompat hook doesnt use it already, you might as well free this part from struct filename use

@tiann
Copy link
Owner

tiann commented May 18, 2025

This is not good, it transforms an explicit dependency into an implicit one.

So, why should we care about pre-3.7 kernels?

@backslashxx
Copy link
Contributor Author

backslashxx commented May 18, 2025

you dont have to, but this is still creating a dummy struct that it just deconstructs.
since this is mostly only for UL, it is very okay to reject this

@tiann
Copy link
Owner

tiann commented May 18, 2025

The first member of the struct filename is name, so the pointer to the struct points to name. This creates an implicit dependency. Although it may remain the same indefinitely, any change will cause a panic. The benefits apply only to pre-3.7 kernels, making it not worth the effort.

@backslashxx
Copy link
Contributor Author

backslashxx commented May 18, 2025

The first member of the struct filename is name, so the pointer to the struct points to name. This creates an implicit dependency. Although it may remain the same indefinitely, any change will cause a panic. The benefits apply only to pre-3.7 kernels, making it not worth the effort.

I don't understand why that is a good thing.

isnt the flow like

sys_execve --> kprobe --> sys_execve_handler_pre --> create dummy struct filename --> ksu_handle_execveat_ksud

now itll be like

sys_execve --> kprobe --> sys_execve_handler_pre --> __ksu_handle_execveat_ksud

@tiann
Copy link
Owner

tiann commented May 18, 2025

the struct is allocated on stack, which is very cheap.

backslashxx added a commit to backslashxx/KernelSU that referenced this pull request May 18, 2025
__ksu_handle_execve_ksud was building a fake struct filename just
to pass it to ksu_handle_execveat_ksud, which immediately does...
filename->name. ??

All we ever needed was filename->name, but we kept doing this meme where
we manually built a struct filename, passed it around, then immediately
ripped out the string again. ??

refactor this so that __ksu_handle_execveat_ksud, takes plain char *.
The old ksu_handle_execveat_ksud is now a shim that unpacks the struct and
hands off the string like we should’ve been doing from the start.

Also mark ksu_handle_execveat_ksud as maybe unused as this will actually be
unused on syscall-only builds.

This also makes integration easier on kernels that don’t have struct filename.

Rejected: tiann#2595

Signed-off-by: backslashxx <[email protected]>
@backslashxx backslashxx deleted the struct-deconstruct branch May 18, 2025 12:57
backslashxx added a commit to backslashxx/KernelSU that referenced this pull request May 18, 2025
__ksu_handle_execve_ksud was building a fake struct filename just
to pass it to ksu_handle_execveat_ksud, which immediately does...
filename->name. ??

All we ever needed was filename->name, but we kept doing this meme where
we manually built a struct filename, passed it around, then immediately
ripped out the string again. ??

refactor this so that __ksu_handle_execveat_ksud, takes plain char *.
The old ksu_handle_execveat_ksud is now a shim that unpacks the struct and
hands off the string like we should’ve been doing from the start.

Also mark ksu_handle_execveat_ksud as maybe unused as this will actually be
unused on syscall-only builds.

This also makes integration easier on kernels that don’t have struct filename.

Rejected: tiann#2595

Signed-off-by: backslashxx <[email protected]>
backslashxx added a commit to backslashxx/KernelSU that referenced this pull request May 18, 2025
__ksu_handle_execve_ksud was building a fake struct filename just
to pass it to ksu_handle_execveat_ksud, which immediately does...
filename->name. ??

All we ever needed was filename->name, but we kept doing this meme where
we manually built a struct filename, passed it around, then immediately
ripped out the string again. ??

refactor this so that __ksu_handle_execveat_ksud, takes plain char *.
The old ksu_handle_execveat_ksud is now a shim that unpacks the struct and
hands off the string like we should’ve been doing from the start.

Also mark ksu_handle_execveat_ksud as maybe unused as this will actually be
unused on syscall-only builds.

This also makes integration easier on kernels that don’t have struct filename.

Rejected: tiann#2595

Signed-off-by: backslashxx <[email protected]>
backslashxx added a commit to backslashxx/KernelSU that referenced this pull request May 18, 2025
sys_execve_handler_pre was building a fake struct filename just
to pass it to ksu_handle_execveat_ksud, which immediately does...
filename->name. ??

All we ever needed was filename->name, but we kept doing this meme where
we manually built a struct filename, passed it around, then immediately
ripped out the string again. ??

refactor this so that __ksu_handle_execveat_ksud, takes plain char *.
The old ksu_handle_execveat_ksud is now a shim that unpacks the struct and
hands off the string like we should’ve been doing from the start.

Also mark ksu_handle_execveat_ksud as maybe unused as this will actually be
unused on syscall-only builds.

This also makes integration easier on kernels that don’t have struct filename.

Rejected: tiann#2595

Signed-off-by: backslashxx <[email protected]>
backslashxx added a commit to backslashxx/KernelSU that referenced this pull request May 19, 2025
sys_execve_handler_pre was building a fake struct filename just
to pass it to ksu_handle_execveat_ksud, which immediately does...
filename->name. ??

All we ever needed was filename->name, but we kept doing this meme where
we manually built a struct filename, passed it around, then immediately
ripped out the string again. ??

refactor this so that __ksu_handle_execveat_ksud, takes plain char *.
The old ksu_handle_execveat_ksud is now a shim that unpacks the struct and
hands off the string like we should’ve been doing from the start.

Also mark ksu_handle_execveat_ksud as maybe unused as this will actually be
unused on syscall-only builds.

This also makes integration easier on kernels that don’t have struct filename.

Rejected: tiann#2595

Signed-off-by: backslashxx <[email protected]>
Trijal08 pushed a commit to Trijal08/KernelSU-Next that referenced this pull request May 19, 2025
sys_execve_handler_pre was building a fake struct filename just
to pass it to ksu_handle_execveat_ksud, which immediately does...
filename->name. ??

All we ever needed was filename->name, but we kept doing this meme where
we manually built a struct filename, passed it around, then immediately
ripped out the string again. ??

refactor this so that __ksu_handle_execveat_ksud, takes plain char *.
The old ksu_handle_execveat_ksud is now a shim that unpacks the struct and
hands off the string like we should’ve been doing from the start.

Also mark ksu_handle_execveat_ksud as maybe unused as this will actually be
unused on syscall-only builds.

This also makes integration easier on kernels that don’t have struct filename.

Rejected: tiann/KernelSU#2595

Signed-off-by: backslashxx <[email protected]>
backslashxx added a commit to backslashxx/KernelSU that referenced this pull request May 19, 2025
sys_execve_handler_pre was building a fake struct filename just
to pass it to ksu_handle_execveat_ksud, which immediately does...
filename->name. ??

All we ever needed was filename->name, but we kept doing this meme where
we manually built a struct filename, passed it around, then immediately
ripped out the string again. ??

refactor this so that __ksu_handle_execveat_ksud, takes plain char *.
The old ksu_handle_execveat_ksud is now a shim that unpacks the struct and
hands off the string like we should’ve been doing from the start.

Also mark ksu_handle_execveat_ksud as maybe unused as this will actually be
unused on syscall-only builds.

This also makes integration easier on kernels that don’t have struct filename.

Rejected: tiann#2595

Signed-off-by: backslashxx <[email protected]>
backslashxx added a commit to backslashxx/KernelSU that referenced this pull request May 20, 2025
…ng (tiann#2595)

sys_execve_handler_pre was building a fake struct filename just
to pass it to ksu_handle_execveat_ksud, which immediately does...
filename->name. ??

All we ever needed was filename->name, but we kept doing this meme where
we manually built a struct filename, passed it around, then immediately
ripped out the string again. ??

refactor this so that __ksu_handle_execveat_ksud, takes plain char *.
The old ksu_handle_execveat_ksud is now a shim that unpacks the struct and
hands off the string like we should’ve been doing from the start.

Also mark ksu_handle_execveat_ksud as maybe unused as this will actually be
unused on syscall-only builds.

This also makes integration easier on kernels that don’t have struct filename.

Rejected: tiann#2595

Signed-off-by: backslashxx <[email protected]>
backslashxx added a commit to backslashxx/KernelSU that referenced this pull request May 20, 2025
…ng (tiann#2595)

sys_execve_handler_pre was building a fake struct filename just
to pass it to ksu_handle_execveat_ksud, which immediately does...
filename->name. ??

All we ever needed was filename->name, but we kept doing this meme where
we manually built a struct filename, passed it around, then immediately
ripped out the string again. ??

refactor this so that __ksu_handle_execveat_ksud, takes plain char *.
The old ksu_handle_execveat_ksud is now a shim that unpacks the struct and
hands off the string like we should’ve been doing from the start.

Also mark ksu_handle_execveat_ksud as maybe unused as this will actually be
unused on syscall-only builds.

This also makes integration easier on kernels that don’t have struct filename.

Rejected: tiann#2595

Signed-off-by: backslashxx <[email protected]>
backslashxx added a commit to backslashxx/KernelSU that referenced this pull request May 21, 2025
…ng (tiann#2595)

sys_execve_handler_pre was building a fake struct filename just
to pass it to ksu_handle_execveat_ksud, which immediately does...
filename->name. ??

All we ever needed was filename->name, but we kept doing this meme where
we manually built a struct filename, passed it around, then immediately
ripped out the string again. ??

refactor this so that __ksu_handle_execveat_ksud, takes plain char *.
The old ksu_handle_execveat_ksud is now a shim that unpacks the struct and
hands off the string like we should’ve been doing from the start.

Also mark ksu_handle_execveat_ksud as maybe unused as this will actually be
unused on syscall-only builds.

This also makes integration easier on kernels that don’t have struct filename.

Rejected: tiann#2595

Signed-off-by: backslashxx <[email protected]>
backslashxx added a commit to backslashxx/KernelSU that referenced this pull request May 21, 2025
…ng (tiann#2595)

sys_execve_handler_pre was building a fake struct filename just
to pass it to ksu_handle_execveat_ksud, which immediately does...
filename->name. ??

All we ever needed was filename->name, but we kept doing this meme where
we manually built a struct filename, passed it around, then immediately
ripped out the string again. ??

refactor this so that __ksu_handle_execveat_ksud, takes plain char *.
The old ksu_handle_execveat_ksud is now a shim that unpacks the struct and
hands off the string like we should’ve been doing from the start.

Also mark ksu_handle_execveat_ksud as maybe unused as this will actually be
unused on syscall-only builds.

This also makes integration easier on kernels that don’t have struct filename.

Rejected: tiann#2595

Signed-off-by: backslashxx <[email protected]>
backslashxx added a commit to backslashxx/KernelSU that referenced this pull request May 21, 2025
Added from 5ec1cff@16e13ae (+23)
	implement magic mount
	restorecon: set adb_file to system_file for module files
	magic_mount: use trusted.overlay.opaque
	chore: fmt
	magic_mount: supports whiteout
	chore: refine code
	magic_mount: fix
	log: make verbose logging optional
	magic_mount: refine
	ksud: fix disable / enable modules
	ksud: fix odm not magic-mounted
	ksud: fix partition link
	ksud: fix clone symlink
	ksud: refine tmpfs
	ksud: add KSU_MAGIC_MOUNT to env (5ec1cff#5)
	manager: remove shrink image
	use module dir name as real id
	allow restore uninstalled module
	ksud: make tmpfs and magic mount optional
	ksud: fix stat
	reformat rust codes
	ksud: probe for more workdir candidates (#12)
	app: persist show system app settings

Other changes: (+26)
	manager: show module id on module page (tiann#2365)
	workflows: debloat
	ksud: add armeabi-v7a support
	manager: Add ABI and Kernel archirecture info into InfoCardItem
	manager:  failure mode dummy demo
	dummy.keystore
	manager: unofficial build
	kernel: drop LKM and kprobes support
	kernel: restore compat code required for old kernels
	kernel: expose allowlist workaround as Kconfig option
	kernel: require backports
	kernel: expose KSU_LSM_SECURITY_HOOKS on Kconfig
	kernel: sucompat: sucompat toggle support for non-kp (tiann#2506)
	kernel: ksud: dont create structs just to deconstruct them for a string (tiann#2595)
	kernel: ksud: add ksu_handle_execve_ksud v2
	kernel: core_hook: try umount /system/etc/hosts (tiann#1494)
	kernel: selinux: fix pointer mismatch with 32-bit ksud on 64-bit kernels
	kernel: ksud: provide ksu_handle_compat_execve_ksud v2
	kernel: ksud: commonize execve_ksud handlers
	kernel: sucompat: increase reliability of execve_sucompat
	kernel: sucompat: micro-opt exec handlers - move permission check up
	kernel: Makefile: sanity checks
	kernel: apk_sign: add more size/hash pairs
	kernel: expose KSU_USE_STRUCT_FILENAME on Kconfig
	kernel: ksud, sucompat: micro-opt, drop redundant memset before strncpy
	KernelSU v1.0.5+magic

Warning: Managers built from this repo has a known keystore.
See dummy.keystore.

Signed-off-by: backslashxx <[email protected]>
backslashxx added a commit to backslashxx/KernelSU that referenced this pull request May 21, 2025
Added from 5ec1cff@16e13ae (+23)
	implement magic mount
	restorecon: set adb_file to system_file for module files
	magic_mount: use trusted.overlay.opaque
	chore: fmt
	magic_mount: supports whiteout
	chore: refine code
	magic_mount: fix
	log: make verbose logging optional
	magic_mount: refine
	ksud: fix disable / enable modules
	ksud: fix odm not magic-mounted
	ksud: fix partition link
	ksud: fix clone symlink
	ksud: refine tmpfs
	ksud: add KSU_MAGIC_MOUNT to env (5ec1cff#5)
	manager: remove shrink image
	use module dir name as real id
	allow restore uninstalled module
	ksud: make tmpfs and magic mount optional
	ksud: fix stat
	reformat rust codes
	ksud: probe for more workdir candidates (#12)
	app: persist show system app settings

Other changes: (+26)
	manager: show module id on module page (tiann#2365)
	workflows: debloat
	ksud: add armeabi-v7a support
	manager: Add ABI and Kernel archirecture info into InfoCardItem
	manager:  failure mode dummy demo
	dummy.keystore
	manager: unofficial build
	kernel: drop LKM and kprobes support
	kernel: restore compat code required for old kernels
	kernel: expose allowlist workaround as Kconfig option
	kernel: require backports
	kernel: expose KSU_LSM_SECURITY_HOOKS on Kconfig
	kernel: sucompat: sucompat toggle support for non-kp (tiann#2506)
	kernel: ksud: dont create structs just to deconstruct them for a string (tiann#2595)
	kernel: ksud: add ksu_handle_execve_ksud v2
	kernel: core_hook: try umount /system/etc/hosts (tiann#1494)
	kernel: selinux: fix pointer mismatch with 32-bit ksud on 64-bit kernels
	kernel: ksud: provide ksu_handle_compat_execve_ksud v2
	kernel: ksud: commonize execve_ksud handlers
	kernel: sucompat: increase reliability of execve_sucompat
	kernel: sucompat: micro-opt exec handlers - move permission check up
	kernel: Makefile: sanity checks
	kernel: apk_sign: add more size/hash pairs
	kernel: expose KSU_USE_STRUCT_FILENAME on Kconfig
	kernel: ksud, sucompat: micro-opt, drop redundant memset before strncpy
	KernelSU v1.0.5+magic

Warning: Managers built from this repo has a known keystore.
See dummy.keystore.

Signed-off-by: backslashxx <[email protected]>
backslashxx added a commit to backslashxx/KernelSU that referenced this pull request May 22, 2025
Added from 5ec1cff@16e13ae (+23)
	implement magic mount
	restorecon: set adb_file to system_file for module files
	magic_mount: use trusted.overlay.opaque
	chore: fmt
	magic_mount: supports whiteout
	chore: refine code
	magic_mount: fix
	log: make verbose logging optional
	magic_mount: refine
	ksud: fix disable / enable modules
	ksud: fix odm not magic-mounted
	ksud: fix partition link
	ksud: fix clone symlink
	ksud: refine tmpfs
	ksud: add KSU_MAGIC_MOUNT to env (5ec1cff#5)
	manager: remove shrink image
	use module dir name as real id
	allow restore uninstalled module
	ksud: make tmpfs and magic mount optional
	ksud: fix stat
	reformat rust codes
	ksud: probe for more workdir candidates (#12)
	app: persist show system app settings

Other changes: (+26)
	manager: show module id on module page (tiann#2365)
	workflows: debloat
	ksud: add armeabi-v7a support
	manager: Add ABI and Kernel archirecture info into InfoCardItem
	manager:  failure mode dummy demo
	dummy.keystore
	manager: unofficial build
	kernel: drop LKM and kprobes support
	kernel: restore compat code required for old kernels
	kernel: expose allowlist workaround as Kconfig option
	kernel: require backports
	kernel: expose KSU_LSM_SECURITY_HOOKS on Kconfig
	kernel: sucompat: sucompat toggle support for non-kp (tiann#2506)
	kernel: ksud: dont create structs just to deconstruct them for a string (tiann#2595)
	kernel: ksud: add ksu_handle_execve_ksud v2
	kernel: core_hook: try umount /system/etc/hosts (tiann#1494)
	kernel: selinux: fix pointer mismatch with 32-bit ksud on 64-bit kernels
	kernel: ksud: provide ksu_handle_compat_execve_ksud v2
	kernel: ksud: commonize execve_ksud handlers
	kernel: sucompat: increase reliability of execve_sucompat
	kernel: sucompat: micro-opt exec handlers - move permission check up
	kernel: Makefile: sanity checks
	kernel: apk_sign: add more size/hash pairs
	kernel: expose KSU_USE_STRUCT_FILENAME on Kconfig
	kernel: ksud, sucompat: micro-opt, drop redundant memset before strncpy
	KernelSU v1.0.5+magic

Warning: Managers built from this repo has a known keystore.
See dummy.keystore.

Signed-off-by: backslashxx <[email protected]>
backslashxx added a commit to backslashxx/KernelSU that referenced this pull request May 22, 2025
Added from 5ec1cff@16e13ae (+23)
	implement magic mount
	restorecon: set adb_file to system_file for module files
	magic_mount: use trusted.overlay.opaque
	chore: fmt
	magic_mount: supports whiteout
	chore: refine code
	magic_mount: fix
	log: make verbose logging optional
	magic_mount: refine
	ksud: fix disable / enable modules
	ksud: fix odm not magic-mounted
	ksud: fix partition link
	ksud: fix clone symlink
	ksud: refine tmpfs
	ksud: add KSU_MAGIC_MOUNT to env (5ec1cff#5)
	manager: remove shrink image
	use module dir name as real id
	allow restore uninstalled module
	ksud: make tmpfs and magic mount optional
	ksud: fix stat
	reformat rust codes
	ksud: probe for more workdir candidates (#12)
	app: persist show system app settings

Other changes: (+26)
	manager: show module id on module page (tiann#2365)
	workflows: debloat
	ksud: add armeabi-v7a support
	manager: Add ABI and Kernel archirecture info into InfoCardItem
	manager:  failure mode dummy demo
	dummy.keystore
	manager: unofficial build
	kernel: drop LKM and kprobes support
	kernel: restore compat code required for old kernels
	kernel: expose allowlist workaround as Kconfig option
	kernel: require backports
	kernel: expose KSU_LSM_SECURITY_HOOKS on Kconfig
	kernel: sucompat: sucompat toggle support for non-kp (tiann#2506)
	kernel: ksud: dont create structs just to deconstruct them for a string (tiann#2595)
	kernel: ksud: add ksu_handle_execve_ksud v2
	kernel: core_hook: try umount /system/etc/hosts (tiann#1494)
	kernel: selinux: fix pointer mismatch with 32-bit ksud on 64-bit kernels
	kernel: ksud: provide ksu_handle_compat_execve_ksud v2
	kernel: ksud: commonize execve_ksud handlers
	kernel: sucompat: increase reliability of execve_sucompat
	kernel: sucompat: micro-opt exec handlers - move permission check up
	kernel: Makefile: sanity checks
	kernel: apk_sign: add more size/hash pairs
	kernel: opt-out of struct filename use when unused
	kernel: ksud, sucompat: micro-opt, drop redundant memset before strncpy
	KernelSU v1.0.5+magic

Warning: Managers built from this repo has a known keystore.
See dummy.keystore.

Signed-off-by: backslashxx <[email protected]>
backslashxx added a commit to backslashxx/KernelSU that referenced this pull request May 22, 2025
Added from 5ec1cff@16e13ae (+23)
	implement magic mount
	restorecon: set adb_file to system_file for module files
	magic_mount: use trusted.overlay.opaque
	chore: fmt
	magic_mount: supports whiteout
	chore: refine code
	magic_mount: fix
	log: make verbose logging optional
	magic_mount: refine
	ksud: fix disable / enable modules
	ksud: fix odm not magic-mounted
	ksud: fix partition link
	ksud: fix clone symlink
	ksud: refine tmpfs
	ksud: add KSU_MAGIC_MOUNT to env (5ec1cff#5)
	manager: remove shrink image
	use module dir name as real id
	allow restore uninstalled module
	ksud: make tmpfs and magic mount optional
	ksud: fix stat
	reformat rust codes
	ksud: probe for more workdir candidates (#12)
	app: persist show system app settings

Other changes: (+26)
	manager: show module id on module page (tiann#2365)
	workflows: debloat
	ksud: add armeabi-v7a support
	manager: Add ABI and Kernel archirecture info into InfoCardItem
	manager:  failure mode dummy demo
	dummy.keystore
	manager: unofficial build
	kernel: drop LKM and kprobes support
	kernel: restore compat code required for old kernels
	kernel: expose allowlist workaround as Kconfig option
	kernel: require backports
	kernel: expose KSU_LSM_SECURITY_HOOKS on Kconfig
	kernel: sucompat: sucompat toggle support for non-kp (tiann#2506)
	kernel: ksud: dont create structs just to deconstruct them for a string (tiann#2595)
	kernel: ksud: add ksu_handle_execve_ksud v2
	kernel: core_hook: try umount /system/etc/hosts (tiann#1494)
	kernel: selinux: fix pointer mismatch with 32-bit ksud on 64-bit kernels
	kernel: ksud: provide ksu_handle_compat_execve_ksud v2
	kernel: ksud: commonize execve_ksud handlers
	kernel: sucompat: increase reliability of execve_sucompat
	kernel: sucompat: micro-opt exec handlers - move permission check up
	kernel: Makefile: sanity checks
	kernel: apk_sign: add more size/hash pairs
	kernel: opt-out of struct filename use when unused
	kernel: ksud, sucompat: micro-opt, drop redundant memset before strncpy
	KernelSU v1.0.5+magic

Warning: Managers built from this repo has a known keystore.
See dummy.keystore.

Signed-off-by: backslashxx <[email protected]>
backslashxx added a commit to backslashxx/KernelSU that referenced this pull request May 22, 2025
Added from 5ec1cff@16e13ae (+23)
	implement magic mount
	restorecon: set adb_file to system_file for module files
	magic_mount: use trusted.overlay.opaque
	chore: fmt
	magic_mount: supports whiteout
	chore: refine code
	magic_mount: fix
	log: make verbose logging optional
	magic_mount: refine
	ksud: fix disable / enable modules
	ksud: fix odm not magic-mounted
	ksud: fix partition link
	ksud: fix clone symlink
	ksud: refine tmpfs
	ksud: add KSU_MAGIC_MOUNT to env (5ec1cff#5)
	manager: remove shrink image
	use module dir name as real id
	allow restore uninstalled module
	ksud: make tmpfs and magic mount optional
	ksud: fix stat
	reformat rust codes
	ksud: probe for more workdir candidates (#12)
	app: persist show system app settings

Other changes: (+26)
	manager: show module id on module page (tiann#2365)
	workflows: debloat
	ksud: add armeabi-v7a support
	manager: Add ABI and Kernel archirecture info into InfoCardItem
	manager:  failure mode dummy demo
	dummy.keystore
	manager: unofficial build
	kernel: drop LKM and kprobes support
	kernel: restore compat code required for old kernels
	kernel: expose allowlist workaround as Kconfig option
	kernel: require backports
	kernel: expose KSU_LSM_SECURITY_HOOKS on Kconfig
	kernel: sucompat: sucompat toggle support for non-kp (tiann#2506)
	kernel: ksud: dont create structs just to deconstruct them for a string (tiann#2595)
	kernel: ksud: add ksu_handle_execve_ksud v2
	kernel: core_hook: try umount /system/etc/hosts (tiann#1494)
	kernel: selinux: fix pointer mismatch with 32-bit ksud on 64-bit kernels
	kernel: ksud: provide ksu_handle_compat_execve_ksud v2
	kernel: ksud: commonize execve_ksud handlers
	kernel: sucompat: increase reliability of execve_sucompat
	kernel: sucompat: micro-opt exec handlers - move permission check up
	kernel: Makefile: sanity checks
	kernel: apk_sign: add more size/hash pairs
	kernel: opt-out of struct filename use when unused
	kernel: ksud, sucompat: micro-opt, drop redundant memset before strncpy
	KernelSU v1.0.5+magic

Warning: Managers built from this repo has a known keystore.
See dummy.keystore.

Signed-off-by: backslashxx <[email protected]>
backslashxx added a commit to backslashxx/KernelSU that referenced this pull request Jul 14, 2025
Added from 5ec1cff@16e13ae (+23)
	implement magic mount
	restorecon: set adb_file to system_file for module files
	magic_mount: use trusted.overlay.opaque
	chore: fmt
	magic_mount: supports whiteout
	chore: refine code
	magic_mount: fix
	log: make verbose logging optional
	magic_mount: refine
	ksud: fix disable / enable modules
	ksud: fix odm not magic-mounted
	manager: no need to check overlayfs
	ksud: fix partition link
	ksud: fix clone symlink
	ksud: refine tmpfs
	ksud: add KSU_MAGIC_MOUNT to env (5ec1cff#5)
	manager: remove shrink image
	use module dir name as real id
	allow restore uninstalled module
	ksud: make tmpfs and magic mount optional
	ksud: fix stat
	reformat rust codes
	app: persist show system app settings

Other changes: (+51)
	ksud: move workdir to /mnt/vendor
	ksud: remove tmpfs mounting
	manager: show module id on module page (tiann#2365)
	workflows: debloat
	ksud: add armeabi-v7a support
	manager: Add ABI and Kernel archirecture info into InfoCardItem
	manager:  failure mode dummy demo
	dummy.keystore
	manager: unofficial build
	kernel: drop LKM and kprobes support
	kernel: restore compat code required for old kernels
	kernel: expose allowlist workaround as Kconfig option
	kernel: core_hook: screw path_umount backport, call sys_umount directly
	kernel: handle backports
	kernel: sucompat: sucompat toggle support for non-kp (tiann#2506)
	kernel: core_hook: automate and refactor umount (tiann#2531)
	kernel: core_hook: only umount when unmountable > 0
	kernel: throne_tracker: offload to kthread (tiann#2632)
	kernel: selinux: fix pointer mismatch with 32-bit ksud on 64-bit kernels
	kernel: ksud: dont create structs just to deconstruct them for a string (tiann#2595)
	kernel: ksud: add commonized execve/compat_execve hooks for ksud
	kernel: sucompat: increase reliability, commonize and micro-optimize (tiann#2656)
	kernel: core_hook: intercept devpts via security_inode_permission LSM
	kernel: sucompat: dummify and micro-optimize devpts hook
	kernel: ksud: migrate ksud execution to security_bprm_check (tiann#2653)
	kernel: sucompat: strncpy_from_user -> copy_from_user
	kernel: ksud: reuse bprm_ksud logic on old handlers
	kernel: ksud: remove and no-op old hooks
	kernel: compat: handle strncpy_from_user -> copy_from_user migration
	kernel: core_hook: fixup 32-on-64 compat detection via linux_binprm
	kernel: core_hook: earlier escape_to_root already-root check
	kernel: expose KSU_LSM_SECURITY_HOOKS on Kconfig
	kernel: sucompat: provide do_execve_common handler for <= 3.13
	kernel: ksud: provide is_ksu_transition check v2
	kernel: core_hook: no ext4_unregister_sysfs, no problem
	kernel: throne_tracker: add strscpy/strlcpy compat
	kernel: ksud: d_is_reg to IS_REG
	kernel: Makefile: remove overlayfs requirement
	kernel: throne_tracker: resolve s_magic for < 3.9
	kernel: ksud: handle read_iter requirement conditionally
	kernel: apk_sign: casting to char for strcmp -> memcmp
	kernel: apk_sign: migrate generic_file_llseek -> vfs_llseek
	kernel: throne_tracker: handle filldir_t ABI mismatch on <= 3.18
	kernel: compat: inline iterate_dir -> vfs_readdir compat
	kernel: apk_sign: fix return check for ksu_sha256
	kernel: apk_sign: add more size/hash pairs
	kernel: ksu: printout quirks / backports / etc on init
	kernel: sucompat: provide getname_flags (user) ultimatum hook
	kernel: sucompat: provide getname_flags (kernel) ultimatum hook
	kernel: core_hook: add support for KernelNoSU
	KernelSU v1.0.5+magic

Warning: Managers built from this repo has a known keystore.
See dummy.keystore.

Signed-off-by: backslashxx <[email protected]>
backslashxx added a commit to backslashxx/KernelSU that referenced this pull request Jul 14, 2025
…ng (tiann#2595)

sys_execve_handler_pre was building a fake struct filename just
to pass it to ksu_handle_execveat_ksud, which immediately does...
filename->name. ??

All we ever needed was filename->name, but we kept doing this meme where
we manually built a struct filename, passed it around, then immediately
ripped out the string again. ??

refactor this so that __ksu_handle_execveat_ksud, takes plain char *.
The old ksu_handle_execveat_ksud is now a shim that unpacks the struct and
hands off the string like we should’ve been doing from the start.

Also mark ksu_handle_execveat_ksud as maybe unused as this will actually be
unused on syscall-only builds.

This also makes integration easier on kernels that don’t have struct filename.

Rejected: tiann#2595

Signed-off-by: backslashxx <[email protected]>
backslashxx added a commit to backslashxx/KernelSU that referenced this pull request Jul 14, 2025
This commit squashes the following:
- kernel: ksud: commonize execve_ksud handlers
- kernel: ksud: provide ksu_handle_compat_execve_ksud v2
- kernel: ksud: add ksu_handle_execve_ksud v2

This finalizes syscall-only hooking for KernelSU as we provide
both native and compat.

- sys_execve - ksu_handle_execve_ksud
- compat_sys_execve - ksu_handle_compat_execve_ksud

since these two share common logic, we commonize them to
ksu_common_execve_ksud sinc only the argv field is different.
(.native vs .compat)

usage:
	ksu_handle_execve_ksud(filename, argv);  // for sys_execve
	ksu_handle_compat_execve_ksud(filename, argv);  // for compat_sys_execve

This implementations avoids any dependency on struct filename
making it also usable on Ultra-Legacy.

Requires:
- kernel: ksud: dont create structs just to deconstruct them for a string (tiann#2595)

original logic was taken from sys_execve_handler_pre
upstream: tiann@2027ac3

Tested-by: selfmusing <[email protected]>
Tested-by: Adam W. Willis <[email protected]>
Tested-by: alternoegraha <[email protected]>
Tested-by: iDead XD <[email protected]>
Tested-by: rsuntk <[email protected]>
Signed-off-by: backslashxx <[email protected]>
Co-Authored-By: Another Guy <[email protected]>
backslashxx added a commit to backslashxx/KernelSU that referenced this pull request Jul 14, 2025
Added from 5ec1cff@16e13ae (+23)
	implement magic mount
	restorecon: set adb_file to system_file for module files
	magic_mount: use trusted.overlay.opaque
	chore: fmt
	magic_mount: supports whiteout
	chore: refine code
	magic_mount: fix
	log: make verbose logging optional
	magic_mount: refine
	ksud: fix disable / enable modules
	ksud: fix odm not magic-mounted
	manager: no need to check overlayfs
	ksud: fix partition link
	ksud: fix clone symlink
	ksud: refine tmpfs
	ksud: add KSU_MAGIC_MOUNT to env (5ec1cff#5)
	manager: remove shrink image
	use module dir name as real id
	allow restore uninstalled module
	ksud: make tmpfs and magic mount optional
	ksud: fix stat
	reformat rust codes
	app: persist show system app settings

Other changes: (+51)
	ksud: move workdir to /mnt/vendor
	ksud: remove tmpfs mounting
	manager: show module id on module page (tiann#2365)
	workflows: debloat
	ksud: add armeabi-v7a support
	manager: Add ABI and Kernel archirecture info into InfoCardItem
	manager:  failure mode dummy demo
	dummy.keystore
	manager: unofficial build
	kernel: drop LKM and kprobes support
	kernel: restore compat code required for old kernels
	kernel: expose allowlist workaround as Kconfig option
	kernel: core_hook: screw path_umount backport, call sys_umount directly
	kernel: handle backports
	kernel: sucompat: sucompat toggle support for non-kp (tiann#2506)
	kernel: core_hook: automate and refactor umount (tiann#2531)
	kernel: core_hook: only umount when unmountable > 0
	kernel: throne_tracker: offload to kthread (tiann#2632)
	kernel: selinux: fix pointer mismatch with 32-bit ksud on 64-bit kernels
	kernel: ksud: dont create structs just to deconstruct them for a string (tiann#2595)
	kernel: ksud: add commonized execve/compat_execve hooks for ksud
	kernel: sucompat: increase reliability, commonize and micro-optimize (tiann#2656)
	kernel: core_hook: intercept devpts via security_inode_permission LSM
	kernel: sucompat: dummify and micro-optimize devpts hook
	kernel: ksud: migrate ksud execution to security_bprm_check (tiann#2653)
	kernel: sucompat: strncpy_from_user -> copy_from_user
	kernel: ksud: reuse bprm_ksud logic on old handlers
	kernel: ksud: remove and no-op old hooks
	kernel: compat: handle strncpy_from_user -> copy_from_user migration
	kernel: core_hook: fixup 32-on-64 compat detection via linux_binprm
	kernel: core_hook: earlier escape_to_root already-root check
	kernel: expose KSU_LSM_SECURITY_HOOKS on Kconfig
	kernel: sucompat: provide do_execve_common handler for <= 3.13
	kernel: ksud: provide is_ksu_transition check v2
	kernel: core_hook: no ext4_unregister_sysfs, no problem
	kernel: throne_tracker: add strscpy/strlcpy compat
	kernel: ksud: d_is_reg to IS_REG
	kernel: Makefile: remove overlayfs requirement
	kernel: throne_tracker: resolve s_magic for < 3.9
	kernel: ksud: handle read_iter requirement conditionally
	kernel: apk_sign: casting to char for strcmp -> memcmp
	kernel: apk_sign: migrate generic_file_llseek -> vfs_llseek
	kernel: throne_tracker: handle filldir_t ABI mismatch on <= 3.18
	kernel: compat: inline iterate_dir -> vfs_readdir compat
	kernel: apk_sign: fix return check for ksu_sha256
	kernel: apk_sign: add more size/hash pairs
	kernel: ksu: printout quirks / backports / etc on init
	kernel: sucompat: provide getname_flags (user) ultimatum hook
	kernel: sucompat: provide getname_flags (kernel) ultimatum hook
	kernel: core_hook: add support for KernelNoSU
	KernelSU v1.0.5+magic

Warning: Managers built from this repo has a known keystore.
See dummy.keystore.

Signed-off-by: backslashxx <[email protected]>
LeCmnGend pushed a commit to LeCmnGend/KernelSU that referenced this pull request Jul 14, 2025
…ng (tiann#2595)

sys_execve_handler_pre was building a fake struct filename just
to pass it to ksu_handle_execveat_ksud, which immediately does...
filename->name. ??

All we ever needed was filename->name, but we kept doing this meme where
we manually built a struct filename, passed it around, then immediately
ripped out the string again. ??

refactor this so that __ksu_handle_execveat_ksud, takes plain char *.
The old ksu_handle_execveat_ksud is now a shim that unpacks the struct and
hands off the string like we should’ve been doing from the start.

Also mark ksu_handle_execveat_ksud as maybe unused as this will actually be
unused on syscall-only builds.

This also makes integration easier on kernels that don’t have struct filename.

Rejected: tiann#2595

Signed-off-by: backslashxx <[email protected]>
LeCmnGend pushed a commit to LeCmnGend/KernelSU that referenced this pull request Jul 14, 2025
This commit squashes the following:
- kernel: ksud: commonize execve_ksud handlers
- kernel: ksud: provide ksu_handle_compat_execve_ksud v2
- kernel: ksud: add ksu_handle_execve_ksud v2

This finalizes syscall-only hooking for KernelSU as we provide
both native and compat.

- sys_execve - ksu_handle_execve_ksud
- compat_sys_execve - ksu_handle_compat_execve_ksud

since these two share common logic, we commonize them to
ksu_common_execve_ksud sinc only the argv field is different.
(.native vs .compat)

usage:
	ksu_handle_execve_ksud(filename, argv);  // for sys_execve
	ksu_handle_compat_execve_ksud(filename, argv);  // for compat_sys_execve

This implementations avoids any dependency on struct filename
making it also usable on Ultra-Legacy.

Requires:
- kernel: ksud: dont create structs just to deconstruct them for a string (tiann#2595)

original logic was taken from sys_execve_handler_pre
upstream: tiann@2027ac3

Tested-by: selfmusing <[email protected]>
Tested-by: Adam W. Willis <[email protected]>
Tested-by: alternoegraha <[email protected]>
Tested-by: iDead XD <[email protected]>
Tested-by: rsuntk <[email protected]>
Signed-off-by: backslashxx <[email protected]>
Co-Authored-By: Another Guy <[email protected]>
LeCmnGend pushed a commit to LeCmnGend/KernelSU that referenced this pull request Jul 15, 2025
…ng (tiann#2595)

sys_execve_handler_pre was building a fake struct filename just
to pass it to ksu_handle_execveat_ksud, which immediately does...
filename->name. ??

All we ever needed was filename->name, but we kept doing this meme where
we manually built a struct filename, passed it around, then immediately
ripped out the string again. ??

refactor this so that __ksu_handle_execveat_ksud, takes plain char *.
The old ksu_handle_execveat_ksud is now a shim that unpacks the struct and
hands off the string like we should’ve been doing from the start.

Also mark ksu_handle_execveat_ksud as maybe unused as this will actually be
unused on syscall-only builds.

This also makes integration easier on kernels that don’t have struct filename.

Rejected: tiann#2595

Signed-off-by: backslashxx <[email protected]>
LeCmnGend pushed a commit to LeCmnGend/KernelSU that referenced this pull request Jul 15, 2025
This commit squashes the following:
- kernel: ksud: commonize execve_ksud handlers
- kernel: ksud: provide ksu_handle_compat_execve_ksud v2
- kernel: ksud: add ksu_handle_execve_ksud v2

This finalizes syscall-only hooking for KernelSU as we provide
both native and compat.

- sys_execve - ksu_handle_execve_ksud
- compat_sys_execve - ksu_handle_compat_execve_ksud

since these two share common logic, we commonize them to
ksu_common_execve_ksud sinc only the argv field is different.
(.native vs .compat)

usage:
	ksu_handle_execve_ksud(filename, argv);  // for sys_execve
	ksu_handle_compat_execve_ksud(filename, argv);  // for compat_sys_execve

This implementations avoids any dependency on struct filename
making it also usable on Ultra-Legacy.

Requires:
- kernel: ksud: dont create structs just to deconstruct them for a string (tiann#2595)

original logic was taken from sys_execve_handler_pre
upstream: tiann@2027ac3

Tested-by: selfmusing <[email protected]>
Tested-by: Adam W. Willis <[email protected]>
Tested-by: alternoegraha <[email protected]>
Tested-by: iDead XD <[email protected]>
Tested-by: rsuntk <[email protected]>
Signed-off-by: backslashxx <[email protected]>
Co-Authored-By: Another Guy <[email protected]>
LeCmnGend pushed a commit to LeCmnGend/KernelSU that referenced this pull request Jul 15, 2025
…ng (tiann#2595)

sys_execve_handler_pre was building a fake struct filename just
to pass it to ksu_handle_execveat_ksud, which immediately does...
filename->name. ??

All we ever needed was filename->name, but we kept doing this meme where
we manually built a struct filename, passed it around, then immediately
ripped out the string again. ??

refactor this so that __ksu_handle_execveat_ksud, takes plain char *.
The old ksu_handle_execveat_ksud is now a shim that unpacks the struct and
hands off the string like we should’ve been doing from the start.

Also mark ksu_handle_execveat_ksud as maybe unused as this will actually be
unused on syscall-only builds.

This also makes integration easier on kernels that don’t have struct filename.

Rejected: tiann#2595

Signed-off-by: backslashxx <[email protected]>
LeCmnGend pushed a commit to LeCmnGend/KernelSU that referenced this pull request Jul 15, 2025
This commit squashes the following:
- kernel: ksud: commonize execve_ksud handlers
- kernel: ksud: provide ksu_handle_compat_execve_ksud v2
- kernel: ksud: add ksu_handle_execve_ksud v2

This finalizes syscall-only hooking for KernelSU as we provide
both native and compat.

- sys_execve - ksu_handle_execve_ksud
- compat_sys_execve - ksu_handle_compat_execve_ksud

since these two share common logic, we commonize them to
ksu_common_execve_ksud sinc only the argv field is different.
(.native vs .compat)

usage:
	ksu_handle_execve_ksud(filename, argv);  // for sys_execve
	ksu_handle_compat_execve_ksud(filename, argv);  // for compat_sys_execve

This implementations avoids any dependency on struct filename
making it also usable on Ultra-Legacy.

Requires:
- kernel: ksud: dont create structs just to deconstruct them for a string (tiann#2595)

original logic was taken from sys_execve_handler_pre
upstream: tiann@2027ac3

Tested-by: selfmusing <[email protected]>
Tested-by: Adam W. Willis <[email protected]>
Tested-by: alternoegraha <[email protected]>
Tested-by: iDead XD <[email protected]>
Tested-by: rsuntk <[email protected]>
Signed-off-by: backslashxx <[email protected]>
Co-Authored-By: Another Guy <[email protected]>
LeCmnGend pushed a commit to LeCmnGend/KernelSU that referenced this pull request Jul 15, 2025
…ng (tiann#2595)

sys_execve_handler_pre was building a fake struct filename just
to pass it to ksu_handle_execveat_ksud, which immediately does...
filename->name. ??

All we ever needed was filename->name, but we kept doing this meme where
we manually built a struct filename, passed it around, then immediately
ripped out the string again. ??

refactor this so that __ksu_handle_execveat_ksud, takes plain char *.
The old ksu_handle_execveat_ksud is now a shim that unpacks the struct and
hands off the string like we should’ve been doing from the start.

Also mark ksu_handle_execveat_ksud as maybe unused as this will actually be
unused on syscall-only builds.

This also makes integration easier on kernels that don’t have struct filename.

Rejected: tiann#2595

Signed-off-by: backslashxx <[email protected]>
LeCmnGend pushed a commit to LeCmnGend/KernelSU that referenced this pull request Jul 15, 2025
This commit squashes the following:
- kernel: ksud: commonize execve_ksud handlers
- kernel: ksud: provide ksu_handle_compat_execve_ksud v2
- kernel: ksud: add ksu_handle_execve_ksud v2

This finalizes syscall-only hooking for KernelSU as we provide
both native and compat.

- sys_execve - ksu_handle_execve_ksud
- compat_sys_execve - ksu_handle_compat_execve_ksud

since these two share common logic, we commonize them to
ksu_common_execve_ksud sinc only the argv field is different.
(.native vs .compat)

usage:
	ksu_handle_execve_ksud(filename, argv);  // for sys_execve
	ksu_handle_compat_execve_ksud(filename, argv);  // for compat_sys_execve

This implementations avoids any dependency on struct filename
making it also usable on Ultra-Legacy.

Requires:
- kernel: ksud: dont create structs just to deconstruct them for a string (tiann#2595)

original logic was taken from sys_execve_handler_pre
upstream: tiann@2027ac3

Tested-by: selfmusing <[email protected]>
Tested-by: Adam W. Willis <[email protected]>
Tested-by: alternoegraha <[email protected]>
Tested-by: iDead XD <[email protected]>
Tested-by: rsuntk <[email protected]>
Signed-off-by: backslashxx <[email protected]>
Co-Authored-By: Another Guy <[email protected]>
LeCmnGend pushed a commit to LeCmnGend/KernelSU that referenced this pull request Jul 15, 2025
…ng (tiann#2595)

sys_execve_handler_pre was building a fake struct filename just
to pass it to ksu_handle_execveat_ksud, which immediately does...
filename->name. ??

All we ever needed was filename->name, but we kept doing this meme where
we manually built a struct filename, passed it around, then immediately
ripped out the string again. ??

refactor this so that __ksu_handle_execveat_ksud, takes plain char *.
The old ksu_handle_execveat_ksud is now a shim that unpacks the struct and
hands off the string like we should’ve been doing from the start.

Also mark ksu_handle_execveat_ksud as maybe unused as this will actually be
unused on syscall-only builds.

This also makes integration easier on kernels that don’t have struct filename.

Rejected: tiann#2595

Signed-off-by: backslashxx <[email protected]>
LeCmnGend pushed a commit to LeCmnGend/KernelSU that referenced this pull request Jul 15, 2025
This commit squashes the following:
- kernel: ksud: commonize execve_ksud handlers
- kernel: ksud: provide ksu_handle_compat_execve_ksud v2
- kernel: ksud: add ksu_handle_execve_ksud v2

This finalizes syscall-only hooking for KernelSU as we provide
both native and compat.

- sys_execve - ksu_handle_execve_ksud
- compat_sys_execve - ksu_handle_compat_execve_ksud

since these two share common logic, we commonize them to
ksu_common_execve_ksud sinc only the argv field is different.
(.native vs .compat)

usage:
	ksu_handle_execve_ksud(filename, argv);  // for sys_execve
	ksu_handle_compat_execve_ksud(filename, argv);  // for compat_sys_execve

This implementations avoids any dependency on struct filename
making it also usable on Ultra-Legacy.

Requires:
- kernel: ksud: dont create structs just to deconstruct them for a string (tiann#2595)

original logic was taken from sys_execve_handler_pre
upstream: tiann@2027ac3

Tested-by: selfmusing <[email protected]>
Tested-by: Adam W. Willis <[email protected]>
Tested-by: alternoegraha <[email protected]>
Tested-by: iDead XD <[email protected]>
Tested-by: rsuntk <[email protected]>
Signed-off-by: backslashxx <[email protected]>
Co-Authored-By: Another Guy <[email protected]>
LeCmnGend pushed a commit to LeCmnGend/KernelSU that referenced this pull request Jul 15, 2025
…ng (tiann#2595)

sys_execve_handler_pre was building a fake struct filename just
to pass it to ksu_handle_execveat_ksud, which immediately does...
filename->name. ??

All we ever needed was filename->name, but we kept doing this meme where
we manually built a struct filename, passed it around, then immediately
ripped out the string again. ??

refactor this so that __ksu_handle_execveat_ksud, takes plain char *.
The old ksu_handle_execveat_ksud is now a shim that unpacks the struct and
hands off the string like we should’ve been doing from the start.

Also mark ksu_handle_execveat_ksud as maybe unused as this will actually be
unused on syscall-only builds.

This also makes integration easier on kernels that don’t have struct filename.

Rejected: tiann#2595

Signed-off-by: backslashxx <[email protected]>
LeCmnGend pushed a commit to LeCmnGend/KernelSU that referenced this pull request Jul 15, 2025
This commit squashes the following:
- kernel: ksud: commonize execve_ksud handlers
- kernel: ksud: provide ksu_handle_compat_execve_ksud v2
- kernel: ksud: add ksu_handle_execve_ksud v2

This finalizes syscall-only hooking for KernelSU as we provide
both native and compat.

- sys_execve - ksu_handle_execve_ksud
- compat_sys_execve - ksu_handle_compat_execve_ksud

since these two share common logic, we commonize them to
ksu_common_execve_ksud sinc only the argv field is different.
(.native vs .compat)

usage:
	ksu_handle_execve_ksud(filename, argv);  // for sys_execve
	ksu_handle_compat_execve_ksud(filename, argv);  // for compat_sys_execve

This implementations avoids any dependency on struct filename
making it also usable on Ultra-Legacy.

Requires:
- kernel: ksud: dont create structs just to deconstruct them for a string (tiann#2595)

original logic was taken from sys_execve_handler_pre
upstream: tiann@2027ac3

Tested-by: selfmusing <[email protected]>
Tested-by: Adam W. Willis <[email protected]>
Tested-by: alternoegraha <[email protected]>
Tested-by: iDead XD <[email protected]>
Tested-by: rsuntk <[email protected]>
Signed-off-by: backslashxx <[email protected]>
Co-Authored-By: Another Guy <[email protected]>
selfmusing pushed a commit to selfmusing/USlenreK that referenced this pull request Jul 16, 2025
…ng (tiann#2595)

sys_execve_handler_pre was building a fake struct filename just
to pass it to ksu_handle_execveat_ksud, which immediately does...
filename->name. ??

All we ever needed was filename->name, but we kept doing this meme where
we manually built a struct filename, passed it around, then immediately
ripped out the string again. ??

refactor this so that __ksu_handle_execveat_ksud, takes plain char *.
The old ksu_handle_execveat_ksud is now a shim that unpacks the struct and
hands off the string like we should’ve been doing from the start.

Also mark ksu_handle_execveat_ksud as maybe unused as this will actually be
unused on syscall-only builds.

This also makes integration easier on kernels that don’t have struct filename.

Rejected: tiann#2595

Signed-off-by: backslashxx <[email protected]>
selfmusing pushed a commit to selfmusing/USlenreK that referenced this pull request Jul 16, 2025
This commit squashes the following:
- kernel: ksud: commonize execve_ksud handlers
- kernel: ksud: provide ksu_handle_compat_execve_ksud v2
- kernel: ksud: add ksu_handle_execve_ksud v2

This finalizes syscall-only hooking for KernelSU as we provide
both native and compat.

- sys_execve - ksu_handle_execve_ksud
- compat_sys_execve - ksu_handle_compat_execve_ksud

since these two share common logic, we commonize them to
ksu_common_execve_ksud sinc only the argv field is different.
(.native vs .compat)

usage:
	ksu_handle_execve_ksud(filename, argv);  // for sys_execve
	ksu_handle_compat_execve_ksud(filename, argv);  // for compat_sys_execve

This implementations avoids any dependency on struct filename
making it also usable on Ultra-Legacy.

Requires:
- kernel: ksud: dont create structs just to deconstruct them for a string (tiann#2595)

original logic was taken from sys_execve_handler_pre
upstream: tiann@2027ac3

Tested-by: selfmusing <[email protected]>
Tested-by: Adam W. Willis <[email protected]>
Tested-by: alternoegraha <[email protected]>
Tested-by: iDead XD <[email protected]>
Tested-by: rsuntk <[email protected]>
Signed-off-by: backslashxx <[email protected]>
Co-Authored-By: Another Guy <[email protected]>
LeCmnGend pushed a commit to LeCmnGend/KernelSU that referenced this pull request Jul 18, 2025
…ng (tiann#2595)

sys_execve_handler_pre was building a fake struct filename just
to pass it to ksu_handle_execveat_ksud, which immediately does...
filename->name. ??

All we ever needed was filename->name, but we kept doing this meme where
we manually built a struct filename, passed it around, then immediately
ripped out the string again. ??

refactor this so that __ksu_handle_execveat_ksud, takes plain char *.
The old ksu_handle_execveat_ksud is now a shim that unpacks the struct and
hands off the string like we should’ve been doing from the start.

Also mark ksu_handle_execveat_ksud as maybe unused as this will actually be
unused on syscall-only builds.

This also makes integration easier on kernels that don’t have struct filename.

Rejected: tiann#2595

Signed-off-by: backslashxx <[email protected]>
LeCmnGend pushed a commit to LeCmnGend/KernelSU that referenced this pull request Jul 18, 2025
This commit squashes the following:
- kernel: ksud: commonize execve_ksud handlers
- kernel: ksud: provide ksu_handle_compat_execve_ksud v2
- kernel: ksud: add ksu_handle_execve_ksud v2

This finalizes syscall-only hooking for KernelSU as we provide
both native and compat.

- sys_execve - ksu_handle_execve_ksud
- compat_sys_execve - ksu_handle_compat_execve_ksud

since these two share common logic, we commonize them to
ksu_common_execve_ksud sinc only the argv field is different.
(.native vs .compat)

usage:
	ksu_handle_execve_ksud(filename, argv);  // for sys_execve
	ksu_handle_compat_execve_ksud(filename, argv);  // for compat_sys_execve

This implementations avoids any dependency on struct filename
making it also usable on Ultra-Legacy.

Requires:
- kernel: ksud: dont create structs just to deconstruct them for a string (tiann#2595)

original logic was taken from sys_execve_handler_pre
upstream: tiann@2027ac3

Tested-by: selfmusing <[email protected]>
Tested-by: Adam W. Willis <[email protected]>
Tested-by: alternoegraha <[email protected]>
Tested-by: iDead XD <[email protected]>
Tested-by: rsuntk <[email protected]>
Signed-off-by: backslashxx <[email protected]>
Co-Authored-By: Another Guy <[email protected]>
selfmusing pushed a commit to selfmusing/USlenreK that referenced this pull request Jul 18, 2025
…ng (tiann#2595)

sys_execve_handler_pre was building a fake struct filename just
to pass it to ksu_handle_execveat_ksud, which immediately does...
filename->name. ??

All we ever needed was filename->name, but we kept doing this meme where
we manually built a struct filename, passed it around, then immediately
ripped out the string again. ??

refactor this so that __ksu_handle_execveat_ksud, takes plain char *.
The old ksu_handle_execveat_ksud is now a shim that unpacks the struct and
hands off the string like we should’ve been doing from the start.

Also mark ksu_handle_execveat_ksud as maybe unused as this will actually be
unused on syscall-only builds.

This also makes integration easier on kernels that don’t have struct filename.

Rejected: tiann#2595

Signed-off-by: backslashxx <[email protected]>
selfmusing pushed a commit to selfmusing/USlenreK that referenced this pull request Jul 18, 2025
This commit squashes the following:
- kernel: ksud: commonize execve_ksud handlers
- kernel: ksud: provide ksu_handle_compat_execve_ksud v2
- kernel: ksud: add ksu_handle_execve_ksud v2

This finalizes syscall-only hooking for KernelSU as we provide
both native and compat.

- sys_execve - ksu_handle_execve_ksud
- compat_sys_execve - ksu_handle_compat_execve_ksud

since these two share common logic, we commonize them to
ksu_common_execve_ksud sinc only the argv field is different.
(.native vs .compat)

usage:
	ksu_handle_execve_ksud(filename, argv);  // for sys_execve
	ksu_handle_compat_execve_ksud(filename, argv);  // for compat_sys_execve

This implementations avoids any dependency on struct filename
making it also usable on Ultra-Legacy.

Requires:
- kernel: ksud: dont create structs just to deconstruct them for a string (tiann#2595)

original logic was taken from sys_execve_handler_pre
upstream: tiann@2027ac3

Tested-by: selfmusing <[email protected]>
Tested-by: Adam W. Willis <[email protected]>
Tested-by: alternoegraha <[email protected]>
Tested-by: iDead XD <[email protected]>
Tested-by: rsuntk <[email protected]>
Signed-off-by: backslashxx <[email protected]>
Co-Authored-By: Another Guy <[email protected]>
selfmusing pushed a commit to selfmusing/USlenreK that referenced this pull request Jul 18, 2025
…ng (tiann#2595)

sys_execve_handler_pre was building a fake struct filename just
to pass it to ksu_handle_execveat_ksud, which immediately does...
filename->name. ??

All we ever needed was filename->name, but we kept doing this meme where
we manually built a struct filename, passed it around, then immediately
ripped out the string again. ??

refactor this so that __ksu_handle_execveat_ksud, takes plain char *.
The old ksu_handle_execveat_ksud is now a shim that unpacks the struct and
hands off the string like we should’ve been doing from the start.

Also mark ksu_handle_execveat_ksud as maybe unused as this will actually be
unused on syscall-only builds.

This also makes integration easier on kernels that don’t have struct filename.

Rejected: tiann#2595

Signed-off-by: backslashxx <[email protected]>
selfmusing pushed a commit to selfmusing/USlenreK that referenced this pull request Jul 18, 2025
This commit squashes the following:
- kernel: ksud: commonize execve_ksud handlers
- kernel: ksud: provide ksu_handle_compat_execve_ksud v2
- kernel: ksud: add ksu_handle_execve_ksud v2

This finalizes syscall-only hooking for KernelSU as we provide
both native and compat.

- sys_execve - ksu_handle_execve_ksud
- compat_sys_execve - ksu_handle_compat_execve_ksud

since these two share common logic, we commonize them to
ksu_common_execve_ksud sinc only the argv field is different.
(.native vs .compat)

usage:
	ksu_handle_execve_ksud(filename, argv);  // for sys_execve
	ksu_handle_compat_execve_ksud(filename, argv);  // for compat_sys_execve

This implementations avoids any dependency on struct filename
making it also usable on Ultra-Legacy.

Requires:
- kernel: ksud: dont create structs just to deconstruct them for a string (tiann#2595)

original logic was taken from sys_execve_handler_pre
upstream: tiann@2027ac3

Tested-by: selfmusing <[email protected]>
Tested-by: Adam W. Willis <[email protected]>
Tested-by: alternoegraha <[email protected]>
Tested-by: iDead XD <[email protected]>
Tested-by: rsuntk <[email protected]>
Signed-off-by: backslashxx <[email protected]>
Co-Authored-By: Another Guy <[email protected]>
LeCmnGend pushed a commit to LeCmnGend/KernelSU that referenced this pull request Jul 19, 2025
…ng (tiann#2595)

sys_execve_handler_pre was building a fake struct filename just
to pass it to ksu_handle_execveat_ksud, which immediately does...
filename->name. ??

All we ever needed was filename->name, but we kept doing this meme where
we manually built a struct filename, passed it around, then immediately
ripped out the string again. ??

refactor this so that __ksu_handle_execveat_ksud, takes plain char *.
The old ksu_handle_execveat_ksud is now a shim that unpacks the struct and
hands off the string like we should’ve been doing from the start.

Also mark ksu_handle_execveat_ksud as maybe unused as this will actually be
unused on syscall-only builds.

This also makes integration easier on kernels that don’t have struct filename.

Rejected: tiann#2595

Signed-off-by: backslashxx <[email protected]>
LeCmnGend pushed a commit to LeCmnGend/KernelSU that referenced this pull request Jul 19, 2025
This commit squashes the following:
- kernel: ksud: commonize execve_ksud handlers
- kernel: ksud: provide ksu_handle_compat_execve_ksud v2
- kernel: ksud: add ksu_handle_execve_ksud v2

This finalizes syscall-only hooking for KernelSU as we provide
both native and compat.

- sys_execve - ksu_handle_execve_ksud
- compat_sys_execve - ksu_handle_compat_execve_ksud

since these two share common logic, we commonize them to
ksu_common_execve_ksud sinc only the argv field is different.
(.native vs .compat)

usage:
	ksu_handle_execve_ksud(filename, argv);  // for sys_execve
	ksu_handle_compat_execve_ksud(filename, argv);  // for compat_sys_execve

This implementations avoids any dependency on struct filename
making it also usable on Ultra-Legacy.

Requires:
- kernel: ksud: dont create structs just to deconstruct them for a string (tiann#2595)

original logic was taken from sys_execve_handler_pre
upstream: tiann@2027ac3

Tested-by: selfmusing <[email protected]>
Tested-by: Adam W. Willis <[email protected]>
Tested-by: alternoegraha <[email protected]>
Tested-by: iDead XD <[email protected]>
Tested-by: rsuntk <[email protected]>
Signed-off-by: backslashxx <[email protected]>
Co-Authored-By: Another Guy <[email protected]>
selfmusing pushed a commit to selfmusing/USlenreK that referenced this pull request Jul 20, 2025
…ng (tiann#2595)

sys_execve_handler_pre was building a fake struct filename just
to pass it to ksu_handle_execveat_ksud, which immediately does...
filename->name. ??

All we ever needed was filename->name, but we kept doing this meme where
we manually built a struct filename, passed it around, then immediately
ripped out the string again. ??

refactor this so that __ksu_handle_execveat_ksud, takes plain char *.
The old ksu_handle_execveat_ksud is now a shim that unpacks the struct and
hands off the string like we should’ve been doing from the start.

Also mark ksu_handle_execveat_ksud as maybe unused as this will actually be
unused on syscall-only builds.

This also makes integration easier on kernels that don’t have struct filename.

Rejected: tiann#2595

Signed-off-by: backslashxx <[email protected]>
selfmusing pushed a commit to selfmusing/USlenreK that referenced this pull request Jul 20, 2025
This commit squashes the following:
- kernel: ksud: commonize execve_ksud handlers
- kernel: ksud: provide ksu_handle_compat_execve_ksud v2
- kernel: ksud: add ksu_handle_execve_ksud v2

This finalizes syscall-only hooking for KernelSU as we provide
both native and compat.

- sys_execve - ksu_handle_execve_ksud
- compat_sys_execve - ksu_handle_compat_execve_ksud

since these two share common logic, we commonize them to
ksu_common_execve_ksud sinc only the argv field is different.
(.native vs .compat)

usage:
	ksu_handle_execve_ksud(filename, argv);  // for sys_execve
	ksu_handle_compat_execve_ksud(filename, argv);  // for compat_sys_execve

This implementations avoids any dependency on struct filename
making it also usable on Ultra-Legacy.

Requires:
- kernel: ksud: dont create structs just to deconstruct them for a string (tiann#2595)

original logic was taken from sys_execve_handler_pre
upstream: tiann@2027ac3

Tested-by: selfmusing <[email protected]>
Tested-by: Adam W. Willis <[email protected]>
Tested-by: alternoegraha <[email protected]>
Tested-by: iDead XD <[email protected]>
Tested-by: rsuntk <[email protected]>
Signed-off-by: backslashxx <[email protected]>
Co-Authored-By: Another Guy <[email protected]>
LeCmnGend pushed a commit to LeCmnGend/KernelSU that referenced this pull request Jul 21, 2025
…ng (tiann#2595)

sys_execve_handler_pre was building a fake struct filename just
to pass it to ksu_handle_execveat_ksud, which immediately does...
filename->name. ??

All we ever needed was filename->name, but we kept doing this meme where
we manually built a struct filename, passed it around, then immediately
ripped out the string again. ??

refactor this so that __ksu_handle_execveat_ksud, takes plain char *.
The old ksu_handle_execveat_ksud is now a shim that unpacks the struct and
hands off the string like we should’ve been doing from the start.

Also mark ksu_handle_execveat_ksud as maybe unused as this will actually be
unused on syscall-only builds.

This also makes integration easier on kernels that don’t have struct filename.

Rejected: tiann#2595

Signed-off-by: backslashxx <[email protected]>
LeCmnGend pushed a commit to LeCmnGend/KernelSU that referenced this pull request Jul 21, 2025
This commit squashes the following:
- kernel: ksud: commonize execve_ksud handlers
- kernel: ksud: provide ksu_handle_compat_execve_ksud v2
- kernel: ksud: add ksu_handle_execve_ksud v2

This finalizes syscall-only hooking for KernelSU as we provide
both native and compat.

- sys_execve - ksu_handle_execve_ksud
- compat_sys_execve - ksu_handle_compat_execve_ksud

since these two share common logic, we commonize them to
ksu_common_execve_ksud sinc only the argv field is different.
(.native vs .compat)

usage:
	ksu_handle_execve_ksud(filename, argv);  // for sys_execve
	ksu_handle_compat_execve_ksud(filename, argv);  // for compat_sys_execve

This implementations avoids any dependency on struct filename
making it also usable on Ultra-Legacy.

Requires:
- kernel: ksud: dont create structs just to deconstruct them for a string (tiann#2595)

original logic was taken from sys_execve_handler_pre
upstream: tiann@2027ac3

Tested-by: selfmusing <[email protected]>
Tested-by: Adam W. Willis <[email protected]>
Tested-by: alternoegraha <[email protected]>
Tested-by: iDead XD <[email protected]>
Tested-by: rsuntk <[email protected]>
Signed-off-by: backslashxx <[email protected]>
Co-Authored-By: Another Guy <[email protected]>
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.

2 participants