[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210401195138.2895285-1-Liam.Howlett@Oracle.com>
Date: Thu, 1 Apr 2021 19:51:48 +0000
From: Liam Howlett <liam.howlett@...cle.com>
To: Richard Henderson <rth@...ddle.net>,
Ivan Kokshaysky <ink@...assic.park.msu.ru>,
Matt Turner <mattst88@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Liam Howlett <liam.howlett@...cle.com>,
"linux-alpha@...r.kernel.org" <linux-alpha@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC: Dmitry Safonov <0x7f454c46@...il.com>,
Michel Lespinasse <walken@...gle.com>,
"Gustavo A . R . Silva" <gustavoars@...nel.org>
Subject: [PATCH] alpha/kernel/traps: Use find_vma_intersection() in traps for
setting si_code
find_vma() will continue to search upwards until the end of the virtual
memory space. This means the si_code would almost never be set to
SEGV_MAPERR even when the address falls outside of any VMA.
Using find_vma_intersection() allows for what is intended by only
returning a VMA if it falls within the range provided, in this case a
window of 1.
Signed-off-by: Liam R. Howlett <Liam.Howlett@...cle.com>
---
arch/alpha/kernel/traps.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/alpha/kernel/traps.c b/arch/alpha/kernel/traps.c
index 921d4b6e4d95..7f51386c06d0 100644
--- a/arch/alpha/kernel/traps.c
+++ b/arch/alpha/kernel/traps.c
@@ -957,8 +957,10 @@ do_entUnaUser(void __user * va, unsigned long opcode,
si_code = SEGV_ACCERR;
else {
struct mm_struct *mm = current->mm;
+ unsigned long addr = (unsigned long)va;
+
mmap_read_lock(mm);
- if (find_vma(mm, (unsigned long)va))
+ if (find_vma_intersection(mm, addr, addr + 1))
si_code = SEGV_ACCERR;
else
si_code = SEGV_MAPERR;
--
2.30.0
Powered by blists - more mailing lists