Files
Alice RyhlandPaul Moore 15c1f17979 cred: delete task_euid()
task_euid() is a very weird operation. You can see how weird it is by
grepping for task_euid() - binder is its only user. task_euid() obtains
the objective effective UID - it looks at the credentials of the task
for purposes of acting on it as an object, but then accesses the
effective UID (which the credentials.7 man page describes as "[...] used
by the kernel to determine the permissions that the process will have
when accessing shared resources [...]").

Since usage in Binder has now been removed, get rid of the resulting
dead code.

Changes to the zh_CN translation was carried out with the help of
Gemini and Google Translate, and since adjusted as per Alex Shi's
feedback.

Suggested-by: Jann Horn <jannh@google.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
2026-07-07 15:10:48 -04:00

58 lines
1.1 KiB
C

// SPDX-License-Identifier: GPL-2.0
#include <linux/kernel.h>
#include <linux/sched/task.h>
__rust_helper void rust_helper_might_resched(void)
{
might_resched();
}
__rust_helper struct task_struct *rust_helper_get_current(void)
{
return current;
}
__rust_helper void rust_helper_get_task_struct(struct task_struct *t)
{
get_task_struct(t);
}
__rust_helper void rust_helper_put_task_struct(struct task_struct *t)
{
put_task_struct(t);
}
__rust_helper kuid_t rust_helper_task_uid(struct task_struct *task)
{
return task_uid(task);
}
#ifndef CONFIG_USER_NS
__rust_helper uid_t rust_helper_from_kuid(struct user_namespace *to, kuid_t uid)
{
return from_kuid(to, uid);
}
#endif /* CONFIG_USER_NS */
__rust_helper bool rust_helper_uid_eq(kuid_t left, kuid_t right)
{
return uid_eq(left, right);
}
__rust_helper kuid_t rust_helper_current_euid(void)
{
return current_euid();
}
__rust_helper struct user_namespace *rust_helper_current_user_ns(void)
{
return current_user_ns();
}
__rust_helper pid_t rust_helper_task_tgid_nr_ns(struct task_struct *tsk,
struct pid_namespace *ns)
{
return task_tgid_nr_ns(tsk, ns);
}