Commit f7e9077a authored by Tiwei Bie's avatar Tiwei Bie Committed by Johannes Berg
Browse files

um: Stop tracking stub's PID via userspace_pid[]



The PID of the stub process can be obtained from current_mm_id().
There is no need to track it via userspace_pid[]. Stop doing that
to simplify the code.

Signed-off-by: default avatarTiwei Bie <tiwei.btw@antgroup.com>
Link: https://patch.msgid.link/20250711065021.2535362-4-tiwei.bie@linux.dev


Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent b3fb0eb5
Loading
Loading
Loading
Loading
+1 −8
Original line number Diff line number Diff line
@@ -16,11 +16,6 @@
#define activate_mm activate_mm
static inline void activate_mm(struct mm_struct *old, struct mm_struct *new)
{
	/*
	 * This is called by fs/exec.c and sys_unshare()
	 * when the new ->mm is used for the first time.
	 */
	__switch_mm(&new->context.id);
}

static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, 
@@ -31,8 +26,6 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
	if (prev != next) {
		cpumask_clear_cpu(cpu, mm_cpumask(prev));
		cpumask_set_cpu(cpu, mm_cpumask(next));
		if(next != &init_mm)
			__switch_mm(&next->context.id);
	}
}

+0 −2
Original line number Diff line number Diff line
@@ -19,8 +19,6 @@ struct mm_id {
	int syscall_fd_map[STUB_MAX_FDS];
};

void __switch_mm(struct mm_id *mm_idp);

void notify_mm_kill(int pid);

#endif
+0 −1
Original line number Diff line number Diff line
@@ -9,7 +9,6 @@
#include <sysdep/ptrace.h>

extern int using_seccomp;
extern int userspace_pid[];

extern void new_thread_handler(void);
extern void handle_syscall(struct uml_pt_regs *regs);
+0 −2
Original line number Diff line number Diff line
@@ -26,8 +26,6 @@ void flush_thread(void)

	get_safe_registers(current_pt_regs()->regs.gp,
			   current_pt_regs()->regs.fp);

	__switch_mm(&current->mm->context.id);
}

void start_thread(struct pt_regs *regs, unsigned long eip, unsigned long esp)
+0 −2
Original line number Diff line number Diff line
@@ -26,8 +26,6 @@ static int __init start_kernel_proc(void *unused)
	return 0;
}

extern int userspace_pid[];

static char cpu0_irqstack[THREAD_SIZE] __aligned(THREAD_SIZE);

int __init start_uml(void)
Loading