I'm not sure this is true for old LinuxThreads...Although I'm not sure it's needed for this problem. A getppid() which does
asmlinkage long sys_getppid(void)
pid = current->group_leader->real_parent->tgid;
seems like a fine implementation to me ;)
Why do we need to use ->group_leader? All threads should have the same
Why do we need tasklist_lock? I think rcu_read_lock() is enough.Your patch doesn't cure the problem.
In other words, do you see any problems with this code
smlinkage long sys_getppid(void)
pid = rcu_dereference(current->real_parent)->tgid;
? Yes, we may read a stale value for ->real_parent, but the memory
can't be freed while we are under rcu_read_lock(). And in this case
the returned value is ok because the task could be reparented just
after return anyway.