LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: akpm@linux-foundation.org
Cc: "Kees Cook" <keescook@chromium.org>,
"Russell King" <linux@arm.linux.org.uk>,
"Catalin Marinas" <catalin.marinas@arm.com>,
"Will Deacon" <will.deacon@arm.com>,
"Ralf Baechle" <ralf@linux-mips.org>,
"Benjamin Herrenschmidt" <benh@kernel.crashing.org>,
"Paul Mackerras" <paulus@samba.org>,
"Michael Ellerman" <mpe@ellerman.id.au>,
"Martin Schwidefsky" <schwidefsky@de.ibm.com>,
"Heiko Carstens" <heiko.carstens@de.ibm.com>,
linux390@de.ibm.com, x86@kernel.org,
"Alexander Viro" <viro@zeniv.linux.org.uk>,
"Oleg Nesterov" <oleg@redhat.com>,
"Andy Lutomirski" <luto@amacapital.net>,
"David A. Long" <dave.long@linaro.org>,
"Andrey Ryabinin" <a.ryabinin@samsung.com>,
"Arun Chandran" <achandran@mvista.com>,
"Yann Droneaud" <ydroneaud@opteya.com>,
"Min-Hua Chen" <orca.chen@gmail.com>,
"Paul Burton" <paul.burton@imgtec.com>,
"Alex Smith" <alex@alex-smith.me.uk>,
"Markos Chandras" <markos.chandras@imgtec.com>,
"Vineeth Vijayan" <vvijayan@mvista.com>,
"Jeff Bailey" <jeffbailey@google.com>,
"Michael Holzheu" <holzheu@linux.vnet.ibm.com>,
"Ben Hutchings" <ben@decadent.org.uk>,
"Behan Webster" <behanw@converseincode.com>,
"Ismael Ripoll" <iripoll@upv.es>,
"Hector Marco-Gisbert" <hecmargi@upv.es>,
"Jan-Simon Möller" <dl9pf@gmx.de>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, linux-mips@linux-mips.org,
linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org,
linux-fsdevel@vger.kernel.org
Subject: [PATCH 1/5] arm: factor out mmap ASLR into mmap_rnd
Date: Thu, 26 Feb 2015 19:07:10 -0800 [thread overview]
Message-ID: <1425006434-3106-2-git-send-email-keescook@chromium.org> (raw)
In-Reply-To: <1425006434-3106-1-git-send-email-keescook@chromium.org>
Move logic for mmap ASLR into separate function.
Signed-off-by: Kees Cook <keescook@chromium.org>
---
arch/arm/mm/mmap.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c
index 5e85ed371364..0f8bc158f2c6 100644
--- a/arch/arm/mm/mmap.c
+++ b/arch/arm/mm/mmap.c
@@ -169,14 +169,21 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
return addr;
}
-void arch_pick_mmap_layout(struct mm_struct *mm)
+static unsigned long mmap_rnd(void)
{
- unsigned long random_factor = 0UL;
+ unsigned long rnd = 0UL;
/* 8 bits of randomness in 20 address space bits */
if ((current->flags & PF_RANDOMIZE) &&
!(current->personality & ADDR_NO_RANDOMIZE))
- random_factor = (get_random_int() % (1 << 8)) << PAGE_SHIFT;
+ rnd = (get_random_int() % (1 << 8)) << PAGE_SHIFT;
+
+ return rnd;
+}
+
+void arch_pick_mmap_layout(struct mm_struct *mm)
+{
+ unsigned long random_factor = mmap_rnd();
if (mmap_is_legacy()) {
mm->mmap_base = TASK_UNMAPPED_BASE + random_factor;
--
1.9.1
next prev parent reply other threads:[~2015-02-27 3:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-27 3:07 [PATCH 0/5] split ET_DYN ASLR from mmap ASLR Kees Cook
2015-02-27 3:07 ` Kees Cook [this message]
2015-02-27 3:07 ` [PATCH 2/5] mm: expose arch_mmap_rnd when available Kees Cook
2015-02-27 3:07 ` [PATCH 3/5] mm: move randomize_et_dyn into ELF_ET_DYN_BASE Kees Cook
2015-02-27 3:07 ` [PATCH 4/5] mm: split ET_DYN ASLR from mmap ASLR Kees Cook
2015-02-27 3:07 ` [PATCH 5/5] mm: fold arch_randomize_brk into ARCH_HAS_ELF_RANDOMIZE Kees Cook
2015-02-27 6:19 ` [PATCH 0/5] split ET_DYN ASLR from mmap ASLR Ingo Molnar
2015-03-02 21:26 ` Andrew Morton
2015-03-02 22:22 ` Kees Cook
2015-03-03 0:19 [PATCH v2 " Kees Cook
2015-03-03 0:19 ` [PATCH 1/5] arm: factor out mmap ASLR into mmap_rnd Kees Cook
2015-03-09 14:48 ` Russell King - ARM Linux
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=1425006434-3106-2-git-send-email-keescook@chromium.org \
--to=keescook@chromium.org \
--cc=a.ryabinin@samsung.com \
--cc=achandran@mvista.com \
--cc=akpm@linux-foundation.org \
--cc=alex@alex-smith.me.uk \
--cc=behanw@converseincode.com \
--cc=ben@decadent.org.uk \
--cc=benh@kernel.crashing.org \
--cc=catalin.marinas@arm.com \
--cc=dave.long@linaro.org \
--cc=dl9pf@gmx.de \
--cc=hecmargi@upv.es \
--cc=heiko.carstens@de.ibm.com \
--cc=holzheu@linux.vnet.ibm.com \
--cc=iripoll@upv.es \
--cc=jeffbailey@google.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux390@de.ibm.com \
--cc=linux@arm.linux.org.uk \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=luto@amacapital.net \
--cc=markos.chandras@imgtec.com \
--cc=mpe@ellerman.id.au \
--cc=oleg@redhat.com \
--cc=orca.chen@gmail.com \
--cc=paul.burton@imgtec.com \
--cc=paulus@samba.org \
--cc=ralf@linux-mips.org \
--cc=schwidefsky@de.ibm.com \
--cc=viro@zeniv.linux.org.uk \
--cc=vvijayan@mvista.com \
--cc=will.deacon@arm.com \
--cc=x86@kernel.org \
--cc=ydroneaud@opteya.com \
--subject='Re: [PATCH 1/5] arm: factor out mmap ASLR into mmap_rnd' \
/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
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).