diff options
| author | Khem Raj <raj.khem@gmail.com> | 2017-06-08 20:41:35 -0700 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-06-12 15:08:31 +0100 |
| commit | b28034878a5686870c13c2ee4f0c0c1c1ddc1902 (patch) | |
| tree | bf6e4d74cef23de246578e88ea7e77bb295b7c8a /meta/recipes-support/rng-tools | |
| parent | 5c9acfbeaa67b3d85e7bb9fd46be445ea179c2fa (diff) | |
| download | poky-b28034878a5686870c13c2ee4f0c0c1c1ddc1902.tar.gz | |
rng-tools: Fix textrels on 32bit x86
When testing core-image-sato with hardening flags, it fails with
SIGSEGV in libc.so during relocation time
This is due to relocations in .text [textrel]
build QA points it out clearly during qemux86 build as well
AssertionError: 2 != 0 : Log: /mnt/a/oe/build/tmp/work/qemux86-bec-linux-musl/core-image-sato/1.0-r0/dmesg_output.log
-----------------------
Central error: [ 19.043597] rngd[525]: segfault at 80098bb7 ip b77b14fc sp bfe9b380 error 7 in libc.so[b774c000+97000]
(From OE-Core rev: 5770cd5bee1c9ad3025435426361f0e407d43ef8)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-support/rng-tools')
| -rw-r--r-- | meta/recipes-support/rng-tools/rng-tools/rng-tools-5-fix-textrels-on-PIC-x86.patch | 104 | ||||
| -rw-r--r-- | meta/recipes-support/rng-tools/rng-tools_5.bb | 1 |
2 files changed, 105 insertions, 0 deletions
diff --git a/meta/recipes-support/rng-tools/rng-tools/rng-tools-5-fix-textrels-on-PIC-x86.patch b/meta/recipes-support/rng-tools/rng-tools/rng-tools-5-fix-textrels-on-PIC-x86.patch new file mode 100644 index 0000000000..90c9d8c515 --- /dev/null +++ b/meta/recipes-support/rng-tools/rng-tools/rng-tools-5-fix-textrels-on-PIC-x86.patch | |||
| @@ -0,0 +1,104 @@ | |||
| 1 | From: Francisco Blas Izquierdo Riera (klondike) <klondike@gentoo.org> | ||
| 2 | Subject: [PATCH] Fix assemby textrels on rdrand_asm.S on PIC x86 | ||
| 3 | |||
| 4 | This patch updates the fixes in the assembly in rdrand_asm.S in | ||
| 5 | sys-apps/rng-tools-5 so it won't generate textrels on PIC systems. | ||
| 6 | The main fixes are in the use of leal in SETPTR for such systems, the rest is | ||
| 7 | the usual PIC support stuff. | ||
| 8 | |||
| 9 | This should fix Gentoo bug #469962 and help fix #518210 | ||
| 10 | |||
| 11 | This patch is released under the GPLv2 or a higher version license as is the | ||
| 12 | original file as long as the author and the tester are credited. | ||
| 13 | |||
| 14 | Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=469962 | ||
| 15 | Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=518210 | ||
| 16 | Upstream-status: Not sent yet | ||
| 17 | Signed-off-by: Francisco Blas Izquierdo Riera (klondike) <klondike@gentoo.org> | ||
| 18 | Reported-by: cilly <cilly@cilly.mine.nu> | ||
| 19 | Reported-by: Manuel RĂ¼ger <mrueg@gentoo.org> | ||
| 20 | Tested-by: Anthony Basile <blueness@gentoo.org> | ||
| 21 | |||
| 22 | Upstream-Status: Pending | ||
| 23 | |||
| 24 | Index: rng-tools-5/rdrand_asm.S | ||
| 25 | =================================================================== | ||
| 26 | --- rng-tools-5.orig/rdrand_asm.S | ||
| 27 | +++ rng-tools-5/rdrand_asm.S | ||
| 28 | @@ -2,6 +2,7 @@ | ||
| 29 | * Copyright (c) 2011-2014, Intel Corporation | ||
| 30 | * Authors: Fenghua Yu <fenghua.yu@intel.com>, | ||
| 31 | * H. Peter Anvin <hpa@linux.intel.com> | ||
| 32 | + * PIC code by: Francisco Blas Izquierdo Riera (klondike) <klondike@gentoo.org> | ||
| 33 | * | ||
| 34 | * This program is free software; you can redistribute it and/or modify it | ||
| 35 | * under the terms and conditions of the GNU General Public License, | ||
| 36 | @@ -174,7 +175,19 @@ ENTRY(x86_rdseed_or_rdrand_bytes) | ||
| 37 | jmp 4b | ||
| 38 | ENDPROC(x86_rdseed_or_rdrand_bytes) | ||
| 39 | |||
| 40 | +#if defined(__PIC__) | ||
| 41 | +#define INIT_PIC() \ | ||
| 42 | + pushl %ebx ; \ | ||
| 43 | + call __x86.get_pc_thunk.bx ; \ | ||
| 44 | + addl $_GLOBAL_OFFSET_TABLE_, %ebx | ||
| 45 | +#define END_PIC() \ | ||
| 46 | + popl %ebx | ||
| 47 | +#define SETPTR(var,ptr) leal (var)@GOTOFF(%ebx),ptr | ||
| 48 | +#else | ||
| 49 | +#define INIT_PIC() | ||
| 50 | +#define END_PIC() | ||
| 51 | #define SETPTR(var,ptr) movl $(var),ptr | ||
| 52 | +#endif | ||
| 53 | #define PTR0 %eax | ||
| 54 | #define PTR1 %edx | ||
| 55 | #define PTR2 %ecx | ||
| 56 | @@ -190,6 +203,7 @@ ENTRY(x86_aes_mangle) | ||
| 57 | movl 8(%ebp), %eax | ||
| 58 | movl 12(%ebp), %edx | ||
| 59 | push %esi | ||
| 60 | + INIT_PIC() | ||
| 61 | #endif | ||
| 62 | movl $512, CTR3 /* Number of rounds */ | ||
| 63 | |||
| 64 | @@ -280,6 +294,7 @@ offset = offset + 16 | ||
| 65 | movdqa %xmm7, (7*16)(PTR1) | ||
| 66 | |||
| 67 | #ifdef __i386__ | ||
| 68 | + END_PIC() | ||
| 69 | pop %esi | ||
| 70 | pop %ebp | ||
| 71 | #endif | ||
| 72 | @@ -294,6 +309,7 @@ ENTRY(x86_aes_expand_key) | ||
| 73 | push %ebp | ||
| 74 | mov %esp, %ebp | ||
| 75 | movl 8(%ebp), %eax | ||
| 76 | + INIT_PIC() | ||
| 77 | #endif | ||
| 78 | |||
| 79 | SETPTR(aes_round_keys, PTR1) | ||
| 80 | @@ -323,6 +339,7 @@ ENTRY(x86_aes_expand_key) | ||
| 81 | call 1f | ||
| 82 | |||
| 83 | #ifdef __i386__ | ||
| 84 | + END_PIC() | ||
| 85 | pop %ebp | ||
| 86 | #endif | ||
| 87 | ret | ||
| 88 | @@ -343,6 +360,16 @@ ENTRY(x86_aes_expand_key) | ||
| 89 | |||
| 90 | ENDPROC(x86_aes_expand_key) | ||
| 91 | |||
| 92 | +#if defined(__i386__) && defined(__PIC__) | ||
| 93 | + .section .text.__x86.get_pc_thunk.bx,"axG",@progbits,__x86.get_pc_thunk.bx,comdat | ||
| 94 | + .globl __x86.get_pc_thunk.bx | ||
| 95 | + .hidden __x86.get_pc_thunk.bx | ||
| 96 | + .type __x86.get_pc_thunk.bx, @function | ||
| 97 | +__x86.get_pc_thunk.bx: | ||
| 98 | + movl (%esp), %ebx | ||
| 99 | + ret | ||
| 100 | +#endif | ||
| 101 | + | ||
| 102 | .bss | ||
| 103 | .balign 64 | ||
| 104 | aes_round_keys: | ||
diff --git a/meta/recipes-support/rng-tools/rng-tools_5.bb b/meta/recipes-support/rng-tools/rng-tools_5.bb index 9329e8ad31..e2acaba91a 100644 --- a/meta/recipes-support/rng-tools/rng-tools_5.bb +++ b/meta/recipes-support/rng-tools/rng-tools_5.bb | |||
| @@ -7,6 +7,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/gkernel/${BP}.tar.gz \ | |||
| 7 | file://0002-Add-argument-to-control-the-libargp-dependency.patch \ | 7 | file://0002-Add-argument-to-control-the-libargp-dependency.patch \ |
| 8 | file://underquote.patch \ | 8 | file://underquote.patch \ |
| 9 | file://uclibc-libuargp-configure.patch \ | 9 | file://uclibc-libuargp-configure.patch \ |
| 10 | file://rng-tools-5-fix-textrels-on-PIC-x86.patch \ | ||
| 10 | file://init \ | 11 | file://init \ |
| 11 | file://default" | 12 | file://default" |
| 12 | 13 | ||
