about summary refs log tree commit diff
path: root/sysdeps/x86/tst-wcsncmp-rtm.c
diff options
context:
space:
mode:
authorNoah Goldstein <goldstein.w.n@gmail.com>2022-02-18 14:19:15 -0600
committerNoah Goldstein <goldstein.w.n@gmail.com>2022-02-18 16:35:18 -0600
commit7835d611af0854e69a0c71e3806f8fe379282d6f (patch)
tree531aa988558f915a0400ec7658280318802c7954 /sysdeps/x86/tst-wcsncmp-rtm.c
parent71b108d7eb33b2bf3e61d5e92d2a47f74c1f7d96 (diff)
downloadglibc-7835d611af0854e69a0c71e3806f8fe379282d6f.tar.gz
glibc-7835d611af0854e69a0c71e3806f8fe379282d6f.tar.xz
glibc-7835d611af0854e69a0c71e3806f8fe379282d6f.zip
x86: Test wcscmp RTM in the wcsncmp overflow case [BZ #28896]
In the overflow fallback strncmp-avx2-rtm and wcsncmp-avx2-rtm would
call strcmp-avx2 and wcscmp-avx2 respectively. This would have
not checks around vzeroupper and would trigger spurious
aborts. This commit fixes that.

test-strcmp, test-strncmp, test-wcscmp, and test-wcsncmp all pass on
AVX2 machines with and without RTM.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Diffstat (limited to 'sysdeps/x86/tst-wcsncmp-rtm.c')
-rw-r--r--sysdeps/x86/tst-wcsncmp-rtm.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/sysdeps/x86/tst-wcsncmp-rtm.c b/sysdeps/x86/tst-wcsncmp-rtm.c
new file mode 100644
index 0000000000..bad3b86378
--- /dev/null
+++ b/sysdeps/x86/tst-wcsncmp-rtm.c
@@ -0,0 +1,21 @@
+/* Test case for wcsncmp inside a transactionally executing RTM region.
+   Copyright (C) 2022 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#define WIDE 1
+#include <wchar.h>
+#include "tst-strncmp-rtm.c"