[RFC PATCH v19 0/8] mm: security: ro protection for dynamic data
Igor Stoppa
igor.stoppa at huawei.com
Wed Mar 14 12:55:10 UTC 2018
On 14/03/18 13:56, Matthew Wilcox wrote:
> On Wed, Mar 14, 2018 at 01:21:54PM +0200, Igor Stoppa wrote:
[...]
> You misread my proposal. I did not suggest storing the 'start', but the
> 'end'.
Ok, but doesn't that only change the race scenario?
Attempting to free one allocation, while it is in progress, so that all
the "space" bits are written, but the "end bit" is not yet written.
That will eat up also the following, complete allocation, if there is no
locking in place.
[...]
>> The implementation which interleaves "space" and "start" does not suffer
>> from this sort of races, because the alteration of the interleaved
>> bitmaps is atomic.
>
> This would be a bug in the allocator implementation. Obviously it has to
> maintain the integrity of its own data structures.
But I cannot imagine how to do it, with the split bitmaps, without a
lock :-/
And genalloc is supposed to be lockless.
>> Does this justification for the use of interleaved bitmaps (iow the
>> current implementation) make sense?
>
> I think you're making a mistake by basing the pmalloc allocator on
> genalloc.
It was recommended to me because it was a close match to the allocator
that I was writing from scratch and, when I looked at it, I could only
agree that it was very close.
But I have no particular reason for preferring it, if something better
is available. It was just never brought up before.
At least not that I noticed.
> The page_frag allocator seems like a much better place to
> start than genalloc. It has a significantly lower overhead and is
> much more suited to the kind of probably-identical-lifespan that the
> pmalloc API is going to persuade its users to have.
Could you please provide me a pointer?
I did a quick search on 4.16-rc5 and found the definition of page_frag
and sk_page_frag(). Is this what you are referring to?
--
igor
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
More information about the Linux-security-module-archive
mailing list