Skip to contentSkip to conversation

openssl: remove lock data_word from x86cpuid.pl

PATCH In review Kinsella, Ray 2 participants 2 messages Sep 17, 2015 – Sep 18, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 openssl: remove lock data_word from x86cpuid.pl

The cmpxchg instruction is encoded in functions such as OPENSSL_atomic_add as a perlasm data_word. This has the effect of hiding the instruction from the assembler. Stripping the LOCK prefix on cmpxchg via the assembler with --momit-lock-prefix=yes then becomes impossible (required on the Intel X1000). This patch converts the data_word into perlasm instructions.

---
 .../openssl/remove-lock-data_word-from-x86cpuid.pl.patch   |   12 ++++++++++++
 meta/recipes-connectivity/openssl/openssl_1.0.2d.bb        |    1 +
 2 files changed, 13 insertions(+)
 create mode 100644 meta/recipes-connectivity/openssl/openssl/remove-lock-data_word-from-x86cpuid.pl.patch
meta/recipes-connectivity/openssl/openssl/remove-lock-data_word-from-x86cpuid.pl.patch new file +12 -0
new file mode 100644
index 0000000..e969e91
@@ -0,0 +1,12 @@
+--- openssl-1.0.2d/crypto/x86cpuid.pl.orig	2015-09-16 21:11:01.927322252 +0100
++++ openssl-1.0.2d/crypto/x86cpuid.pl	2015-09-16 21:14:45.795314992 +0100
+@@ -275,7 +275,8 @@
+ &set_label("spin");
+ 	&lea	("ebx",&DWP(0,"eax","ecx"));
+ 	&nop	();
+-	&data_word(0x1ab10ff0);	# lock;	cmpxchg	%ebx,(%edx)	# %eax is envolved and is always reloaded
++	&lock	();
++	&cmpxchg(&DWP(0,"edx"), "ebx"); # %eax is envolved and is always reloaded
+ 	&jne	(&label("spin"));
+ 	&mov	("eax","ebx");	# OpenSSL expects the new value
+ 	&pop	("ebx");
meta/recipes-connectivity/openssl/openssl_1.0.2d.bb +1 -0
index 32d8dce..de2ec1a 100644
@@ -33,6 +33,7 @@ SRC_URI += "file://configure-targets.patch \
             file://openssl-fix-des.pod-error.patch \
             file://Makefiles-ptest.patch \
             file://ptest-deps.patch \
+            file://remove-lock-data_word-from-x86cpuid.pl.patch \
             file://run-ptest \
             file://crypto_use_bigint_in_x86-64_perl.patch \
             file://openssl-1.0.2a-x32-asm.patch \
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 7 lines · Ray

The cmpxchg instruction is encoded in functions such as OPENSSL_atomic_add as a perlasm data_word. This has the effect of hiding the instruction from the assembler. Stripping the LOCK prefix on cmpxchg via the assembler with --momit-lock-prefix=yes then becomes impossible (required on the Intel X1000).
This patch converts the data_word into perlasm instructions.

Could you resend this following the advice here:
http://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines : mainly the patch file you add needs a message explaining the change as well as headers Upstream-Status & Signed-off-by.

Thanks,
Jussi

Quoted 55 lines
---
 .../openssl/remove-lock-data_word-from-x86cpuid.pl.patch   |   12
++++++++++++
 meta/recipes-connectivity/openssl/openssl_1.0.2d.bb        |    1 +
 2 files changed, 13 insertions(+)
 create mode 100644

meta/recipes-connectivity/openssl/openssl/remove-lock-data_word-from-x86cpuid.pl.patch

diff --git a/meta/recipes-connectivity/openssl/openssl/remove-lock-data_word-from-x86cpuid.pl.patch b/meta/recipes-connectivity/openssl/openssl/remove-lock-data_word-from-x86cpuid.pl.patch new file mode 100644
index 0000000..e969e91
--- /dev/null
+++
b/meta/recipes-connectivity/openssl/openssl/remove-lock-data_word-from-x86cpuid.pl.patch

(quoted diff) +1 -0
@@ -0,0 +1,12 @@
+--- openssl-1.0.2d/crypto/x86cpuid.pl.orig     2015-09-16

21:11:01.927322252 +0100
++++ openssl-1.0.2d/crypto/x86cpuid.pl 2015-09-16 21:14:45.795314992 +0100
+@@ -275,7 +275,8 @@
+ &set_label("spin");

meta/recipes-connectivity/openssl/openssl/remove-lock-data_word-from-x86cpuid.pl.patch new file +3 -0
+       &lea    ("ebx",&DWP(0,"eax","ecx"));
+       &nop    ();
+-      &data_word(0x1ab10ff0); # lock; cmpxchg %ebx,(%edx)     # %eax is

envolved and is always reloaded
++ &lock ();
++ &cmpxchg(&DWP(0,"edx"), "ebx"); # %eax is envolved and is always
reloaded

meta/recipes-connectivity/openssl/openssl/remove-lock-data_word-from-x86cpuid.pl.patch new file +3 -0
+       &jne    (&label("spin"));
+       &mov    ("eax","ebx");  # OpenSSL expects the new value
+       &pop    ("ebx");
meta/recipes-connectivity/openssl/openssl_1.0.2d.bb +1 -1
index 32d8dce..de2ec1a 100644
@@ -33,6 +33,7 @@ SRC_URI += "file://configure-targets.patch \
             file://openssl-fix-des.pod-error.patch \
             file://Makefiles-ptest.patch \
             file://ptest-deps.patch \
+            file://remove-lock-data_word-from-x86cpuid.pl.patch \
             file://run-ptest \
             file://crypto_use_bigint_in_x86-64_perl.patch \
             file://openssl-1.0.2a-x32-asm.patch \
--

1.7.10.4

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core