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, 10 Oct 2017 13:51:06 -0400
From:   Rik van Riel <riel@...riel.com>
To:     Gargi Sharma <gs051095@...il.com>
Cc:     Oleg Nesterov <oleg@...hat.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        linux-kernel@...r.kernel.org, Julia Lawall <julia.lawall@...6.fr>,
        mingo@...nel.org, pasha.tatashin@...cle.com, ktkhai@...tuozzo.com,
        "Eric W. Biederman" <ebiederm@...ssion.com>,
        Christoph Hellwig <hch@...radead.org>
Subject: Re: [PATCH v4 1/2] pid: Replace pid bitmap implementation with IDR
 API

On Tue, 2017-10-10 at 17:11 +0100, Gargi Sharma wrote:
> 
> I have listed down the code for both idr_for_each and
> idr_for_each_entry.
> IMHO idr_for_each_entry is easier to read, but YMMV. :)
> 
> void kill_task(int id, void *ptr, void *data)
> {
>     struct *pid = ptr;
>     struct task_struct *task = pid_task(pid, PIDTYPE_PID);
>     if (task && !__fatal_signal_pending(task))
>          send_sig_info(SIGKILL, SEND_SIG_FORCED, task);
> }
> 
> rcu_read_unlock();
> idr_for_each(&pid_ns->idr, &kill_task, NULL);
> rcu_read_unlock();

It also looks like idr_for_each has no easy
way to skip over PID 1, like you can do with
idr_for_each_entry_continue().

I agree with you, the code below is easier to
read than the code above.

> idr_for_each_entry_continue(&pid_ns->idr, pid, nr) {
>           task = pid_task(pid, PIDTYPE_PID);
>           if (task && !__fatal_signal_pending(task))
>               send_sig_info(SIGKILL, SEND_SIG_FORCED, task);
> }
> 
> Thanks!
> Gargi
> > 
> > --
> > All rights reversed
> 
> 
-- 
All rights reversed
Download attachment "signature.asc" of type "application/pgp-signature" (474 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ