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:   Mon, 25 Sep 2017 16:59:14 +0200
From:   Oleg Nesterov <oleg@...hat.com>
To:     Gargi Sharma <gs051095@...il.com>
Cc:     linux-kernel@...r.kernel.org, riel@...riel.com,
        julia.lawall@...6.fr, akpm@...ux-foundation.org, mingo@...nel.org,
        pasha.tatashin@...cle.com, ktkhai@...tuozzo.com
Subject: Re: [PATCH 1/4] pid: Replace pid bitmap implementation with IDR API

On 09/25, Gargi Sharma wrote:
>
>  void zap_pid_ns_processes(struct pid_namespace *pid_ns)
>  {
> -	int nr;
> +	int nr = 2;
>  	int rc;
>  	struct task_struct *task, *me = current;
>  	int init_pids = thread_group_leader(me) ? 1 : 2;
> +	struct pid *pid;
>  
>  	/* Don't allow any more processes into the pid namespace */
>  	disable_pid_allocation(pid_ns);
> @@ -240,8 +230,8 @@ void zap_pid_ns_processes(struct pid_namespace *pid_ns)
>  	 *
>  	 */
>  	read_lock(&tasklist_lock);
> -	nr = next_pidmap(pid_ns, 1);
> -	while (nr > 0) {
> +	pid = idr_get_next(&pid_ns->idr, &nr);
> +	while (pid) {
>  		rcu_read_lock();
>  
>  		task = pid_task(find_vpid(nr), PIDTYPE_PID);
> @@ -250,7 +240,8 @@ void zap_pid_ns_processes(struct pid_namespace *pid_ns)
>  
>  		rcu_read_unlock();
>  
> -		nr = next_pidmap(pid_ns, nr);
> +		nr++;
> +		pid = idr_get_next(&pid_ns->idr, &nr);
>  	}
>  	read_unlock(&tasklist_lock);

Then you should probably rewrite this code using idr_for_each_entry_continue() ?

And why do you need find_vpid(nr) if you already have "pid" ?

Oleg.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ