GNU bug report logs -
#29886
tests/rm/rm-readdir-fail is failing with SIGBUS on Gentoo sparc
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 29886 in the body.
You can then email your comments to 29886 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-coreutils <at> gnu.org
:
bug#29886
; Package
coreutils
.
(Fri, 29 Dec 2017 02:41:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Thomas Deutschmann <whissi <at> gentoo.org>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Fri, 29 Dec 2017 02:41:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hi,
a Gentoo SPARC user is reporting that tests/rm/rm-readdir-fail is failing with SIGBUS
in coreutils-8.28 and coreutils-8.29:
> FAIL: tests/rm/rm-readdir-fail
> ==============================
>
> ++ initial_cwd_=/var/tmp/portage/sys-apps/coreutils-8.29/work/coreutils-8.29
> +++ testdir_prefix_
> +++ printf gt
> ++ pfx_=gt
> +++ mktempd_ /var/tmp/portage/sys-apps/coreutils-8.29/work/coreutils-8.29 gt-rm-readdir-fail.sh.XXXX
> +++ case $# in
> +++ destdir_=/var/tmp/portage/sys-apps/coreutils-8.29/work/coreutils-8.29
> +++ template_=gt-rm-readdir-fail.sh.XXXX
> +++ MAX_TRIES_=4
> +++ case $destdir_ in
> +++ destdir_slash_=/var/tmp/portage/sys-apps/coreutils-8.29/work/coreutils-8.29/
> +++ case $template_ in
> ++++ unset TMPDIR
> +++ d=/var/tmp/portage/sys-apps/coreutils-8.29/work/coreutils-8.29/gt-rm-readdir-fail.sh.ZZkN
> +++ case $d in
> +++ :
> +++ test -d /var/tmp/portage/sys-apps/coreutils-8.29/work/coreutils-8.29/gt-rm-readdir-fail.sh.ZZkN
> ++++ ls -dgo /var/tmp/portage/sys-apps/coreutils-8.29/work/coreutils-8.29/gt-rm-readdir-fail.sh.ZZkN
> +++ perms='drwx------ 2 4096 Dec 28 10:54 /var/tmp/portage/sys-apps/coreutils-8.29/work/coreutils-8.29/gt-rm-readdir-fail.sh.ZZkN'
> +++ case $perms in
> +++ :
> +++ echo /var/tmp/portage/sys-apps/coreutils-8.29/work/coreutils-8.29/gt-rm-readdir-fail.sh.ZZkN
> +++ return
> ++ test_dir_=/var/tmp/portage/sys-apps/coreutils-8.29/work/coreutils-8.29/gt-rm-readdir-fail.sh.ZZkN
> ++ cd /var/tmp/portage/sys-apps/coreutils-8.29/work/coreutils-8.29/gt-rm-readdir-fail.sh.ZZkN
> ++ gl_init_sh_nl_='
> '
> ++ IFS='
> '
> ++ for sig_ in 1 2 3 13 15
> +++ expr 1 + 128
> ++ eval 'trap '\''Exit 129'\'' 1'
> +++ trap 'Exit 129' 1
> ++ for sig_ in 1 2 3 13 15
> +++ expr 2 + 128
> ++ eval 'trap '\''Exit 130'\'' 2'
> +++ trap 'Exit 130' 2
> ++ for sig_ in 1 2 3 13 15
> +++ expr 3 + 128
> ++ eval 'trap '\''Exit 131'\'' 3'
> +++ trap 'Exit 131' 3
> ++ for sig_ in 1 2 3 13 15
> +++ expr 13 + 128
> ++ eval 'trap '\''Exit 141'\'' 13'
> +++ trap 'Exit 141' 13
> ++ for sig_ in 1 2 3 13 15
> +++ expr 15 + 128
> ++ eval 'trap '\''Exit 143'\'' 15'
> +++ trap 'Exit 143' 15
> ++ trap remove_tmp_ 0
> + path_prepend_ ./src
> + test 1 '!=' 0
> + path_dir_=./src
> + case $path_dir_ in
> + abs_path_dir_=/var/tmp/portage/sys-apps/coreutils-8.29/work/coreutils-8.29/./src
> + case $abs_path_dir_ in
> + PATH=/var/tmp/portage/sys-apps/coreutils-8.29/work/coreutils-8.29/./src:/var/tmp/portage/sys-apps/coreutils-8.29/work/coreutils-8.29/src:/var/tmp/portage/sys-apps/coreutils-8.29/temp/mount-wrappers:/var/tmp/portage/sys-apps/coreutils-8.29/temp/python3.5/bin:/usr/lib/portage/python3.5/ebuild-helpers/xattr:/usr/lib/portage/python3.5/ebuild-helpers:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/sparc-unknown-linux-gnu/gcc-bin/6.4.0
> + create_exe_shims_ /var/tmp/portage/sys-apps/coreutils-8.29/work/coreutils-8.29/./src
> + case $EXEEXT in
> + return 0
> + shift
> + test 0 '!=' 0
> + export PATH
> + print_ver_ rm
> + require_built_ rm
> + skip_=no
> + for i in '"$@"'
> + case " $built_programs " in
> + test no = yes
> + test yes = yes
> + local i
> + for i in '$*'
> + env rm --version
> rm (GNU coreutils) 8.29
> Packaged by Gentoo (8.29 (p1.0))
> Copyright (C) 2017 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
>
> Written by Paul Rubin, David MacKenzie, Richard M. Stallman,
> and Jim Meyering.
> + require_gcc_shared_
> + gcc_shared_ - d.so -xc
> + local in=-
> + local out=d.so
> + shift 2
> + sparc-unknown-linux-gnu-gcc -Wall -shared --std=gnu99 -fPIC -O2 -xc - -o d.so -ldl
> + rm -f d.so
> + mkdir -p dir/notempty
> + cat
> + gcc_shared_ k.c k.so
> + local in=k.c
> + local out=k.so
> + shift 2
> + sparc-unknown-linux-gnu-gcc -Wall -shared --std=gnu99 -fPIC -O2 k.c -o k.so -ldl
> + export READDIR_PARTIAL
> + for READDIR_PARTIAL in ''\'''\''' ''\''1'\'''
> + rm -f preloaded
> + export LD_PRELOAD=libsandbox.so:./k.so
> + LD_PRELOAD=libsandbox.so:./k.so
> + returns_ 1 rm -Rf dir
> + test -f preloaded
> + for READDIR_PARTIAL in ''\'''\''' ''\''1'\'''
> + rm -f preloaded
> + export LD_PRELOAD=libsandbox.so:./k.so
> + LD_PRELOAD=libsandbox.so:./k.so
> + returns_ 1 rm -Rf dir
> + fail=1
> + test -f preloaded
> + cat
> + sed 's/\(rm:.*\):.*/\1/' errt
> + compare exp err
> + compare_dev_null_ exp err
> + test 2 = 2
> + test xexp = x/dev/null
> + test xerr = x/dev/null
> + return 2
> + case $? in
> + compare_ exp err
> + diff -u exp err
> --- exp 2017-12-28 10:54:33.403337960 +0100
> +++ err 2017-12-28 10:54:33.423337960 +0100
> @@ -1,2 +1,2 @@
> rm: cannot remove 'dir'
> -rm: traversal failed: dir
> +./tests/init.sh: line 118: 9012 Bus error "$@"
> + fail=1
> + Exit 1
> + set +e
> + exit 1
> + exit 1
> + remove_tmp_
> + __st=1
> + cleanup_
> + :
> + test '' = yes
> + cd /var/tmp/portage/sys-apps/coreutils-8.29/work/coreutils-8.29
> + chmod -R u+rwx /var/tmp/portage/sys-apps/coreutils-8.29/work/coreutils-8.29/gt-rm-readdir-fail.sh.ZZkN
> + rm -rf /var/tmp/portage/sys-apps/coreutils-8.29/work/coreutils-8.29/gt-rm-readdir-fail.sh.ZZkN
> + exit 1
> FAIL tests/rm/rm-readdir-fail.sh (exit status: 1)
System details:
> Portage 2.3.13 (python 3.5.4-final-0, default/linux/sparc/17.0, gcc-6.4.0, glibc-2.25-r9, 4.14.8-gentoo-r1 sparc64)
> =================================================================
> System Settings
> =================================================================
> System uname: Linux-4.14.8-gentoo-r1-sparc64-sun4v-with-gentoo-2.3
> KiB Mem: 33133552 total, 21139472 free
> KiB Swap: 0 total, 0 free
> Timestamp of repository gentoo: Thu, 28 Dec 2017 01:15:01 +0000
> Head commit of repository gentoo: dbbcaa80af14ec02c8eba29c56f946886b192845
> sh bash 4.3_p48-r1
> ld GNU ld (Gentoo 2.29.1 p3) 2.29.1
> app-shells/bash: 4.3_p48-r1::gentoo
> dev-lang/perl: 5.24.3::gentoo
> dev-lang/python: 2.7.14-r1::gentoo, 3.4.5::gentoo, 3.5.4-r1::gentoo
> dev-util/cmake: 3.8.2::gentoo
> dev-util/pkgconfig: 0.29.2::gentoo
> sys-apps/baselayout: 2.3::gentoo
> sys-apps/openrc: 0.34.11::gentoo
> sys-apps/sandbox: 2.10-r4::gentoo
> sys-devel/autoconf: 2.69::gentoo
> sys-devel/automake: 1.15.1-r1::gentoo
> sys-devel/binutils: 2.29.1-r1::gentoo
> sys-devel/gcc: 6.4.0::gentoo
> sys-devel/gcc-config: 1.8-r1::gentoo
> sys-devel/libtool: 2.4.6-r3::gentoo
> sys-devel/make: 4.2.1::gentoo
> sys-kernel/linux-headers: 4.4::gentoo (virtual/os-headers)
> sys-libs/glibc: 2.25-r9::gentoo
Bug: https://bugs.gentoo.org/642492
--
Regards,
Thomas Deutschmann / Gentoo Linux Developer
C4DD 695F A713 8F24 2AA1 5638 5849 7EE5 1D5D 74A5
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#29886
; Package
coreutils
.
(Mon, 09 Jul 2018 22:27:01 GMT)
Full text and
rfc822 format available.
Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):
Hi,
still happening with coreutils-8.30.
--
Regards,
Thomas Deutschmann / Gentoo Linux Developer
C4DD 695F A713 8F24 2AA1 5638 5849 7EE5 1D5D 74A5
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#29886
; Package
coreutils
.
(Tue, 10 Jul 2018 21:48:01 GMT)
Full text and
rfc822 format available.
Message #11 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi,
a Gentoo sparc user proposed the following fix:
From: Rolf Eike Beer <eike <at> sf-mail.de>
Date: Tue, 10 Jul 2018 20:14:18 +0200
Subject: [PATCH] fix SIGBUS because of unaligned access in rm
This crashes the rm-readdir-fail test on Gentoo Sparc.
Bug: https://bugs.gentoo.org/642492
--- a/lib/fts.c 2018-06-24 06:52:06.000000000 +0200
+++ b/lib/fts.c 2018-07-10 14:08:32.382614958 +0200
@@ -1551,7 +1551,7 @@ mem1: saved_er
/* Store dirent.d_ino, in case we need to sort
entries before processing them. */
- p->fts_statp->st_ino = D_INO (dp);
+ memcpy(&p->fts_statp->st_ino, &dp, sizeof(p->fts_statp->st_ino));
/* Build a file name for fts_stat to stat. */
if (ISSET(FTS_NOCHDIR)) {
--
Regards,
Thomas Deutschmann / Gentoo Linux Developer
C4DD 695F A713 8F24 2AA1 5638 5849 7EE5 1D5D 74A5
[signature.asc (application/pgp-signature, attachment)]
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#29886
; Package
coreutils
.
(Wed, 11 Jul 2018 02:47:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 29886 <at> debbugs.gnu.org (full text, mbox):
Thomas Deutschmann wrote:
> - p->fts_statp->st_ino = D_INO (dp);
> + memcpy(&p->fts_statp->st_ino, &dp, sizeof(p->fts_statp->st_ino));
This looks like a kernel bug, not a coreutils bug. readdir must be returning a
pointer to an misaligned struct. Can you look into that? For example, what
happens if you insert this:
if ((intptr_t) (dp) % _Alignof (struct dirent) != 0)
abort ();
before the memcpy? The 'abort ()' should never happen; if it does, there's a bug
in readdir, surely.
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#29886
; Package
coreutils
.
(Wed, 11 Jul 2018 16:54:01 GMT)
Full text and
rfc822 format available.
Message #17 received at 29886 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 2018-07-11 04:46, Paul Eggert wrote:
> Thomas Deutschmann wrote:
>> - p->fts_statp->st_ino = D_INO (dp);
>> + memcpy(&p->fts_statp->st_ino, &dp,
>> sizeof(p->fts_statp->st_ino));
>
> This looks like a kernel bug, not a coreutils bug. readdir must be
> returning a pointer to an misaligned struct. Can you look into that? For
> example, what happens if you insert this:
>
> if ((intptr_t) (dp) % _Alignof (struct dirent) != 0)
> abort ();
>
> before the memcpy? The 'abort ()' should never happen; if it does,
> there's a bug in readdir, surely.
Not sure if this is a kernel problem. Isn't test suite using
LD_PRELOAD to pull in additional libraries which could cause
such a breakage? And wouldn't "rm" show any failure during normal
use?
The sparc user added the requested debug code and confirmed that
abort() will be triggered.
#0 0xf7e230fc in raise () from /lib/libc.so.6
#1 0xf7e25240 in abort () from /lib/libc.so.6
#2 0x0001813c in fts_build (sp=sp <at> entry=0x309c0, type=type <at> entry=3) at lib/fts.c:1555
#3 0x00018bd0 in fts_read (sp=sp <at> entry=0x309c0) at lib/fts.c:966
#4 0x00012750 in rm (file=file <at> entry=0xffffc95c, x=x <at> entry=0xffffc7f4) at src/remove.c:596
#5 0x00011564 in main (argc=<optimized out>, argv=<optimized out>) at src/rm.c:370
(gdb) frame 2
(gdb) p dp
$1 = (struct dirent *) 0x31dcc
User said it is also always going through
#0 0xf7fb4684 in readdir64 () from ./k.so
Kernel: Linux castor 4.16.8 #1 SMP Tue May 15 22:40:58 CEST 2018 sparc64 sun4v UltraSparc T2 (Niagara2) GNU/Linux
--
Regards,
Thomas Deutschmann / Gentoo Linux Developer
C4DD 695F A713 8F24 2AA1 5638 5849 7EE5 1D5D 74A5
[signature.asc (application/pgp-signature, attachment)]
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#29886
; Package
coreutils
.
(Wed, 11 Jul 2018 17:07:01 GMT)
Full text and
rfc822 format available.
Message #20 received at 29886 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Thomas Deutschmann wrote:
> Not sure if this is a kernel problem. Isn't test suite using
> LD_PRELOAD to pull in additional libraries which could cause
> such a breakage?
You're right, it could be a library problem. The test suite's LD_PRELOAD library
just returns what the C library gives it, though. Perhaps LD_PRELOAD usage is
messing up malloc on your platform, so that it returns improperly-aligned
pointers? You might try something like the attached patch to see whether the C
library is doing that.
> And wouldn't "rm" show any failure during normal use?
Yes, one would think so.
In any case, this is not sounding like a bug in coreutils itself.
[diff (text/plain, attachment)]
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#29886
; Package
coreutils
.
(Wed, 11 Jul 2018 17:32:02 GMT)
Full text and
rfc822 format available.
Message #23 received at 29886 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 2018-07-11 19:05, Paul Eggert wrote:
> Thomas Deutschmann wrote:
>
>> Not sure if this is a kernel problem. Isn't test suite using
>> LD_PRELOAD to pull in additional libraries which could cause
>> such a breakage?
>
> You're right, it could be a library problem. The test suite's LD_PRELOAD
> library just returns what the C library gives it, though. Perhaps
> LD_PRELOAD usage is messing up malloc on your platform, so that it
> returns improperly-aligned pointers? You might try something like the
> attached patch to see whether the C library is doing that.
Looks like we are on the right track, with your diff:
#0 0xf7e230fc in raise () from /lib/libc.so.6
#1 0xf7e25240 in abort () from /lib/libc.so.6
#2 0xf7fb4840 in readdir64 () from ./k.so
Adding Rolf (the Gentoo sparc user) to this mail conversation.
--
Regards,
Thomas Deutschmann / Gentoo Linux Developer
C4DD 695F A713 8F24 2AA1 5638 5849 7EE5 1D5D 74A5
[signature.asc (application/pgp-signature, attachment)]
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#29886
; Package
coreutils
.
(Sun, 15 Jul 2018 01:22:01 GMT)
Full text and
rfc822 format available.
Message #26 received at 29886 <at> debbugs.gnu.org (full text, mbox):
On 11/07/18 10:05, Paul Eggert wrote:
> Thomas Deutschmann wrote:
>
>> Not sure if this is a kernel problem. Isn't test suite using
>> LD_PRELOAD to pull in additional libraries which could cause
>> such a breakage?
>
> You're right, it could be a library problem. The test suite's LD_PRELOAD library
> just returns what the C library gives it, though. Perhaps LD_PRELOAD usage is
> messing up malloc on your platform, so that it returns improperly-aligned
> pointers? You might try something like the attached patch to see whether the C
> library is doing that.
>
>> And wouldn't "rm" show any failure during normal use?
>
> Yes, one would think so.
>
> In any case, this is not sounding like a bug in coreutils itself.
This could be due to my hack for 32 bit in:
https://git.sv.gnu.org/cgit/coreutils.git/commit/?id=v8.25-43-g54c1397
which fails due to the alignment requirement on sparc
This is using a 32 bit userland right?
We can skip this test on 32 bit, as there really
is nothing arch specific that we're testing here.
Does this skip the test for you?
diff --git a/tests/rm/rm-readdir-fail.sh b/tests/rm/rm-readdir-fail.sh
index 75fa339..580d8ec 100755
--- a/tests/rm/rm-readdir-fail.sh
+++ b/tests/rm/rm-readdir-fail.sh
@@ -27,9 +27,9 @@ mkdir -p dir/notempty || framework_failure_
cat > k.c <<\EOF || framework_failure_
#define _GNU_SOURCE
-/* Setup so we don't have to worry about readdir64. */
+/* Avoid having to also handle readdir64. */
#ifndef __LP64__
-# define _FILE_OFFSET_BITS 64
+# error skipping test on 32 bit
#endif
#include <dlfcn.h>
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#29886
; Package
coreutils
.
(Sun, 15 Jul 2018 15:46:01 GMT)
Full text and
rfc822 format available.
Message #29 received at 29886 <at> debbugs.gnu.org (full text, mbox):
On 2018-07-15 03:21, Pádraig Brady wrote:
> Does this skip the test for you?
No, it doesn't:
chroot /var/tmp/portage/sys-apps/coreutils-8.30/work/coreutils-8.30 # make
check TESTS=tests/rm/rm-readdir-fail.sh
if test -d ./.git \
&& git --version >/dev/null 2>&1; then \
cd . && \
git submodule --quiet foreach \
'test "$(git rev-parse "$sha1")" \
= "$(git merge-base origin "$sha1")"' \
|| { echo 'maint.mk: found non-public submodule commit' >&2; \
exit 1; }; \
else \
: ; \
fi
make check-recursive
make[1]: Entering directory '/var/tmp/portage/sys-apps/coreutils-8.30/work/
coreutils-8.30'
Making check in po
make[2]: Entering directory '/var/tmp/portage/sys-apps/coreutils-8.30/work/
coreutils-8.30/po'
make[2]: Nothing to be done for 'check'.
make[2]: Leaving directory '/var/tmp/portage/sys-apps/coreutils-8.30/work/
coreutils-8.30/po'
Making check in .
make[2]: Entering directory '/var/tmp/portage/sys-apps/coreutils-8.30/work/
coreutils-8.30'
make check-TESTS check-local
make[3]: Entering directory '/var/tmp/portage/sys-apps/coreutils-8.30/work/
coreutils-8.30'
make[4]: Entering directory '/var/tmp/portage/sys-apps/coreutils-8.30/work/
coreutils-8.30'
rm-readdir-fail.sh: set-up failure: failed to build shared library
ERROR: tests/rm/rm-readdir-fail.sh
[...]
--
Regards,
Thomas Deutschmann / Gentoo Linux Developer
C4DD 695F A713 8F24 2AA1 5638 5849 7EE5 1D5D 74A5
Reply sent
to
Pádraig Brady <P <at> draigBrady.com>
:
You have taken responsibility.
(Sun, 15 Jul 2018 18:03:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
Thomas Deutschmann <whissi <at> gentoo.org>
:
bug acknowledged by developer.
(Sun, 15 Jul 2018 18:03:02 GMT)
Full text and
rfc822 format available.
Message #34 received at 29886-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 15/07/18 07:28, Thomas Deutschmann wrote:
> On 2018-07-15 03:21, Pádraig Brady wrote:
>> Does this skip the test for you?
> rm-readdir-fail.sh: set-up failure: failed to build shared library
> ERROR: tests/rm/rm-readdir-fail.sh
Thanks for confirming your __LP64__ setting.
I'm going to go with the attached.
thanks,
Pádraig.
[rm-sparc-test.patch (text/x-patch, attachment)]
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 13 Aug 2018 11:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 5 years and 257 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.