linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: sxwjean@me.com
To: linux-mm@kvack.org, x86@kernel.org
Cc: Xiongwei Song <sxwjean@gmail.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Kees Cook <keescook@chromium.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Andy Lutomirski <luto@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Arnd Bergmann <arnd@arndb.de>, Al Viro <viro@zeniv.linux.org.uk>,
	Gabriel Krisman Bertazi <krisman@collabora.com>,
	Lai Jiangshan <laijs@linux.alibaba.com>,
	Huang Rui <ray.huang@amd.com>,
	Yazen Ghannam <yazen.ghannam@amd.com>,
	Kim Phillips <kim.phillips@amd.com>,
	Oleg Nesterov <oleg@redhat.com>, Balbir Singh <sblbir@amazon.com>,
	"David S. Miller" <davem@davemloft.net>,
	sxwjean@me.com, linux-kernel@vger.kernel.org
Subject: [PATCH v2 1/6] mm/util: Assign a meaningful value to mmap_legacy_base
Date: Mon, 11 Oct 2021 22:31:45 +0800	[thread overview]
Message-ID: <20211011143150.318239-2-sxwjean@me.com> (raw)
In-Reply-To: <20211011143150.318239-1-sxwjean@me.com>

From: Xiongwei Song <sxwjean@gmail.com>

Let's assign a value to mmap_legacy_base in case the mmap() of some
archs needs mmap_legacy_base, like x86.

Signed-off-by: Xiongwei Song <sxwjean@gmail.com>
---
 mm/util.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/util.c b/mm/util.c
index e58151a61255..40b1a8837c0b 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -414,7 +414,8 @@ void arch_pick_mmap_layout(struct mm_struct *mm, struct rlimit *rlim_stack)
 		random_factor = arch_mmap_rnd();
 
 	if (mmap_is_legacy(rlim_stack)) {
-		mm->mmap_base = TASK_UNMAPPED_BASE + random_factor;
+		mm->mmap_legacy_base = TASK_UNMAPPED_BASE + random_factor;
+		mm->mmap_base = mm->mmap_legacy_base;
 		mm->get_unmapped_area = arch_get_unmapped_area;
 	} else {
 		mm->mmap_base = mmap_base(random_factor, rlim_stack);
-- 
2.30.2


  reply	other threads:[~2021-10-11 14:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-11 14:31 [PATCH v2 0/6] Use generic code for randomization of virtual address of x86 sxwjean
2021-10-11 14:31 ` sxwjean [this message]
2021-10-11 14:31 ` [PATCH v2 2/6] mm/util: Allow to pass a specific task size when getting mmapping base sxwjean
2021-10-11 14:31 ` [PATCH v2 3/6] mm/util: Support CONFIG_HAVE_ARCH_COMPAT_MMAP_BASES sxwjean
2021-10-11 14:31 ` [PATCH v2 4/6] x86/mm: Randomize VA with generic arch_pick_mmap_layout() sxwjean
2021-10-11 14:31 ` [PATCH v2 5/6] x86/mm: Discard the defination of HAVE_ARCH_PICK_MMAP_LAYOUT sxwjean
2021-10-11 14:31 ` [PATCH v2 6/6] x86/elf: Discard ARCH_HAS_ELF_RANDOMIZE selection sxwjean
2021-10-11 14:43 ` [PATCH v2 0/6] Use generic code for randomization of virtual address of x86 Xiongwei Song
2021-10-15 13:47 ` Xiongwei Song

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=20211011143150.318239-2-sxwjean@me.com \
    --to=sxwjean@me.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=hpa@zytor.com \
    --cc=keescook@chromium.org \
    --cc=kim.phillips@amd.com \
    --cc=krisman@collabora.com \
    --cc=laijs@linux.alibaba.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=ray.huang@amd.com \
    --cc=sblbir@amazon.com \
    --cc=sxwjean@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=viro@zeniv.linux.org.uk \
    --cc=x86@kernel.org \
    --cc=yazen.ghannam@amd.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).