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-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 04 Feb 2019 10:15:40 -0800
From:   Alexander Duyck <alexander.duyck@...il.com>
To:     linux-mm@...ck.org, linux-kernel@...r.kernel.org,
        kvm@...r.kernel.org
Cc:     rkrcmar@...hat.com, alexander.h.duyck@...ux.intel.com,
        x86@...nel.org, mingo@...hat.com, bp@...en8.de, hpa@...or.com,
        pbonzini@...hat.com, tglx@...utronix.de, akpm@...ux-foundation.org
Subject: [RFC PATCH 1/4] madvise: Expose ability to set dontneed from kernel

From: Alexander Duyck <alexander.h.duyck@...ux.intel.com>

In order to enable a KVM hypervisor to notify the host that a guest has
freed its pages we will need to have a mechanism to update the virtual
memory associated with the guest. In order to expose this functionality I
am adding a new function do_madvise_dontneed that can be used to indicate
a region that a given VM is done with.

Signed-off-by: Alexander Duyck <alexander.h.duyck@...ux.intel.com>
---
 include/linux/mm.h |    2 ++
 mm/madvise.c       |   13 ++++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index e04396375cf9..eb668a5b4b4f 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -2840,5 +2840,7 @@ static inline bool page_is_guard(struct page *page)
 static inline void setup_nr_node_ids(void) {}
 #endif
 
+int do_madvise_dontneed(unsigned long start, size_t len_in);
+
 #endif /* __KERNEL__ */
 #endif /* _LINUX_MM_H */
diff --git a/mm/madvise.c b/mm/madvise.c
index 21a7881a2db4..8730f7e0081a 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -799,7 +799,7 @@ static int madvise_inject_error(int behavior,
  *  -EBADF  - map exists, but area maps something that isn't a file.
  *  -EAGAIN - a kernel resource was temporarily unavailable.
  */
-SYSCALL_DEFINE3(madvise, unsigned long, start, size_t, len_in, int, behavior)
+static int do_madvise(unsigned long start, size_t len_in, int behavior)
 {
 	unsigned long end, tmp;
 	struct vm_area_struct *vma, *prev;
@@ -894,3 +894,14 @@ static int madvise_inject_error(int behavior,
 
 	return error;
 }
+
+SYSCALL_DEFINE3(madvise, unsigned long, start, size_t, len_in, int, behavior)
+{
+	return do_madvise(start, len_in, behavior);
+}
+
+int do_madvise_dontneed(unsigned long start, size_t len_in)
+{
+	return do_madvise(start, len_in, MADV_DONTNEED);
+}
+EXPORT_SYMBOL_GPL(do_madvise_dontneed);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ