Re: [PATCH v2 2/5] arm64, mm: Move generic mmap layout functions to mm

From: Alexandre Ghiti
Date: Wed Apr 10 2019 - 03:33:30 EST


On 04/10/2019 08:59 AM, Christoph Hellwig wrote:
On Thu, Apr 04, 2019 at 01:51:25AM -0400, Alexandre Ghiti wrote:
- fix the case where stack randomization should not be taken into
account.
Hmm. This sounds a bit vague. It might be better if something
considered a fix is split out to a separate patch with a good
description.

Ok, I will move this fix in another patch.


+config ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT
+ bool
+ help
+ This allows to use a set of generic functions to determine mmap base
+ address by giving priority to top-down scheme only if the process
+ is not in legacy mode (compat task, unlimited stack size or
+ sysctl_legacy_va_layout).
Given that this is an option that is just selected by other Kconfig
options the help text won't ever be shown. I'd just move it into a
comment bove the definition.

Oh yes, it does not appear, thanks, I'll move it above the definition.


+#ifdef CONFIG_MMU
+#ifdef CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT
I don't think we need the #ifdef CONFIG_MMU here,
CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT should only be selected
if the MMU is enabled to start with.

Ok, thanks.

+#ifdef CONFIG_ARCH_HAS_ELF_RANDOMIZE
+unsigned long arch_mmap_rnd(void)
Now that a bunch of architectures use a version in common code
the arch_ prefix is a bit mislead. Probably not worth changing
here, but some time in the future it could use a new name.

Ok I'll keep it in mind for later,

Thanks for your time,

Alex