From: Robin Murphy <robin.murphy@arm.com>
To: Shyam Saini <mayhs11saini@gmail.com>,
kernel-hardening@lists.openwall.com
Cc: Kees Cook <keescook@chromium.org>,
linux-kernel@vger.kernel.org,
Matthew Wilcox <willy@infradead.org>,
linux-mm@kvack.org, iommu@lists.linux-foundation.org,
Christopher Lameter <cl@linux.com>,
Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH] kernel: dma: Make CMA boot parameters __ro_after_init
Date: Mon, 14 Oct 2019 15:33:42 +0100 [thread overview]
Message-ID: <95842b81-c751-abed-dd3f-258b9fd70393@arm.com> (raw)
In-Reply-To: <20191012122918.8066-1-mayhs11saini@gmail.com>
On 12/10/2019 13:29, Shyam Saini wrote:
> This parameters are not changed after early boot.
> By making them __ro_after_init will reduce any attack surface in the
> kernel.
At a glance, it looks like these are only referenced by a couple of
__init functions, so couldn't they just be __initdata/__initconst?
Robin.
> Link: https://lwn.net/Articles/676145/
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Marek Szyprowski <m.szyprowski@samsung.com>
> Cc: Robin Murphy <robin.murphy@arm.com>
> Cc: Matthew Wilcox <willy@infradead.org>
> Cc: Christopher Lameter <cl@linux.com>
> Cc: Kees Cook <keescook@chromium.org>
> Signed-off-by: Shyam Saini <mayhs11saini@gmail.com>
> ---
> kernel/dma/contiguous.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/dma/contiguous.c b/kernel/dma/contiguous.c
> index 69cfb4345388..1b689b1303cd 100644
> --- a/kernel/dma/contiguous.c
> +++ b/kernel/dma/contiguous.c
> @@ -42,10 +42,10 @@ struct cma *dma_contiguous_default_area;
> * Users, who want to set the size of global CMA area for their system
> * should use cma= kernel parameter.
> */
> -static const phys_addr_t size_bytes = (phys_addr_t)CMA_SIZE_MBYTES * SZ_1M;
> -static phys_addr_t size_cmdline = -1;
> -static phys_addr_t base_cmdline;
> -static phys_addr_t limit_cmdline;
> +static const phys_addr_t __ro_after_init size_bytes = (phys_addr_t)CMA_SIZE_MBYTES * SZ_1M;
> +static phys_addr_t __ro_after_init size_cmdline = -1;
> +static phys_addr_t __ro_after_init base_cmdline;
> +static phys_addr_t __ro_after_init limit_cmdline;
>
> static int __init early_cma(char *p)
> {
>
next prev parent reply other threads:[~2019-10-14 14:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-12 12:29 [PATCH] kernel: dma: Make CMA boot parameters __ro_after_init Shyam Saini
2019-10-14 2:25 ` Nathan Chancellor
2019-10-16 10:11 ` Shyam Saini
2019-10-14 14:33 ` Robin Murphy [this message]
2019-10-19 5:37 ` Shyam Saini
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=95842b81-c751-abed-dd3f-258b9fd70393@arm.com \
--to=robin.murphy@arm.com \
--cc=cl@linux.com \
--cc=hch@lst.de \
--cc=iommu@lists.linux-foundation.org \
--cc=keescook@chromium.org \
--cc=kernel-hardening@lists.openwall.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mayhs11saini@gmail.com \
--cc=willy@infradead.org \
/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).