Skip to content

Schedule find_task_by_pid() for removal

Pavel Emelyanov lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest12 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/12Use find_task_by_vpid in posix timerskernel/posix-cpu-timers.c kernel/posix-timers.c+5 -50 replies
2/12Use find_task_by_vpid in autid codekernel/audit.c+3 -30 replies
3/12Use find_task_by_vpid in taskstatskernel/taskstats.c+3 -30 replies
4/12Don't operate with pid_t in rtmutex testerkernel/rtmutex-debug.c kernel/rtmutex_common.h+10 -40 replies
5/12Handle pid namespaces in cgroups codekernel/cgroup.c+2 -21 reply
6/12gfs2: make gfs2_glock.gl_owner_pid be a struct pid *fs/gfs2/glock.c fs/gfs2/incore.h kernel/pid.c+14 -82 replies
7/12gfs2: make gfs2_holder.gh_owner_pid be a struct pid *fs/gfs2/glock.c fs/gfs2/glock.h fs/gfs2/incore.h+15 -90 replies
8/12frv: use find_task_by_vpid in cxn_pin_by_pidarch/frv/mm/mmu-context.c+1 -10 replies
9/12ia64: make pfm_get_task work with virtual pidsarch/ia64/kernel/perfmon.c+2 -20 replies
10/12ia64: fix ptrace inside a namespacearch/ia64/kernel/ptrace.c+1 -10 replies
11/12mips: use find_task_by_vpid in system callsarch/mips/kernel/mips-mt-fpaff.c arch/mips/kernel/sysirix.c+2 -20 replies
12/12Deprecate the find_task_by_pidDocumentation/feature-removal-schedule.txt include/linux/sched.h init/main.c +2 more+23 -41 reply

Reviews trailers per patch

1 of 12 patches has a Reviewed-by or Acked-by.

PatchPavel EmelyanovPaul Menage
SeriesSinged-off-by
1/12
2/12
3/12
4/12
5/12A-b
6/12
7/12
8/12
9/12
10/12
11/12
12/12

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/12] Schedule find_task_by_pid() for removal

The function in question finds the task by its pid_t in an initial pid namespace (init_pid_ns). This is no longer safe to simply call it, since the current task may be in a pid namespace and it may return the wrong task.

The proper behavior is to call the find_task_by_vpid() if the caller is sure, that the target task lives in the same namespace as he is, or the find_task_by_pid_ns() and specify the namespace to find a task in.

Since the find_task_by_pid() is a well-known API call, and its semantics changes, I think that it's better to mark it as deprecated to warn people, that the result may differ from what they expect and force them to use proper call.

Another case is to store the pointer to the struct pid of a desired task and later call the pid_task() to get the task itself.

So this set just fixes the existing users of find_task_by_pid(). The only one will be left - the UML mconsole, but I'm completely lost in this code, finding out what kind of pid is passed in the mconsole_stack() call :(