diff --git a/valgrind-3.13.0-arch_prctl.patch b/valgrind-3.13.0-arch_prctl.patch
new file mode 100644
index 0000000..4182210
--- /dev/null
+++ b/valgrind-3.13.0-arch_prctl.patch
@@ -0,0 +1,31 @@
+diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c
+index 0f2ad8c51..407af7f76 100644
+--- a/coregrind/m_syswrap/syswrap-amd64-linux.c
++++ b/coregrind/m_syswrap/syswrap-amd64-linux.c
+@@ -249,6 +249,7 @@ PRE(sys_rt_sigreturn)
+ PRE(sys_arch_prctl)
+ {
+    ThreadState* tst;
++   Bool known_option = True;
+    PRINT( "arch_prctl ( %ld, %lx )", SARG1, ARG2 );
+ 
+    vg_assert(VG_(is_valid_tid)(tid));
+@@ -283,13 +284,16 @@ PRE(sys_arch_prctl)
+       POST_MEM_WRITE(ARG2, sizeof(unsigned long));
+    }
+    else {
+-      VG_(core_panic)("Unsupported arch_prctl option");
++      known_option = False;
+    }
+ 
+    /* Note; the Status writeback to guest state that happens after
+       this wrapper returns does not change guest_FS_CONST or guest_GS_CONST;
+       hence that direct assignment to the guest state is safe here. */
+-   SET_STATUS_Success( 0 );
++   if (known_option)
++      SET_STATUS_Success( 0 );
++   else
++      SET_STATUS_Failure( VKI_EINVAL );
+ }
+ 
+ // Parts of this are amd64-specific, but the *PEEK* cases are generic.
diff --git a/valgrind.spec b/valgrind.spec
index 4162bb6..628aaca 100644
--- a/valgrind.spec
+++ b/valgrind.spec
@@ -3,7 +3,7 @@
 Summary: Tool for finding memory management bugs in programs
 Name: %{?scl_prefix}valgrind
 Version: 3.13.0
-Release: 21%{?dist}
+Release: 22%{?dist}
 Epoch: 1
 License: GPLv2+
 URL: http://www.valgrind.org/
@@ -188,6 +188,9 @@ Patch23: valgrind-3.13.0-ld-separate-code.patch
 # KDE#396452 none/test/arm/vfp.c doesn't build with binutils 2.31 gas
 Patch24: valgrind-3.13.0-arm-disable-vfp-test.patch
 
+# KDE#396887 arch_prctl should return EINVAL on unknown option
+Patch25: valgrind-3.13.0-arch_prctl.patch
+
 %if %{build_multilib}
 # Ensure glibc{,-devel} is installed for both multilib arches
 BuildRequires: /lib/libc.so.6 /usr/lib/libc.so /lib64/libc.so.6 /usr/lib64/libc.so
@@ -332,6 +335,7 @@ Valgrind User Manual for details.
 %patch22 -p1
 %patch23 -p1
 %patch24 -p1
+%patch25 -p1
 
 %build
 CC=gcc
@@ -554,6 +558,9 @@ echo ===============END TESTING===============
 %endif
 
 %changelog
+* Thu Jul 26 2018 Mark Wielaard <mjw@fedoraproject.org> - 3.13.0-22
+- Add valgrind-3.13.0-arch_prctl.patch (#1608824)
+
 * Thu Jul 12 2018 Mark Wielaard <mjw@fedoraproject.org> - 3.13.0-21
 - Add valgrind-3.13.0-separate-code.patch (#1600034)
 - Add valgrind-3.13.0-arm-disable-vfp-test.patch