summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux/linux-qoriq/powerpc-vdso64-Use-double-word-compare-on-pointers.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-kernel/linux/linux-qoriq/powerpc-vdso64-Use-double-word-compare-on-pointers.patch')
-rw-r--r--recipes-kernel/linux/linux-qoriq/powerpc-vdso64-Use-double-word-compare-on-pointers.patch67
1 files changed, 0 insertions, 67 deletions
diff --git a/recipes-kernel/linux/linux-qoriq/powerpc-vdso64-Use-double-word-compare-on-pointers.patch b/recipes-kernel/linux/linux-qoriq/powerpc-vdso64-Use-double-word-compare-on-pointers.patch
deleted file mode 100644
index 9fa40de4..00000000
--- a/recipes-kernel/linux/linux-qoriq/powerpc-vdso64-Use-double-word-compare-on-pointers.patch
+++ /dev/null
@@ -1,67 +0,0 @@
1From 5045ea37377ce8cca6890d32b127ad6770e6dce5 Mon Sep 17 00:00:00 2001
2From: Anton Blanchard <anton@samba.org>
3Date: Sun, 25 Sep 2016 17:16:53 +1000
4Subject: [PATCH] powerpc/vdso64: Use double word compare on pointers
5
6__kernel_get_syscall_map() and __kernel_clock_getres() use cmpli to
7check if the passed in pointer is non zero. cmpli maps to a 32 bit
8compare on binutils, so we ignore the top 32 bits.
9
10A simple test case can be created by passing in a bogus pointer with
11the bottom 32 bits clear. Using a clk_id that is handled by the VDSO,
12then one that is handled by the kernel shows the problem:
13
14 printf("%d\n", clock_getres(CLOCK_REALTIME, (void *)0x100000000));
15 printf("%d\n", clock_getres(CLOCK_BOOTTIME, (void *)0x100000000));
16
17And we get:
18
19 0
20 -1
21
22The bigger issue is if we pass a valid pointer with the bottom 32 bits
23clear, in this case we will return success but won't write any data
24to the pointer.
25
26I stumbled across this issue because the LLVM integrated assembler
27doesn't accept cmpli with 3 arguments. Fix this by converting them to
28cmpldi.
29
30Fixes: a7f290dad32e ("[PATCH] powerpc: Merge vdso's and add vdso support to 32 bits kernel")
31Cc: stable@vger.kernel.org # v2.6.15+
32Signed-off-by: Anton Blanchard <anton@samba.org>
33Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
34---
35 arch/powerpc/kernel/vdso64/datapage.S | 2 +-
36 arch/powerpc/kernel/vdso64/gettimeofday.S | 2 +-
37 2 files changed, 2 insertions(+), 2 deletions(-)
38
39diff --git a/arch/powerpc/kernel/vdso64/datapage.S b/arch/powerpc/kernel/vdso64/datapage.S
40index 184a6ba..abf17fe 100644
41--- a/arch/powerpc/kernel/vdso64/datapage.S
42+++ b/arch/powerpc/kernel/vdso64/datapage.S
43@@ -59,7 +59,7 @@ V_FUNCTION_BEGIN(__kernel_get_syscall_map)
44 bl V_LOCAL_FUNC(__get_datapage)
45 mtlr r12
46 addi r3,r3,CFG_SYSCALL_MAP64
47- cmpli cr0,r4,0
48+ cmpldi cr0,r4,0
49 crclr cr0*4+so
50 beqlr
51 li r0,NR_syscalls
52diff --git a/arch/powerpc/kernel/vdso64/gettimeofday.S b/arch/powerpc/kernel/vdso64/gettimeofday.S
53index a76b4af..3820213 100644
54--- a/arch/powerpc/kernel/vdso64/gettimeofday.S
55+++ b/arch/powerpc/kernel/vdso64/gettimeofday.S
56@@ -145,7 +145,7 @@ V_FUNCTION_BEGIN(__kernel_clock_getres)
57 bne cr0,99f
58
59 li r3,0
60- cmpli cr0,r4,0
61+ cmpldi cr0,r4,0
62 crclr cr0*4+so
63 beqlr
64 lis r5,CLOCK_REALTIME_RES@h
65--
662.7.4
67