[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20200916031051.18064-1-miles.chen@mediatek.com>
Date: Wed, 16 Sep 2020 11:10:51 +0800
From: Miles Chen <miles.chen@...iatek.com>
To: Alexey Dobriyan <adobriyan@...il.com>
CC: <linux-kernel@...r.kernel.org>, <linux-fsdevel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-mediatek@...ts.infradead.org>, <wsd_upstream@...iatek.com>,
Miles Chen <miles.chen@...iatek.com>
Subject: [RESEND PATCHv1] proc: use untagged_addr() for pagemap_read addresses
When we try to visit the pagemap of a tagged userspace pointer, we find
that the start_vaddr is not correct because of the tag.
To fix it, we should untag the usespace pointers in pagemap_read().
Signed-off-by: Miles Chen <miles.chen@...iatek.com>
---
fs/proc/task_mmu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 5066b0251ed8..ee0ac09e79fc 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -1541,11 +1541,11 @@ static ssize_t pagemap_read(struct file *file, char __user *buf,
src = *ppos;
svpfn = src / PM_ENTRY_BYTES;
- start_vaddr = svpfn << PAGE_SHIFT;
+ start_vaddr = untagged_addr(svpfn << PAGE_SHIFT);
end_vaddr = mm->task_size;
/* watch out for wraparound */
- if (svpfn > mm->task_size >> PAGE_SHIFT)
+ if (start_vaddr > mm->task_size)
start_vaddr = end_vaddr;
/*
--
2.18.0
Powered by blists - more mailing lists