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

[6.12] Track PF uksmd patches #37

Draft
wants to merge 2 commits into
base: base-6.12
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
mm/process_ksm: use pidfd_get_task() instead of pidfd_get_pid()+get_p…
…id_task()

Link: https://git.kernel.org/linus/ee9955d61a0a
Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
  • Loading branch information
pfactum authored and kakra committed Nov 18, 2024
commit 719e13a0dc8d2428a1b53b49f9d98eff8ba66785
15 changes: 3 additions & 12 deletions kernel/sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -2801,23 +2801,16 @@ enum pkc_action {
static long do_process_ksm_control(int pidfd, enum pkc_action action)
{
long ret;
struct pid *pid;
struct task_struct *task;
struct mm_struct *mm;
unsigned int f_flags;

pid = pidfd_get_pid(pidfd, &f_flags);
if (IS_ERR(pid)) {
ret = PTR_ERR(pid);
task = pidfd_get_task(pidfd, &f_flags);
if (IS_ERR(task)) {
ret = PTR_ERR(task);
goto out;
}

task = get_pid_task(pid, PIDTYPE_PID);
if (!task) {
ret = -ESRCH;
goto put_pid;
}

/* Require PTRACE_MODE_READ to avoid leaking ASLR metadata. */
mm = mm_access(task, PTRACE_MODE_READ_FSCREDS);
if (IS_ERR_OR_NULL(mm)) {
Expand Down Expand Up @@ -2854,8 +2847,6 @@ static long do_process_ksm_control(int pidfd, enum pkc_action action)
mmput(mm);
release_task:
put_task_struct(task);
put_pid:
put_pid(pid);
out:
return ret;
}
Expand Down