2009-04-28 22:36:19

by Oleg Nesterov

[permalink] [raw]
Subject: [PATCH] ptrace: s/parent/real_parent/ in binfmt_elf_fdpic.c

->real_parent is the parent. ->parent may be the tracer.

Signed-off-by: Oleg Nesterov <[email protected]>

--- PTRACE/fs/binfmt_elf_fdpic.c~FDPIC 2009-04-06 00:03:40.000000000 +0200
+++ PTRACE/fs/binfmt_elf_fdpic.c 2009-04-28 21:40:49.000000000 +0200
@@ -1388,7 +1388,7 @@ static void fill_prstatus(struct elf_prs
prstatus->pr_sigpend = p->pending.signal.sig[0];
prstatus->pr_sighold = p->blocked.sig[0];
prstatus->pr_pid = task_pid_vnr(p);
- prstatus->pr_ppid = task_pid_vnr(p->parent);
+ prstatus->pr_ppid = task_pid_vnr(p->real_parent);
prstatus->pr_pgrp = task_pgrp_vnr(p);
prstatus->pr_sid = task_session_vnr(p);
if (thread_group_leader(p)) {
@@ -1433,7 +1433,7 @@ static int fill_psinfo(struct elf_prpsin
psinfo->pr_psargs[len] = 0;

psinfo->pr_pid = task_pid_vnr(p);
- psinfo->pr_ppid = task_pid_vnr(p->parent);
+ psinfo->pr_ppid = task_pid_vnr(p->real_parent);
psinfo->pr_pgrp = task_pgrp_vnr(p);
psinfo->pr_sid = task_session_vnr(p);


2009-04-28 22:41:09

by Oleg Nesterov

[permalink] [raw]
Subject: Re: [PATCH] ptrace: s/parent/real_parent/ in binfmt_elf_fdpic.c

On 04/29, Oleg Nesterov wrote:
>
> - prstatus->pr_ppid = task_pid_vnr(p->parent);
> + prstatus->pr_ppid = task_pid_vnr(p->real_parent);
> prstatus->pr_pgrp = task_pgrp_vnr(p);

Hmm. Just noticed. What protects ->parent or ->real_parent ?

Looks like we need rcu_lock() around... The same in fs/binfmt_elf.c.
Will send another trivial patch (on top of this) tomorrow.

Oleg.

2009-04-29 09:47:29

by David Howells

[permalink] [raw]
Subject: Re: [PATCH] ptrace: s/parent/real_parent/ in binfmt_elf_fdpic.c

Oleg Nesterov <[email protected]> wrote:

> ->real_parent is the parent. ->parent may be the tracer.
>
> Signed-off-by: Oleg Nesterov <[email protected]>

Acked-by: David Howells <[email protected]>