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]
Date:	Tue, 11 May 2010 03:54:10 -0500
From:	"Serge E. Hallyn" <serue@...ibm.com>
To:	Oleg Nesterov <oleg@...hat.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Cedric Le Goater <clg@...t.ibm.com>,
	Dave Hansen <haveblue@...ibm.com>,
	Eric Biederman <ebiederm@...ssion.com>,
	Herbert Poetzl <herbert@...hfloor.at>,
	Ingo Molnar <mingo@...e.hu>,
	Mathias Krause <Mathias.Krause@...unet.com>,
	Roland McGrath <roland@...hat.com>,
	Sukadev Bhattiprolu <sukadev@...ibm.com>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/4] pids: fix fork_idle() to setup ->pids correctly

Quoting Oleg Nesterov (oleg@...hat.com):
> copy_process(pid => &init_struct_pid) doesn't do attach_pid/etc.
> 
> It shouldn't, but this means that the idle threads run with the wrong
> pids copied from the caller's task_struct. In x86 case the caller is
> either kernel_init() thread or keventd.
> 
> In particular, this means that after the series of cpu_up/cpu_down an
> idle thread (which never exits) can run with .pid pointing to nowhere.
> 
> Change fork_idle() to initialize idle->pids[] correctly. We only set
> .pid = &init_struct_pid but do not add .node to list, INIT_TASK() does
> the same for the boot-cpu idle thread (swapper).
> 
> Signed-off-by: Oleg Nesterov <oleg@...hat.com>

Acked-by: Serge E. Hallyn <serue@...ibm.com>

> ---
> 
>  kernel/fork.c |   14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> --- 34-rc1/kernel/fork.c~3_FORK_IDLE_SET_PIDS	2010-03-24 18:07:03.000000000 +0100
> +++ 34-rc1/kernel/fork.c	2010-05-10 20:45:33.000000000 +0200
> @@ -1339,6 +1339,16 @@ noinline struct pt_regs * __cpuinit __at
>  	return regs;
>  }
> 
> +static inline void init_idle_pids(struct pid_link *links)
> +{
> +	enum pid_type type;
> +
> +	for (type = PIDTYPE_PID; type < PIDTYPE_MAX; ++type) {
> +		INIT_HLIST_NODE(&links[type].node); /* not really needed */
> +		links[type].pid = &init_struct_pid;
> +	}
> +}
> +
>  struct task_struct * __cpuinit fork_idle(int cpu)
>  {
>  	struct task_struct *task;
> @@ -1346,8 +1356,10 @@ struct task_struct * __cpuinit fork_idle
> 
>  	task = copy_process(CLONE_VM, 0, idle_regs(&regs), 0, NULL,
>  			    &init_struct_pid, 0);
> -	if (!IS_ERR(task))
> +	if (!IS_ERR(task)) {
> +		init_idle_pids(task->pids);
>  		init_idle(task, cpu);
> +	}
> 
>  	return task;
>  }
--
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