From: Oleg Nesterov <oleg@tv-sign.ru>
To: Jesper Juhl <jesper.juhl@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>,
linux-kernel@vger.kernel.org, Pavel Emelyanov <xemul@openvz.org>,
"Eric W. Biederman" <ebiederm@xmission.com>
Subject: Re: Possible mem leak in copy_process()
Date: Thu, 17 Apr 2008 15:57:18 +0400 [thread overview]
Message-ID: <20080417115718.GC103@tv-sign.ru> (raw)
In-Reply-To: <alpine.LNX.1.00.0804162336480.9837@dragon.funnycrock.com>
Ugh! I'm not sure I really understand what Coverity says, to the
point I am not sure where it thinks the bug is, but
On 04/16, Jesper Juhl wrote:
>
> At conditional (16): "(p)->pid != 0" taking false path
>
> 1331 if (likely(p->pid)) {
> 1332 add_parent(p);
> 1333 if (unlikely(p->ptrace & PT_PTRACED))
> 1334 __ptrace_link(p, current->parent);
> 1335
> 1336 if (thread_group_leader(p)) {
> 1337 if (clone_flags & CLONE_NEWPID)
> 1338 p->nsproxy->pid_ns->child_reaper = p;
> 1339
> 1340 p->signal->leader_pid = pid;
> 1341 p->signal->tty = current->signal->tty;
> 1342 set_task_pgrp(p, task_pgrp_nr(current));
> 1343 set_task_session(p, task_session_nr(current));
> 1344 attach_pid(p, PIDTYPE_PGID, task_pgrp(current));
> 1345 attach_pid(p, PIDTYPE_SID, task_session(current));
> 1346 list_add_tail_rcu(&p->tasks, &init_task.tasks);
> 1347 __get_cpu_var(process_counts)++;
> 1348 }
> 1349 attach_pid(p, PIDTYPE_PID, pid);
> 1350 nr_threads++;
> 1351 }
> 1352
> 1353 total_forks++;
> 1354 spin_unlock(¤t->sighand->siglock);
> 1355 write_unlock_irq(&tasklist_lock);
> 1356 proc_fork_connector(p);
> 1357 cgroup_post_fork(p);
>
> Event leaked_storage: Returned without freeing storage "pid"
> Also see events: [alloc_fn][var_assign][pass_arg]
this looks like a false alarm.
p->pid == pid->numbers[0].nr. If "struct pid *pid" was allocated,
its .nr can't be 0.
IOW, !p->pid means that pid == init_struct_pid, it wasn't allocated
but was passed from the caller.
Oleg.
next prev parent reply other threads:[~2008-04-17 12:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-16 21:45 Possible mem leak in copy_process() Jesper Juhl
2008-04-17 4:17 ` Arnd Bergmann
2008-04-17 11:57 ` Oleg Nesterov [this message]
2008-04-17 13:02 ` Ingo Molnar
2008-04-17 14:02 ` fork_idle && pid problems ? (was: Possible mem leak in copy_process()) Oleg Nesterov
2008-04-17 15:50 ` fork_idle && pid problems ? Pavel Emelyanov
2008-04-17 15:36 ` Oleg Nesterov
2008-04-17 16:40 ` Pavel Emelyanov
2008-04-17 16:05 ` Oleg Nesterov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080417115718.GC103@tv-sign.ru \
--to=oleg@tv-sign.ru \
--cc=ebiederm@xmission.com \
--cc=jesper.juhl@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=xemul@openvz.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.