From: Will Deacon <will@kernel.org>
To: Barry Song <song.bao.hua@hisilicon.com>
Cc: catalin.marinas@arm.com, linux-arm-kernel@lists.infradead.org,
mark.rutland@arm.com, tyhicks@linux.microsoft.com,
linux@roeck-us.net, maz@kernel.org, tabba@google.com,
lecopzer.chen@mediatek.com, linux-kernel@vger.kernel.org,
linuxarm@huawei.com, Masami Hiramatsu <mhiramat@kernel.org>,
Ard Biesheuvel <ard.biesheuvel@arm.com>,
Qi Liu <liuqi115@huawei.com>
Subject: Re: [PATCH] arm64: fix the doc of RANDOMIZE_MODULE_REGION_FULL
Date: Fri, 30 Jul 2021 13:08:49 +0100 [thread overview]
Message-ID: <20210730120849.GB23589@willie-the-truck> (raw)
In-Reply-To: <20210730105056.19784-1-song.bao.hua@hisilicon.com>
On Fri, Jul 30, 2021 at 10:50:56PM +1200, Barry Song wrote:
> Obviously kaslr is setting the module region to 2GB rather than 4GB since
> commit b2eed9b588112 ("arm64/kernel: kaslr: reduce module randomization
> range to 2 GB").
> On the other hand, module_alloc() can fall back to a 2GB window even though
> RANDOMIZE_MODULE_REGION_FULL is not set. In this case, PLT is still needed.
> So fix the doc to be more precise to avoid any confusion to the readers of
> the code.
>
> Cc: Masami Hiramatsu <mhiramat@kernel.org>
> Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
> Cc: Qi Liu <liuqi115@huawei.com>
> Signed-off-by: Barry Song <song.bao.hua@hisilicon.com>
> ---
> arch/arm64/Kconfig | 7 ++++---
> arch/arm64/kernel/kaslr.c | 4 +++-
> 2 files changed, 7 insertions(+), 4 deletions(-)
Ack for the general idea, but I think this still isn't quite right...
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index b5b13a932561..525c1f0b2430 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -1800,11 +1800,11 @@ config RANDOMIZE_BASE
> If unsure, say N.
>
> config RANDOMIZE_MODULE_REGION_FULL
> - bool "Randomize the module region over a 4 GB range"
> + bool "Randomize the module region over a 2 GB range"
> depends on RANDOMIZE_BASE
> default y
> help
> - Randomizes the location of the module region inside a 4 GB window
> + Randomizes the location of the module region inside a 2 GB window
> covering the core kernel. This way, it is less likely for modules
> to leak information about the location of core kernel data structures
> but it does imply that function calls between modules and the core
> @@ -1812,7 +1812,8 @@ config RANDOMIZE_MODULE_REGION_FULL
>
> When this option is not set, the module region will be randomized over
> a limited range that contains the [_stext, _etext] interval of the
> - core kernel, so branch relocations are always in range.
> + core kernel, so branch relocations are almost always in range unless
> + the region is exhausted and we fall back to a larger 2GB area.
Hmm, that's only true if ARM64_MODULE_PLTS=y.
Will
prev parent reply other threads:[~2021-07-30 12:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-30 10:50 [PATCH] arm64: fix the doc of RANDOMIZE_MODULE_REGION_FULL Barry Song
2021-07-30 12:08 ` Will Deacon [this message]
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=20210730120849.GB23589@willie-the-truck \
--to=will@kernel.org \
--cc=ard.biesheuvel@arm.com \
--cc=catalin.marinas@arm.com \
--cc=lecopzer.chen@mediatek.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=linuxarm@huawei.com \
--cc=liuqi115@huawei.com \
--cc=mark.rutland@arm.com \
--cc=maz@kernel.org \
--cc=mhiramat@kernel.org \
--cc=song.bao.hua@hisilicon.com \
--cc=tabba@google.com \
--cc=tyhicks@linux.microsoft.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).