Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'vfs-6.18-rc1.pidfs' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs

Pull pidfs updates from Christian Brauner:
"This just contains a few changes to pid_nr_ns() to make it more robust
and cleans up or improves a few users that ab- or misuse it currently"

* tag 'vfs-6.18-rc1.pidfs' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs:
pid: change task_state() to use task_ppid_nr_ns()
pid: change bacct_add_tsk() to use task_ppid_nr_ns()
pid: make __task_pid_nr_ns(ns => NULL) safe for zombie callers
pid: Add a judgment for ns null in pid_nr_ns

+5 -7
+1 -3
fs/proc/array.c
··· 157 157 unsigned int max_fds = 0; 158 158 159 159 rcu_read_lock(); 160 - ppid = pid_alive(p) ? 161 - task_tgid_nr_ns(rcu_dereference(p->real_parent), ns) : 0; 162 - 163 160 tracer = ptrace_parent(p); 164 161 if (tracer) 165 162 tpid = task_pid_nr_ns(tracer, ns); 166 163 164 + ppid = task_ppid_nr_ns(p, ns); 167 165 tgid = task_tgid_nr_ns(p, ns); 168 166 ngid = task_numa_group_id(p); 169 167 cred = get_task_cred(p);
+3 -2
kernel/pid.c
··· 491 491 struct upid *upid; 492 492 pid_t nr = 0; 493 493 494 - if (pid && ns->level <= pid->level) { 494 + if (pid && ns && ns->level <= pid->level) { 495 495 upid = &pid->numbers[ns->level]; 496 496 if (upid->ns == ns) 497 497 nr = upid->nr; ··· 514 514 rcu_read_lock(); 515 515 if (!ns) 516 516 ns = task_active_pid_ns(current); 517 - nr = pid_nr_ns(rcu_dereference(*task_pid_ptr(task, type)), ns); 517 + if (ns) 518 + nr = pid_nr_ns(rcu_dereference(*task_pid_ptr(task, type)), ns); 518 519 rcu_read_unlock(); 519 520 520 521 return nr;
+1 -2
kernel/tsacct.c
··· 57 57 stats->ac_sched = tsk->policy; 58 58 stats->ac_pid = task_pid_nr_ns(tsk, pid_ns); 59 59 stats->ac_tgid = task_tgid_nr_ns(tsk, pid_ns); 60 + stats->ac_ppid = task_ppid_nr_ns(tsk, pid_ns); 60 61 rcu_read_lock(); 61 62 tcred = __task_cred(tsk); 62 63 stats->ac_uid = from_kuid_munged(user_ns, tcred->uid); 63 64 stats->ac_gid = from_kgid_munged(user_ns, tcred->gid); 64 - stats->ac_ppid = pid_alive(tsk) ? 65 - task_tgid_nr_ns(rcu_dereference(tsk->real_parent), pid_ns) : 0; 66 65 rcu_read_unlock(); 67 66 68 67 task_cputime(tsk, &utime, &stime);