Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1661628
| From | Ard Biesheuvel <ard.biesheuvel@linaro.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 1/2] fs/proc: kcore: use kcore_list type to check for vmalloc/module address |
| Date | 2017-06-08 21:50 +0200 |
| Message-ID | <tQbBo-8th-31@gated-at.bofh.it> (permalink) |
| References | <tQbBn-8th-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Instead of passing each start address into is_vmalloc_or_module_addr()
to decide whether it falls into either the VMALLOC or the MODULES region,
we can simply check the type field of the current kcore_list entry, since
it will be set to KCORE_VMALLOC based on exactly the same conditions.
As a bonus, when reading the KCORE_TEXT region on architectures that have
one, this will avoid using vread() on the region if it happens to intersect
with a KCORE_VMALLOC region. This is due the fact that the KCORE_TEXT
region is the first one to be added to the kcore region list.
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
fs/proc/kcore.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c
index 4ee55274f155..45629f4b5402 100644
--- a/fs/proc/kcore.c
+++ b/fs/proc/kcore.c
@@ -504,7 +504,7 @@ read_kcore(struct file *file, char __user *buffer, size_t buflen, loff_t *fpos)
if (&m->list == &kclist_head) {
if (clear_user(buffer, tsz))
return -EFAULT;
- } else if (is_vmalloc_or_module_addr((void *)start)) {
+ } else if (m->type == KCORE_VMALLOC) {
vread(buf, (char *)start, tsz);
/* we have to zero-fill user buffer even if no read */
if (copy_to_user(buffer, buf, tsz))
--
2.9.3
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/2] arm64: fix crash when reading /proc/kcore Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2017-06-08 21:50 +0200
[PATCH 1/2] fs/proc: kcore: use kcore_list type to check for vmalloc/module address Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2017-06-08 21:50 +0200
Re: [PATCH 0/2] arm64: fix crash when reading /proc/kcore Mark Rutland <mark.rutland@arm.com> - 2017-06-09 12:10 +0200
Re: [PATCH 0/2] arm64: fix crash when reading /proc/kcore Laura Abbott <labbott@redhat.com> - 2017-06-09 20:10 +0200
Re: [PATCH 0/2] arm64: fix crash when reading /proc/kcore Tan Xiaojun <tanxiaojun@huawei.com> - 2017-06-13 04:10 +0200
Re: [PATCH 0/2] arm64: fix crash when reading /proc/kcore Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2017-06-13 09:20 +0200
Re: [PATCH 0/2] arm64: fix crash when reading /proc/kcore Jiri Olsa <jolsa@redhat.com> - 2017-06-13 16:10 +0200
csiph-web