From: Matthew Wilcox <willy@infradead.org>
To: Igor Stoppa <igor.stoppa@huawei.com>
Cc: keescook@chromium.org, mhocko@kernel.org, david@fromorbit.com,
rppt@linux.vnet.ibm.com, labbott@redhat.com,
linux-security-module@vger.kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org,
kernel-hardening@lists.openwall.com, igor.stoppa@gmail.com
Subject: Re: [PATCH 3/6] Protectable Memory
Date: Mon, 26 Mar 2018 19:31:10 -0700 [thread overview]
Message-ID: <20180327023110.GD10054@bombadil.infradead.org> (raw)
In-Reply-To: <20180327015524.14318-4-igor.stoppa@huawei.com>
On Tue, Mar 27, 2018 at 04:55:21AM +0300, Igor Stoppa wrote:
> +static inline void *pmalloc_array_align(struct pmalloc_pool *pool,
> + size_t n, size_t size,
> + short int align_order)
> +{
You're missing:
if (size != 0 && n > SIZE_MAX / size)
return NULL;
> + return pmalloc_align(pool, n * size, align_order);
> +}
> +static inline void *pcalloc_align(struct pmalloc_pool *pool, size_t n,
> + size_t size, short int align_order)
> +{
> + return pzalloc_align(pool, n * size, align_order);
> +}
Ditto.
> +static inline void *pcalloc(struct pmalloc_pool *pool, size_t n,
> + size_t size)
> +{
> + return pzalloc_align(pool, n * size, PMALLOC_ALIGN_DEFAULT);
> +}
If you make this one:
return pcalloc_align(pool, n, size, PMALLOC_ALIGN_DEFAULT)
then you don't need the check in this function.
Also, do we really need 'align' as a parameter to the allocator functions
rather than to the pool?
I'd just reuse ARCH_KMALLOC_MINALIGN from slab.h as the alignment, and
then add the special alignment options when we have a real user for them.
next prev parent reply other threads:[~2018-03-27 2:31 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-27 1:55 [RFC PATCH v20 0/6] mm: security: ro protection for dynamic data Igor Stoppa
2018-03-27 1:55 ` [PATCH 1/6] struct page: add field for vm_struct Igor Stoppa
2018-03-27 1:55 ` [PATCH 2/6] vmalloc: rename llist field in vmap_area Igor Stoppa
2018-03-27 1:55 ` [PATCH 3/6] Protectable Memory Igor Stoppa
2018-03-27 2:31 ` Matthew Wilcox [this message]
2018-03-27 11:43 ` Igor Stoppa
2018-03-27 21:57 ` kbuild test robot
2018-03-27 1:55 ` [PATCH 4/6] Pmalloc selftest Igor Stoppa
2018-03-27 1:55 ` [PATCH 5/6] lkdtm: crash on overwriting protected pmalloc var Igor Stoppa
2018-03-27 1:55 ` [PATCH 6/6] Documentation for Pmalloc Igor Stoppa
-- strict thread matches above, loose matches on Subject: below --
2018-03-27 15:37 [RFC PATCH v21 0/6] mm: security: ro protection for dynamic data Igor Stoppa
2018-03-27 15:37 ` [PATCH 3/6] Protectable Memory Igor Stoppa
2018-04-13 13:41 [RFC PATCH v22 0/6] mm: security: ro protection for dynamic data Igor Stoppa
2018-04-13 13:41 ` [PATCH 3/6] Protectable Memory Igor Stoppa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180327023110.GD10054@bombadil.infradead.org \
--to=willy@infradead.org \
--cc=david@fromorbit.com \
--cc=igor.stoppa@gmail.com \
--cc=igor.stoppa@huawei.com \
--cc=keescook@chromium.org \
--cc=kernel-hardening@lists.openwall.com \
--cc=labbott@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-security-module@vger.kernel.org \
--cc=mhocko@kernel.org \
--cc=rppt@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).