summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorJunxiao Bi <junxiao.bi@oracle.com>2012-08-22 10:21:07 +0800
committerWilly Tarreau <w@1wt.eu>2012-10-07 23:37:14 +0200
commit2f42878e56a734563c5e2aadee6e334477500cdf (patch)
tree044b671587aaf7bef24e41acf1e8818bf610b545 /arch
parent012660d6b30072633c89033d2b3e18a9a861ae3d (diff)
oprofile: use KM_NMI slot for kmap_atomic
If one kernel path is using KM_USER0 slot and is interrupted by the oprofile nmi, then in copy_from_user_nmi(), the KM_USER0 slot will be overwrite and cleared to zero at last, when the control return to the original kernel path, it will access an invalid virtual address and trigger a crash. Cc: Robert Richter <robert.richter@amd.com> Cc: Greg KH <gregkh@linuxfoundation.org> Cc: stable@vger.kernel.org Signed-off-by: Junxiao Bi <junxiao.bi@oracle.com> [WT: According to Junxiao and Robert, this patch is needed for stable kernels which include a backport of a0e3e70243f5b270bc3eca718f0a9fa5e6b8262e without 3e4d3af501cccdc8a8cca41bdbe57d54ad7e7e73, but there is no exact equivalent in mainline] Signed-off-by: Willy Tarreau <w@1wt.eu>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/oprofile/backtrace.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/x86/oprofile/backtrace.c b/arch/x86/oprofile/backtrace.c
index 829edf0642c4..b50a2802e31f 100644
--- a/arch/x86/oprofile/backtrace.c
+++ b/arch/x86/oprofile/backtrace.c
@@ -71,9 +71,9 @@ copy_from_user_nmi(void *to, const void __user *from, unsigned long n)
offset = addr & (PAGE_SIZE - 1);
size = min(PAGE_SIZE - offset, n - len);
- map = kmap_atomic(page, KM_USER0);
+ map = kmap_atomic(page, KM_NMI);
memcpy(to, map+offset, size);
- kunmap_atomic(map, KM_USER0);
+ kunmap_atomic(map, KM_NMI);
put_page(page);
len += size;