Subject: Test failure on SPARC (stack-overflow)

From: Sam James <[email-masked]>
Date: Mon, 1 Feb 2021 04:02:09 +0000

Hi,

The stack-overflow fails for me on SPARC on Gentoo GNU/Linux with grep 3.5 and grep 3.6.

I’ve included stack-overflow.log from grep 3.6, let me know what other information is required.

It looks it fails with the second test case. The following backtrace is with -Os -ggdb3.
(gdb) r
Starting program: /var/tmp/portage/sys-apps/grep-3.6/work/grep-3.6/src/grep -E -f in
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x0000010000026908 in peek_token (token=0x10000aa9f30, input=0x10000aa9f30, syntax=1099522809648) at regcomp.c:1784
1784    {
(gdb) bt
#0  0x0000010000026908 in peek_token (token=0x10000aa9f30, input=0x10000aa9f30, syntax=1099522809648) at regcomp.c:1784
#1  0x0000010000aa9f38 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
(gdb)

Thanks,
Sam

++ initial_cwd_=/var/tmp/portage/sys-apps/grep-3.6/work/grep-3.6/tests
+++ testdir_prefix_
+++ printf gt
++ pfx_=gt
+++ mktempd_ /var/tmp/portage/sys-apps/grep-3.6/work/grep-3.6/tests gt-stack-overflow.XXXX
+++ case $# in
+++ destdir_=/var/tmp/portage/sys-apps/grep-3.6/work/grep-3.6/tests
+++ template_=gt-stack-overflow.XXXX
+++ MAX_TRIES_=4
+++ case $destdir_ in
+++ destdir_slash_=/var/tmp/portage/sys-apps/grep-3.6/work/grep-3.6/tests/
+++ case $template_ in
++++ unset TMPDIR
+++ d=/var/tmp/portage/sys-apps/grep-3.6/work/grep-3.6/tests/gt-stack-overflow.bWE3
+++ case $d in
+++ :
+++ test -d /var/tmp/portage/sys-apps/grep-3.6/work/grep-3.6/tests/gt-stack-overflow.bWE3
++++ ls -dgo /var/tmp/portage/sys-apps/grep-3.6/work/grep-3.6/tests/gt-stack-overflow.bWE3
+++ perms='drwx------ 2 4096 Jan 31 19:39 /var/tmp/portage/sys-apps/grep-3.6/work/grep-3.6/tests/gt-stack-overflow.bWE3'
+++ case $perms in
+++ :
+++ echo /var/tmp/portage/sys-apps/grep-3.6/work/grep-3.6/tests/gt-stack-overflow.bWE3
+++ return
++ test_dir_=/var/tmp/portage/sys-apps/grep-3.6/work/grep-3.6/tests/gt-stack-overflow.bWE3
++ cd /var/tmp/portage/sys-apps/grep-3.6/work/grep-3.6/tests/gt-stack-overflow.bWE3
++ case $srcdir in
++ srcdir=../.
++ builddir=..
++ export srcdir builddir
++ 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/grep-3.6/work/grep-3.6/tests/../src
+ case $abs_path_dir_ in
+ PATH=/var/tmp/portage/sys-apps/grep-3.6/work/grep-3.6/tests/../src:/var/tmp/portage/sys-apps/grep-3.6/work/grep-3.6/src:./src:/usr/lib/portage/python3.7/ebuild-helpers/xattr:/usr/lib/portage/python3.7/ebuild-helpers:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin
+ create_exe_shims_ /var/tmp/portage/sys-apps/grep-3.6/work/grep-3.6/tests/../src
+ case $EXEEXT in
+ return 0
+ shift
+ test 0 '!=' 0
+ export PATH
+ case $host_triplet in
+ ASAN_OPTIONS=help=true
+ grep --version
+ grep -q AddressSanitizer
+ echo grep: stack overflow
+ ulimit -s 8192
+ fail=0
+ for i in 1 3 5 10 20 30 40 50 100 200 400 1000
+ printf %010000d 0
+ tr 0 '('
+ LC_ALL=C
+ env -- tr 0 '('
+ grep -E -f in
./stack-overflow: line 31:  5295 Segmentation fault      (core dumped) grep -E -f in > out 2> err
+ st=139
+ grep -q 'stack overflow' err
+ for i in 1 3 5 10 20 30 40 50 100 200 400 1000
+ printf %030000d 0
+ tr 0 '('
+ LC_ALL=C
+ env -- tr 0 '('
+ grep -E -f in
./stack-overflow: line 31:  6967 Segmentation fault      (core dumped) grep -E -f in > out 2> err
+ st=139
+ grep -q 'stack overflow' err
+ for i in 1 3 5 10 20 30 40 50 100 200 400 1000
+ printf %050000d 0
+ tr 0 '('
+ LC_ALL=C
+ env -- tr 0 '('
+ grep -E -f in
./stack-overflow: line 31:  7744 Segmentation fault      (core dumped) grep -E -f in > out 2> err
+ st=139
+ grep -q 'stack overflow' err
+ for i in 1 3 5 10 20 30 40 50 100 200 400 1000
+ printf %0100000d 0
+ tr 0 '('
+ LC_ALL=C
+ env -- tr 0 '('
+ grep -E -f in
./stack-overflow: line 31:  9058 Segmentation fault      (core dumped) grep -E -f in > out 2> err
+ st=139
+ grep -q 'stack overflow' err
+ for i in 1 3 5 10 20 30 40 50 100 200 400 1000
+ printf %0200000d 0
+ tr 0 '('
+ LC_ALL=C
+ env -- tr 0 '('
+ grep -E -f in
./stack-overflow: line 31:  9501 Segmentation fault      (core dumped) grep -E -f in > out 2> err
+ st=139
+ grep -q 'stack overflow' err
+ for i in 1 3 5 10 20 30 40 50 100 200 400 1000
+ printf %0300000d 0
+ tr 0 '('
+ LC_ALL=C
+ env -- tr 0 '('
+ grep -E -f in
./stack-overflow: line 31: 10004 Segmentation fault      (core dumped) grep -E -f in > out 2> err
+ st=139
+ grep -q 'stack overflow' err
+ for i in 1 3 5 10 20 30 40 50 100 200 400 1000
+ printf %0400000d 0
+ tr 0 '('
+ LC_ALL=C
+ env -- tr 0 '('
+ grep -E -f in
./stack-overflow: line 31: 10481 Segmentation fault      (core dumped) grep -E -f in > out 2> err
+ st=139
+ grep -q 'stack overflow' err
+ for i in 1 3 5 10 20 30 40 50 100 200 400 1000
+ printf %0500000d 0
+ tr 0 '('
+ LC_ALL=C
+ env -- tr 0 '('
+ grep -E -f in
./stack-overflow: line 31: 10862 Segmentation fault      (core dumped) grep -E -f in > out 2> err
+ st=139
+ grep -q 'stack overflow' err
+ for i in 1 3 5 10 20 30 40 50 100 200 400 1000
+ printf %01000000d 0
+ tr 0 '('
+ LC_ALL=C
+ env -- tr 0 '('
+ grep -E -f in
./stack-overflow: line 31: 11255 Segmentation fault      (core dumped) grep -E -f in > out 2> err
+ st=139
+ grep -q 'stack overflow' err
+ for i in 1 3 5 10 20 30 40 50 100 200 400 1000
+ printf %02000000d 0
+ tr 0 '('
+ LC_ALL=C
+ env -- tr 0 '('
+ grep -E -f in
./stack-overflow: line 31: 11576 Segmentation fault      (core dumped) grep -E -f in > out 2> err
+ st=139
+ grep -q 'stack overflow' err
+ for i in 1 3 5 10 20 30 40 50 100 200 400 1000
+ printf %04000000d 0
+ tr 0 '('
+ LC_ALL=C
+ env -- tr 0 '('
+ grep -E -f in
./stack-overflow: line 31: 11989 Segmentation fault      (core dumped) grep -E -f in > out 2> err
+ st=139
+ grep -q 'stack overflow' err
+ for i in 1 3 5 10 20 30 40 50 100 200 400 1000
+ printf %010000000d 0
+ tr 0 '('
+ LC_ALL=C
+ env -- tr 0 '('
+ grep -E -f in
./stack-overflow: line 31: 12600 Segmentation fault      (core dumped) grep -E -f in > out 2> err
+ st=139
+ grep -q 'stack overflow' err
+ test 139 = 1
+ fail_ 'grep never printed "stack overflow"'
+ warn_ 'stack-overflow: failed test: grep never printed "stack overflow"'
+ case $IFS in
+ printf '%s\n' 'stack-overflow: failed test: grep never printed "stack overflow"'
stack-overflow: failed test: grep never printed "stack overflow"
+ test 9 = 2
+ printf '%s\n' 'stack-overflow: failed test: grep never printed "stack overflow"'
+ sed 1q
+ Exit 1
+ set +e
+ exit 1
+ exit 1
+ remove_tmp_
+ __st=1
+ cleanup_
+ :
+ test '' = yes
+ cd /var/tmp/portage/sys-apps/grep-3.6/work/grep-3.6/tests
+ chmod -R u+rwx /var/tmp/portage/sys-apps/grep-3.6/work/grep-3.6/tests/gt-stack-overflow.bWE3
+ rm -rf /var/tmp/portage/sys-apps/grep-3.6/work/grep-3.6/tests/gt-stack-overflow.bWE3
+ exit 1
FAIL stack-overflow (exit status: 1)