diff options
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.patch | 67 |
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 @@ | |||
1 | From 5045ea37377ce8cca6890d32b127ad6770e6dce5 Mon Sep 17 00:00:00 2001 | ||
2 | From: Anton Blanchard <anton@samba.org> | ||
3 | Date: Sun, 25 Sep 2016 17:16:53 +1000 | ||
4 | Subject: [PATCH] powerpc/vdso64: Use double word compare on pointers | ||
5 | |||
6 | __kernel_get_syscall_map() and __kernel_clock_getres() use cmpli to | ||
7 | check if the passed in pointer is non zero. cmpli maps to a 32 bit | ||
8 | compare on binutils, so we ignore the top 32 bits. | ||
9 | |||
10 | A simple test case can be created by passing in a bogus pointer with | ||
11 | the bottom 32 bits clear. Using a clk_id that is handled by the VDSO, | ||
12 | then 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 | |||
17 | And we get: | ||
18 | |||
19 | 0 | ||
20 | -1 | ||
21 | |||
22 | The bigger issue is if we pass a valid pointer with the bottom 32 bits | ||
23 | clear, in this case we will return success but won't write any data | ||
24 | to the pointer. | ||
25 | |||
26 | I stumbled across this issue because the LLVM integrated assembler | ||
27 | doesn't accept cmpli with 3 arguments. Fix this by converting them to | ||
28 | cmpldi. | ||
29 | |||
30 | Fixes: a7f290dad32e ("[PATCH] powerpc: Merge vdso's and add vdso support to 32 bits kernel") | ||
31 | Cc: stable@vger.kernel.org # v2.6.15+ | ||
32 | Signed-off-by: Anton Blanchard <anton@samba.org> | ||
33 | Signed-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 | |||
39 | diff --git a/arch/powerpc/kernel/vdso64/datapage.S b/arch/powerpc/kernel/vdso64/datapage.S | ||
40 | index 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 | ||
52 | diff --git a/arch/powerpc/kernel/vdso64/gettimeofday.S b/arch/powerpc/kernel/vdso64/gettimeofday.S | ||
53 | index 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 | -- | ||
66 | 2.7.4 | ||
67 | |||