3
0
forked from pool/findutils

Accepting request 830936 from Base:System

- findutils-gnulib-test-avoid-FP-perror-strerror.patch: Add patch to
  avoid false-positive error in gnulib tests 'test-perror2' and
  'test-strerror_r', visible on armv7l.

OBS-URL: https://build.opensuse.org/request/show/830936
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/findutils?expand=0&rev=64
This commit is contained in:
Dominique Leuenberger 2020-09-04 08:53:07 +00:00 committed by Git OBS Bridge
commit a5f3066237
4 changed files with 125 additions and 7 deletions

View File

@ -1,7 +1,11 @@
diff --git a/gnulib-tests/test-canonicalize.c b/gnulib-tests/test-canonicalize.c ---
index 8d1ff86..0f3c5e3 100644 gnulib-tests/test-canonicalize.c | 4 ----
--- a/gnulib-tests/test-canonicalize.c 1 file changed, 4 deletions(-)
+++ b/gnulib-tests/test-canonicalize.c
Index: gnulib-tests/test-canonicalize.c
===================================================================
--- gnulib-tests/test-canonicalize.c.orig
+++ gnulib-tests/test-canonicalize.c
@@ -71,10 +71,6 @@ main (void) @@ -71,10 +71,6 @@ main (void)
ASSERT (result2 == NULL); ASSERT (result2 == NULL);
ASSERT (errno == ENOENT); ASSERT (errno == ENOENT);

View File

@ -0,0 +1,101 @@
Avoid false-positive error in gnulib tests 'test-perror2' and 'test-strerror_r'.
On openSUSE OBS, the above gnulib tests fail on armv7l.
Corresponding report on the gnulib mailing list:
https://lists.gnu.org/r/bug-gnulib/2020-08/msg00220.html
From: Florian Weimer
Date: Thu, 27 Aug 2020 09:41:34 +0200
Subject: Use-after-free in test-perror2, test-strerror_r
The problem is visible with glibc 2.32 under valgrind:
==20== Invalid read of size 1
==20== at 0x483DAB4: strcmp (vg_replace_strmem.c:847)
==20== by 0x109414: main (test-perror2.c:84)
==20== Address 0x4a1a3d0 is 0 bytes inside a block of size 17 free'd
==20== at 0x483A9F5: free (vg_replace_malloc.c:538)
==20== by 0x48E2134: strerror_l (in /usr/lib64/libc-2.32.so)
==20== by 0x109328: main (test-perror2.c:72)
==20== Block was alloc'd at
==20== at 0x4839809: malloc (vg_replace_malloc.c:307)
==20== by 0x48CA03F: __vasprintf_internal (in /usr/lib64/libc-2.32.so)
==20== by 0x48A46F9: asprintf (in /usr/lib64/libc-2.32.so)
==20== by 0x48E2184: strerror_l (in /usr/lib64/libc-2.32.so)
==20== by 0x1092E2: main (test-perror2.c:67)
==20==
==20== Invalid read of size 1
==20== at 0x483DAC8: strcmp (vg_replace_strmem.c:847)
==20== by 0x109414: main (test-perror2.c:84)
==20== Address 0x4a1a3d1 is 1 bytes inside a block of size 17 free'd
==20== at 0x483A9F5: free (vg_replace_malloc.c:538)
==20== by 0x48E2134: strerror_l (in /usr/lib64/libc-2.32.so)
==20== by 0x109328: main (test-perror2.c:72)
==20== Block was alloc'd at
==20== at 0x4839809: malloc (vg_replace_malloc.c:307)
==20== by 0x48CA03F: __vasprintf_internal (in /usr/lib64/libc-2.32.so)
==20== by 0x48A46F9: asprintf (in /usr/lib64/libc-2.32.so)
==20== by 0x48E2184: strerror_l (in /usr/lib64/libc-2.32.so)
==20== by 0x1092E2: main (test-perror2.c:67)
I think it's the test that's invalid.
This was reported as an actual grep test failure (without valgrind) on
32-bit Arm, where glibc malloc happens to return a different buffer
address for the internal allocation (so that msg3 != msg4).
test-strerror_r has the same issue.
Thanks,
Florian
Upstream patch:
https://git.sv.gnu.org/cgit/gnulib.git/commit/?id=175e0bc72808
From 175e0bc72808d564074c4adcc72aeadb74adfcc6 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Thu, 27 Aug 2020 17:52:58 -0700
Subject: [PATCH] perror, strerror_r: remove unportable tests
Problem reported by Florian Weimer in:
https://lists.gnu.org/r/bug-gnulib/2020-08/msg00220.html
* tests/test-perror2.c (main):
* tests/test-strerror_r.c (main): Omit unportable tests.
This downstream patch is identical to upstream one modulo the ChangeLog entry.
---
gnulib-tests/test-perror2.c | 3 ---
gnulib-tests/test-strerror_r.c | 3 ---
2 files changed, 6 deletions(-)
Index: gnulib-tests/test-perror2.c
===================================================================
--- gnulib-tests/test-perror2.c.orig
+++ gnulib-tests/test-perror2.c
@@ -79,9 +79,6 @@ main (void)
errno = -5;
perror ("");
ASSERT (!ferror (stderr));
- ASSERT (msg1 == msg2 || msg1 == msg4 || STREQ (msg1, str1));
- ASSERT (msg2 == msg4 || STREQ (msg2, str2));
- ASSERT (msg3 == msg4 || STREQ (msg3, str3));
ASSERT (STREQ (msg4, str4));
free (str1);
Index: gnulib-tests/test-strerror_r.c
===================================================================
--- gnulib-tests/test-strerror_r.c.orig
+++ gnulib-tests/test-strerror_r.c
@@ -165,9 +165,6 @@ main (void)
strerror_r (EACCES, buf, sizeof buf);
strerror_r (-5, buf, sizeof buf);
- ASSERT (msg1 == msg2 || msg1 == msg4 || STREQ (msg1, str1));
- ASSERT (msg2 == msg4 || STREQ (msg2, str2));
- ASSERT (msg3 == msg4 || STREQ (msg3, str3));
ASSERT (STREQ (msg4, str4));
free (str1);

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Sun Aug 30 09:28:55 UTC 2020 - Bernhard Voelker <mail@bernhard-voelker.de>
- findutils-gnulib-test-avoid-FP-perror-strerror.patch: Add patch to
avoid false-positive error in gnulib tests 'test-perror2' and
'test-strerror_r', visible on armv7l.
- findutils.spec: Reference the patch.
- disable-null-ptr-test.patch: Refresh with -p0.
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Aug 11 22:23:16 UTC 2020 - Bernhard Voelker <mail@bernhard-voelker.de> Tue Aug 11 22:23:16 UTC 2020 - Bernhard Voelker <mail@bernhard-voelker.de>

View File

@ -46,6 +46,7 @@ Source2: https://savannah.gnu.org/project/memberlist-gpgkeys.php?group=%{
Patch0: findutils-xautofs.patch Patch0: findutils-xautofs.patch
Patch1: disable-null-ptr-test.patch Patch1: disable-null-ptr-test.patch
Patch2: findutils-gnulib-disable-test-float.patch Patch2: findutils-gnulib-disable-test-float.patch
Patch3: findutils-gnulib-test-avoid-FP-perror-strerror.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
# BuildRequire dejagnu for 'runtest' to execute all tests. # BuildRequire dejagnu for 'runtest' to execute all tests.
@ -76,13 +77,16 @@ useful for finding things on your system.
%prep %prep
%setup -q %setup -q
%patch0 %patch0
%patch1 -p1 %patch1
%ifarch ppc ppc64le %ifarch ppc ppc64le
# Disable gnulib test 'test-float' temporarily as it fails on ppc and ppc64le. # Disable gnulib test 'test-float' temporarily as it fails on ppc and ppc64le.
%patch2 %patch2
%endif %endif
# Avoid FP error in gnulib tests 'test-perror2' and 'test-strerror_r'.
%patch3
%build %build
%if 0%{?qemu_user_space_build} %if 0%{?qemu_user_space_build}
# this is a workaround for a qemu-user bug, we hit. A qemu patch is being discussed, but for now ... # this is a workaround for a qemu-user bug, we hit. A qemu patch is being discussed, but for now ...