lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20160812141838.5973-1-ronit.crj@gmail.com>
Date:	Fri, 12 Aug 2016 19:48:38 +0530
From:	Ronit Halder <ronit.crj@...il.com>
To:	linux-kernel@...r.kernel.org
Cc:	tglx@...utronix.de, mingo@...hat.com, hpa@...or.com, bp@...e.de,
	dyoung@...hat.com, jroedel@...e.de, krzysiek@...lesie.net,
	msalter@...hat.com, ebiederm@...ssion.com,
	akpm@...ux-foundation.org, bhe@...hat.com, vgoyal@...hat.com,
	mnfhuang@...il.com, kexec@...ts.infradead.org,
	kirill.shutemov@...ux.intel.com, mchehab@....samsung.com,
	aarcange@...hat.com, vdavydov@...allels.com,
	dan.j.williams@...el.com, jack@...e.cz, linux-mm@...ck.org,
	Ronit Halder <ronit.crj@...il.com>
Subject: [RFC 0/4] Kexec: Enable run time memory resrvation of crash kernel

Currenty linux kernel reserves memory at the boot time for crash kernel.
It will be very useful if we can reserve memory in run time. The user can 
reserve the memory whenerver needed instead of reserving at the boot time.

It is possible to reserve memory for crash kernel at the run time using
CMA (Contiguous Memory Allocator). CMA is capable of allocating big chunk 
of memory. At the boot time we will create one (if only low memory is used)
or two (if we use both high memory in case of x86_64) CMA areas of size 
given in "crashkernel" boot time command line parameter. This memory in CMA
areas can be used as movable pages (used for disk caches, process pages
etc) if not allocated. Then the user can reserve or free memory from those
CMA areas using "/sys/kernel/kexec_crash_size" sysfs entry. If the user
uses high memory it will automatically at least 256MB low memory
(needed for swiotlb and DMA buffers) when the user allocates memory using
mentioned sysfs enrty. In case of high memory reservation the user controls
the size of reserved region in high memory with
"/sys/kernel/kexec_crash_size" entry. If the size set is zero then the 
memory allocated in low memory will automatically be freed.

As the pages under CMA area (when not allocated by CMA) can only be used by
movable pages. The pages won't be used for DMA. So, after allocating pages
from CMA area for loading the crash kernel, there won't be any chance of
DMA on the memory.

Thus is a prototype patch. Please share your opinions on my approach. This
patch is only for x86 and x86_64. Please note, this patch is only a
prototype just to explain my approach and get the review. This patch is on
kernel version v4.4.11.

CMA depends on page migration and only uses movable pages. But, the movable
pages become unmovable momentarily for pinning. The CMA fails for this
reason. I don't have any solution for that right now. This approach will
work when the this problems with CMA will be fixed. The patch is enabled
by a kernel configuration option CONFIG_KEXEC_CMA.

Ronit Halder (4):
  Creating one or two CMA area at Boot time
  Functions for memory reservation and release
  Adding a new kernel configuration to enable the feature
  Enable memory allocation through sysfs interface

 arch/x86/kernel/setup.c | 44 ++++++++++++++++++++++++--
 include/linux/kexec.h   | 11 ++++++-
 kernel/kexec_core.c     | 83 +++++++++++++++++++++++++++++++++++++++++++++++++
 kernel/ksysfs.c         | 23 +++++++++++++-
 mm/Kconfig              |  6 ++++
 5 files changed, 162 insertions(+), 5 deletions(-)

-- 
2.9.0.GIT

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ