public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] x86/boot/KASLR: enhance randomness of kernel load addr when using GiB hugepage
@ 2018-09-06  2:36 Pingfan Liu
  2018-09-06  2:36 ` [PATCH 1/3] x86/boot/KASLR: change the prototypes of process_efi_entries/process_e820_entries Pingfan Liu
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Pingfan Liu @ 2018-09-06  2:36 UTC (permalink / raw)
  To: linux-kernel
  Cc: Pingfan Liu, Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
	Kirill A. Shutemov, Baoquan He, Chao Fan, x86

commit 747ff6265db4 ("x86/boot/KASLR: Skip specified number of 1GB huge
pages when doing physical randomization (KASLR)") and commit
9b912485e0e7 ("x86/boot/KASLR: Add two new functions for 1GB huge pages
handling") prevent the physical load addr of kernel from spoiling a good
candidate of GiB page. But the algorithm deterministicly chooses the most
front GiB page for hugetlb, and sacrifices the randomness, which
is the heart of the KASLR. This patch tries to enlarge the randomness in
the cases where hugepages=X < the num Y of good candidate of GiB
page.
To comparison, taking a typical KVM guest for example, the head 3GiB mem
can not be used as GiB hugetlb. Denoting the total mem size as Z(GiB), when
Z=5, then Y=2, assuming X=1, the randomness range before this patch is
4GiB, after this patch is 5GiB, and get a 25% improvement of randomness.
If Z=6, then Y=3, assuming X=2, the improvement equals: 50%( 6/(6-2) - 1);
assuming X=1, the improvement will be: 20% (6/(6-1) - 1)

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Baoquan He <bhe@redhat.com>
Cc: Chao Fan <fanc.fnst@cn.fujitsu.com> (authored:1/16=6%)
Cc: x86@kernel.org

Pingfan Liu (3):
  x86/boot/KASLR: change the prototypes of
    process_efi_entries/process_e820_entries
  x86/boot/KASLR: change the prototype of process_mem_region() to meet
    the align requirement
  x86/boot/KASLR: enhance randomness when using GiB hugepage

 arch/x86/boot/compressed/kaslr.c | 228 ++++++++++++++++++++++++++-------------
 1 file changed, 152 insertions(+), 76 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-09-10  6:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-06  2:36 [PATCH 0/3] x86/boot/KASLR: enhance randomness of kernel load addr when using GiB hugepage Pingfan Liu
2018-09-06  2:36 ` [PATCH 1/3] x86/boot/KASLR: change the prototypes of process_efi_entries/process_e820_entries Pingfan Liu
2018-09-06  2:36 ` [PATCH 2/3] x86/boot/KASLR: change the prototype of process_mem_region() to meet the align requirement Pingfan Liu
2018-09-06  2:36 ` [PATCH 3/3] x86/boot/KASLR: enhance randomness when using GiB hugepage Pingfan Liu
2018-09-06  4:07 ` [PATCH 0/3] x86/boot/KASLR: enhance randomness of kernel load addr " Chao Fan
2018-09-06  5:58   ` Pingfan Liu
2018-09-06 10:00     ` Chao Fan
2018-09-09 23:33 ` Baoquan He
2018-09-10  6:47   ` Pingfan Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox