lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080417115718.GC103@tv-sign.ru>
Date:	Thu, 17 Apr 2008 15:57:18 +0400
From:	Oleg Nesterov <oleg@...sign.ru>
To:	Jesper Juhl <jesper.juhl@...il.com>
Cc:	Ingo Molnar <mingo@...e.hu>, linux-kernel@...r.kernel.org,
	Pavel Emelyanov <xemul@...nvz.org>,
	"Eric W. Biederman" <ebiederm@...ssion.com>
Subject: Re: Possible mem leak in copy_process()

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(&current->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.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ