* [merged] mm-memoryc-make-remap_pfn_range-reject-unaligned-addr.patch removed from -mm tree
@ 2020-08-10 2:37 akpm
0 siblings, 0 replies; only message in thread
From: akpm @ 2020-08-10 2:37 UTC (permalink / raw)
To: akpm, mm-commits, zhangalex
The patch titled
Subject: mm/memory.c: make remap_pfn_range() reject unaligned addr
has been removed from the -mm tree. Its filename was
mm-memoryc-make-remap_pfn_range-reject-unaligned-addr.patch
This patch was dropped because it was merged into mainline or a subsystem tree
------------------------------------------------------
From: Alex Zhang <zhangalex@google.com>
Subject: mm/memory.c: make remap_pfn_range() reject unaligned addr
This function implicitly assumes that the addr passed in is page aligned.
A non page aligned addr could ultimately cause a kernel bug in
remap_pte_range as the exit condition in the logic loop may never be
satisfied. This patch documents the need for the requirement, as well as
explicitly adds a check for it.
Link: http://lkml.kernel.org/r/20200617233512.177519-1-zhangalex@google.com
Signed-off-by: Alex Zhang <zhangalex@google.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/memory.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
--- a/mm/memory.c~mm-memoryc-make-remap_pfn_range-reject-unaligned-addr
+++ a/mm/memory.c
@@ -2082,7 +2082,7 @@ static inline int remap_p4d_range(struct
/**
* remap_pfn_range - remap kernel memory to userspace
* @vma: user vma to map to
- * @addr: target user address to start at
+ * @addr: target page aligned user address to start at
* @pfn: page frame number of kernel physical memory address
* @size: size of mapping area
* @prot: page protection flags for this mapping
@@ -2101,6 +2101,9 @@ int remap_pfn_range(struct vm_area_struc
unsigned long remap_pfn = pfn;
int err;
+ if (WARN_ON_ONCE(!PAGE_ALIGNED(addr)))
+ return -EINVAL;
+
/*
* Physically remapped pages are special. Tell the
* rest of the world about it:
_
Patches currently in -mm which might be from zhangalex@google.com are
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-08-10 2:37 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-10 2:37 [merged] mm-memoryc-make-remap_pfn_range-reject-unaligned-addr.patch removed from -mm tree akpm
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).