Fix register overwite in JIT when SSE2 acceleration is enabled

This commit is contained in:
Petr Písař 2016-07-04 09:57:13 +02:00
parent bd5df3f8c3
commit 61dbf8dc77
3 changed files with 129 additions and 0 deletions

View File

@ -0,0 +1,56 @@
From 7490ab47a6b597a4724b961a1987300809d0bef1 Mon Sep 17 00:00:00 2001
From: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Sat, 2 Jul 2016 15:52:30 +0000
Subject: [PATCH] Additional test for recent JIT bugfix.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@540 6239d852-aaf2-0410-a92c-79f79f948069
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
testdata/testinput17 | 8 ++++++++
testdata/testoutput17 | 10 ++++++++++
2 files changed, 18 insertions(+)
diff --git a/testdata/testinput17 b/testdata/testinput17
index f1bf25f..90c0a09 100644
--- a/testdata/testinput17
+++ b/testdata/testinput17
@@ -288,5 +288,13 @@
/abc/jitfast
abc
abc\=no_jit
+
+# ----
+
+/[aC]/mg,firstline
+match\nmatch
+
+/[aCz]/mg,firstline
+match\nmatch
# End of testinput17
diff --git a/testdata/testoutput17 b/testdata/testoutput17
index 36509c8..60fe20b 100644
--- a/testdata/testoutput17
+++ b/testdata/testoutput17
@@ -530,5 +530,15 @@ Failed: error -47: match limit exceeded
0: abc (JIT)
abc\=no_jit
0: abc (JIT)
+
+# ----
+
+/[aC]/mg,firstline
+match\nmatch
+ 0: a (JIT)
+
+/[aCz]/mg,firstline
+match\nmatch
+ 0: a (JIT)
# End of testinput17
--
2.5.5

View File

@ -0,0 +1,64 @@
From 987102fcb0b726a1f29c9ed3e52c3839ebe372cd Mon Sep 17 00:00:00 2001
From: zherczeg <zherczeg@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Fri, 1 Jul 2016 08:56:59 +0000
Subject: [PATCH] Fix register overwite in JIT when SSE2 acceleration is
enabled.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@539 6239d852-aaf2-0410-a92c-79f79f948069
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
ChangeLog | 2 ++
src/pcre2_jit_compile.c | 4 ++--
src/pcre2_jit_test.c | 1 +
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 6b8b9a4..47f5835 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -166,6 +166,8 @@ it fails when running the interpreter with a 16M stack (and if changing the
stack size via pcre2test is possible). This avoids having to manually set a
large stack size when testing with clang.
+42. Fix register overwite in JIT when SSE2 acceleration is enabled.
+
Version 10.21 12-January-2016
-----------------------------
diff --git a/src/pcre2_jit_compile.c b/src/pcre2_jit_compile.c
index c98f977..8dea90a 100644
--- a/src/pcre2_jit_compile.c
+++ b/src/pcre2_jit_compile.c
@@ -4027,12 +4027,12 @@ sljit_emit_op_custom(compiler, instruction, 4);
if (load_twice)
{
- OP1(SLJIT_MOV, TMP3, 0, TMP2, 0);
+ OP1(SLJIT_MOV, RETURN_ADDR, 0, TMP2, 0);
instruction[3] = 0xc0 | (tmp2_ind << 3) | 1;
sljit_emit_op_custom(compiler, instruction, 4);
OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);
- OP1(SLJIT_MOV, TMP2, 0, TMP3, 0);
+ OP1(SLJIT_MOV, TMP2, 0, RETURN_ADDR, 0);
}
OP2(SLJIT_ASHR, TMP1, 0, TMP1, 0, TMP2, 0);
diff --git a/src/pcre2_jit_test.c b/src/pcre2_jit_test.c
index dfe0032..705ba18 100644
--- a/src/pcre2_jit_test.c
+++ b/src/pcre2_jit_test.c
@@ -692,6 +692,7 @@ static struct regression_test_case regression_test_cases[] = {
{ PCRE2_FIRSTLINE | PCRE2_DOTALL, PCRE2_NEWLINE_LF, 0, 0 | F_NOMATCH, "ab.", "ab" },
{ MU | PCRE2_FIRSTLINE, A, 0, 1 | F_NOMATCH, "^[a-d0-9]", "\nxx\nd" },
{ PCRE2_FIRSTLINE | PCRE2_DOTALL, PCRE2_NEWLINE_ANY, 0, 0, "....a", "012\n0a" },
+ { MU | PCRE2_FIRSTLINE, A, 0, 0, "[aC]", "a" },
/* Recurse. */
{ MU, A, 0, 0, "(a)(?1)", "aa" },
--
2.5.5

View File

@ -21,6 +21,12 @@ URL: http://www.pcre.org/
Source: ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/%{?rcversion:Testing/}%{name}-%{myversion}.tar.bz2 Source: ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/%{?rcversion:Testing/}%{name}-%{myversion}.tar.bz2
# Do no set RPATH if libdir is not /usr/lib # Do no set RPATH if libdir is not /usr/lib
Patch0: pcre2-10.10-Fix-multilib.patch Patch0: pcre2-10.10-Fix-multilib.patch
# Fix register overwite in JIT when SSE2 acceleration is enabled, in upstream
# after 10.22-RC1
Patch1: pcre2-10.22-RC1-Fix-register-overwite-in-JIT-when-SSE2-acceleration-.patch
# Test for Fix-register-overwite-in-JIT-when-SSE2-acceleration-.patch, in
# upstream after 10.22-RC1
Patch2: pcre2-10.22-RC1-Additional-test-for-recent-JIT-bugfix.patch
# New libtool to get rid of RPATH and to use distribution autotools # New libtool to get rid of RPATH and to use distribution autotools
BuildRequires: autoconf BuildRequires: autoconf
@ -99,6 +105,8 @@ Utilities demonstrating PCRE2 capabilities like pcre2grep or pcre2test.
%prep %prep
%setup -q -n %{name}-%{myversion} %setup -q -n %{name}-%{myversion}
%patch0 -p1 %patch0 -p1
%patch1 -p1
%patch2 -p1
# Because of multilib patch # Because of multilib patch
libtoolize --copy --force libtoolize --copy --force
autoreconf -vif autoreconf -vif
@ -198,6 +206,7 @@ make %{?_smp_mflags} check VERBOSE=yes
* Thu Jun 30 2016 Petr Pisar <ppisar@redhat.com> - 10.22-0.1.RC1 * Thu Jun 30 2016 Petr Pisar <ppisar@redhat.com> - 10.22-0.1.RC1
- 10.22-RC1 bump - 10.22-RC1 bump
- libpcre2-posix library changed ABI (FIXME: Bump SONAME) - libpcre2-posix library changed ABI (FIXME: Bump SONAME)
- Fix register overwite in JIT when SSE2 acceleration is enabled
* Mon Jun 20 2016 Petr Pisar <ppisar@redhat.com> - 10.21-6 * Mon Jun 20 2016 Petr Pisar <ppisar@redhat.com> - 10.21-6
- Fix repeated pcregrep output if -o with -M options were used and the match - Fix repeated pcregrep output if -o with -M options were used and the match