kernel: migrate barriers to spec barriers and code style thing

overkill, but yeah, might as well move on to the real deal.

[ rsuntk: Rename original variable name ]
Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
Signed-off-by: rsuntk <rsuntk@yukiprjkt.my.id>
This commit is contained in:
backslashxx
2025-10-03 16:26:17 +07:00
committed by ShirkNeko
parent fd8e3c35bb
commit 6af2da13ae
3 changed files with 14 additions and 11 deletions

View File

@@ -310,24 +310,20 @@ int ksu_handle_prctl(int option, unsigned long arg2, unsigned long arg3,
// here we just let them suffer
uid_t current_uid_val = current_uid().val;
uid_t manager_uid = ksu_get_manager_uid();
if (current_uid_val != manager_uid &&
if (current_uid_val != manager_uid &&
current_uid_val % 100000 == manager_uid) {
ksu_set_manager_uid(current_uid_val);
// make sure all cpus sees this change, next line will check
smp_mb();
ksu_set_manager_uid(current_uid_val);
}
skip_check:
// yes this causes delay, but this keeps the delay consistent, which is what we want
barrier();
// with a proper barrier for safety as the compiler and cpu might try to do something smart.
KCOMPAT_BARRIER();
if (!is_allow_su())
return 0;
// we move it after uid check here so they cannot
// compare 0xdeadbeef call to a non-0xdeadbeef call
// with barriers around for safety as the compiler
// might try to do something smart.
barrier();
if (KERNEL_SU_OPTION != option)
return 0;