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: <1506949534.21121.115.camel@surriel.com>
Date:   Mon, 02 Oct 2017 09:05:34 -0400
From:   Rik van Riel <riel@...riel.com>
To:     Christoph Hellwig <hch@...radead.org>,
        Gargi Sharma <gs051095@...il.com>
Cc:     linux-kernel@...r.kernel.org, julia.lawall@...6.fr,
        akpm@...ux-foundation.org, mingo@...nel.org,
        pasha.tatashin@...cle.com, ktkhai@...tuozzo.com, oleg@...hat.com
Subject: Re: [PATCH v2 1/2] pid: Replace pid bitmap implementation with IDR
 API

On Sun, 2017-10-01 at 02:15 -0700, Christoph Hellwig wrote:
> > -		task_active_pid_ns(current)->last_pid);
> > +		task_active_pid_ns(current)->idr.idr_next-1);
> 
> I think we want a well documented helper for this pattern instead
> of poking into the internals.
> 
> Also is last - 1 always the correct answer?  Even with
> idr_alloc_cyclic
> we could wrap around, couldn't we?

Good point. I wonder if it makes sense to change the IDR
code, so idr_get_cursor returns the last allocated ID?

I see only two users of idr_get_cursor in the kernel,
and it looks like both would work fine if idr_get_cursor
returned the previously allocated value.

That would require a small change to idr_alloc_cyclic,
to have it start searching at a position one larger than
the cursor, and maybe renaming idr->idr_next to
idr->cursor, since it would now represent the last
value allocated, not the next.

Would that make sense?

-- 
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