Update the textrel patch for x86

- update the PIC patch for iaesx86.s to not use ELF relocations
  (RT#7815, #1045699) to the version that landed upstream
This commit is contained in:
Nalin Dahyabhai 2014-01-13 11:40:31 -05:00
parent 8fe7e82068
commit aef7c262b1
2 changed files with 33 additions and 57 deletions

View File

@ -1,70 +1,42 @@
--- krb5-1.12/src/lib/crypto/builtin/aes/iaesx86.s commit 3847aa109e8ff3f2781d53315f81e8d29ee35892
+++ krb5-1.12/src/lib/crypto/builtin/aes/iaesx86.s Author: Tom Yu <tlyu@mit.edu>
@@ -256,6 +256,7 @@ DD 0 Date: Fri Jan 10 15:04:32 2014 -0500
section .text
Avoid text relocations in iaesx86.s
+extern _GLOBAL_OFFSET_TABLE_ Use PC-relative addressing to avoid runtime text relocations on i386.
align 16 Adapted patch from Nalin Dahyabhai.
key_expansion256:
@@ -318,12 +319,18 @@ _iEncExpandKey128: ticket: 7815
target_version: 1.12.1
mov ecx,[esp-4+8] ;input tags: pullup
mov edx,[esp-4+12] ;ctx
+ push ebx diff --git a/src/lib/crypto/builtin/aes/iaesx86.s b/src/lib/crypto/builtin/aes/iaesx86.s
index 1aa12e6..33470dd 100644
movdqu xmm1, [ecx] ; loading the key --- a/src/lib/crypto/builtin/aes/iaesx86.s
+++ b/src/lib/crypto/builtin/aes/iaesx86.s
@@ -323,7 +323,10 @@ _iEncExpandKey128:
movdqu [edx], xmm1 movdqu [edx], xmm1
- movdqa xmm5, [shuffle_mask] - movdqa xmm5, [shuffle_mask]
+ call .get_GOT + call .next
+.get_GOT: +.next:
+ pop ebx + pop ecx
+ add ebx,_GLOBAL_OFFSET_TABLE_+$$-.get_GOT wrt ..gotpc + movdqa xmm5, [ecx-.next+shuffle_mask]
+
+ movdqa xmm5, [ebx+shuffle_mask wrt ..gotoff]
add edx,16 add edx,16
@@ -348,6 +355,8 @@ _iEncExpandKey128: @@ -421,7 +424,10 @@ _iEncExpandKey256:
aeskeygenassist xmm2, xmm1, 0x36 ; Generating round key 10
call key_expansion128
+ pop ebx
+
ret
@@ -412,6 +421,7 @@ global _iEncExpandKey256
_iEncExpandKey256:
mov ecx, [esp-4+8] ;input
mov edx, [esp-4+12] ;expanded key
+ push ebx
movdqu xmm1, [ecx] ; loading the key
@@ -421,7 +431,12 @@ _iEncExpandKey256:
add edx,32 add edx,32
- movdqa xmm5, [shuffle_mask] ; this mask is used by key_expansion - movdqa xmm5, [shuffle_mask] ; this mask is used by key_expansion
+ call .get_GOT + call .next
+.get_GOT: +.next:
+ pop ebx + pop ecx
+ add ebx,_GLOBAL_OFFSET_TABLE_+$$-.get_GOT wrt ..gotpc + movdqa xmm5, [ecx-.next+shuffle_mask] ; this mask is used by key_expansion
+
+ movdqa xmm5, [ebx+shuffle_mask wrt ..gotoff] ; this mask is used by key_expansion
aeskeygenassist xmm2, xmm3, 0x1 ; aeskeygenassist xmm2, xmm3, 0x1 ;
call key_expansion256 call key_expansion256
@@ -452,6 +467,8 @@ _iEncExpandKey256:
movdqu [edx], xmm1
+ pop ebx
+
ret

View File

@ -41,7 +41,7 @@
Summary: The Kerberos network authentication system Summary: The Kerberos network authentication system
Name: krb5 Name: krb5
Version: 1.12 Version: 1.12
Release: 10%{?dist} Release: 11%{?dist}
# Maybe we should explode from the now-available-to-everybody tarball instead? # Maybe we should explode from the now-available-to-everybody tarball instead?
# http://web.mit.edu/kerberos/dist/krb5/1.12/krb5-1.12-signed.tar # http://web.mit.edu/kerberos/dist/krb5/1.12/krb5-1.12-signed.tar
Source0: krb5-%{version}.tar.gz Source0: krb5-%{version}.tar.gz
@ -978,6 +978,10 @@ exit 0
%{_sbindir}/uuserver %{_sbindir}/uuserver
%changelog %changelog
* Mon Jan 13 2014 Nalin Dahyabhai <nalin@redhat.com> - 1.12-11
- update the PIC patch for iaesx86.s to not use ELF relocations to the version
that landed upstream (RT#7815, #1045699)
* Thu Jan 9 2014 Nalin Dahyabhai <nalin@redhat.com> * Thu Jan 9 2014 Nalin Dahyabhai <nalin@redhat.com>
- pass -Wl,--warn-shared-textrel to the compiler when we're creating shared - pass -Wl,--warn-shared-textrel to the compiler when we're creating shared
libraries libraries