Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fortranlib_test test aborts on Fedora Rawhide i686 #4926

Open
opoplawski opened this issue Oct 4, 2024 · 8 comments
Open

fortranlib_test test aborts on Fedora Rawhide i686 #4926

opoplawski opened this issue Oct 4, 2024 · 8 comments
Assignees
Labels
Component - Fortran Fortran wrappers Component - Testing Code in test or testpar directories, GitHub workflows Priority - 3. Low 🔽 Code cleanup, small feature change requests, etc. Type - Bug / Bugfix Please report security issues to help@hdfgroup.org instead of creating an issue on GitHub

Comments

@opoplawski
Copy link
Contributor

Describe the bug

============================
Fortran API: Testing fortranlib_test
============================
Fortran API: Test log for fortranlib_test
============================
corrupted size vs. prev_size

Program received signal SIGABRT: Process abort signal.

Backtrace for this error:
#0  0xf77eb1cd in ???
#1  0xf77ea27d in ???
#2  0xf7fa959f in ???
#3  0xf7fa9589 in ???
#4  0xf758415e in ???
#5  0xf752a5a0 in ???
#6  0xf7511e93 in ???
#7  0xf7512ed9 in ???
#8  0xf758f1ec in ???
#9  0xf758fd31 in ???
#10  0xf75931c7 in ???
#11  0xf75940f5 in ???
#12  0xf7c2d247 in H5MM_realloc
        at ../../src/H5MM.c:87
#13  0xf7be5157 in H5G__visit_cb
        at ../../src/H5Gint.c:944
#14  0xf7be97b5 in H5G__node_iterate
        at ../../src/H5Gnode.c:937
#15  0xf7afe9be in H5B__iterate_helper
        at ../../src/H5B.c:1086
#16  0xf7afeb6c in H5B_iterate
        at ../../src/H5B.c:1125
#17  0xf7bee234 in H5G__stab_iterate
        at ../../src/H5Gstab.c:504
#18  0xf7bef0c9 in H5G__obj_iterate
        at ../../src/H5Gobj.c:664
#19  0xf7be5476 in H5G__visit_cb
        at ../../src/H5Gint.c:1043
#20  0xf7be97b5 in H5G__node_iterate
        at ../../src/H5Gnode.c:937
#21  0xf7afe9be in H5B__iterate_helper
        at ../../src/H5B.c:1086
#22  0xf7afeb6c in H5B_iterate
        at ../../src/H5B.c:1125
#23  0xf7bee234 in H5G__stab_iterate
        at ../../src/H5Gstab.c:504
#24  0xf7bef0c9 in H5G__obj_iterate
        at ../../src/H5Gobj.c:664
#25  0xf7bef43d in H5G_visit
        at ../../src/H5Gint.c:1180
#26  0xf7bef86b in H5G_get_name_by_addr
        at ../../src/H5Gname.c:1133
#27  0xf7d883a5 in H5VL__native_object_get
        at ../../src/H5VLnative_object.c:223
#28  0xf7da947e in H5VL__object_get.isra.0
        at ../../src/H5VLcallback.c:5753
#29  0xf7d7a28b in H5VL_object_get
        at ../../src/H5VLcallback.c:5785
#30  0xf7ca7d92 in H5Rget_obj_name
        at ../../src/H5R.c:1128
#31  0xf7f5005d in __h5r_MOD_h5rget_obj_name_f
        at ../../../fortran/src/H5Rff.F90:1136
#32  0x565753d9 in ???
#33  0x565727c2 in ???
#34  0x5656443e in ???
#35  0xf7513e42 in ???
#36  0xf7513f07 in ???
#37  0x56564476 in ???
#38  0xffffffff in ???
Command terminated by signal 6

Platform (please complete the following information)

  • HDF5 version - 1.14.5
  • OS and version - Fedora Rawhide i686
  • Compiler and version - gcc/gfortran 14.2.1
  • Build system - autotools
  • Any configure options you specified
+ CFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m32 -march=i686 -mtune=generic -msse2 -mfpmath=sse -mstackrealign -fasynchronous-unwind-tables -fstack-clash-protection '
+ export CFLAGS
+ CXXFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m32 -march=i686 -mtune=generic -msse2 -mfpmath=sse -mstackrealign -fasynchronous-unwind-tables -fstack-clash-protection '
+ export CXXFLAGS
+ FFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m32 -march=i686 -mtune=generic -msse2 -mfpmath=sse -mstackrealign -fasynchronous-unwind-tables -fstack-clash-protection -I/usr/lib/gfortran/modules '
+ export FFLAGS
+ FCFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m32 -march=i686 -mtune=generic -msse2 -mfpmath=sse -mstackrealign -fasynchronous-unwind-tables -fstack-clash-protection -I/usr/lib/gfortran/modules '
+ ../configure --build=i686-redhat-linux-gnu --host=i686-redhat-linux-gnu --program-prefix= --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/var --runstatedir=/run --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info --disable-silent-rules --enable-fortran --enable-hl --enable-shared --with-szlib --enable-cxx --with-default-plugindir=/usr/lib/hdf5/plugin
@vchoi-hdfgroup vchoi-hdfgroup added Component - Fortran Fortran wrappers Component - Testing Code in test or testpar directories, GitHub workflows Branch - 1.14 labels Oct 4, 2024
@derobins derobins added Priority - 2. Medium ⏹ It would be nice to have this in the next release Type - Bug / Bugfix Please report security issues to help@hdfgroup.org instead of creating an issue on GitHub labels Oct 4, 2024
@mattjala mattjala added Priority - 3. Low 🔽 Code cleanup, small feature change requests, etc. and removed Priority - 2. Medium ⏹ It would be nice to have this in the next release labels Oct 15, 2024
@pini-gh
Copy link

pini-gh commented Nov 18, 2024

Hi,

I experience the very same failure on Debian unstable for architectures armel and armhf. This is a blocker for transitioning Debian to HDF5 1.14.

@brtnfld any chance to have a patch soon?

@pini-gh
Copy link

pini-gh commented Nov 18, 2024

For what it's worth, I've run a git bisect on this issue between tags hdf5_1.14.4.3 and hdf5_1.14.5. And the first bad commit is a354576.
Unfortunately this commit is quite huge and doesn't speak by itself :(

@hjaekel
Copy link

hjaekel commented Nov 18, 2024

Similar failure also on Alpine Linux Edge on all architectures:

Describe the bug

make[5]: Entering directory '/builds/hjaekel/aports/community/hdf5/src/hdf5-1.14.5/fortran/test'
============================
Fortran API: Testing fortranlib_test 
============================
Fortran API: Test log for fortranlib_test 
============================
Program received signal SIGSEGV: Segmentation fault - invalid memory reference.
Backtrace for this error:
#0  0x7f38d4b0b32e in ???
#1  0x7f38d4b0a315 in ???
#2  0x7f38d521c5a3 in ???
Command terminated by signal 11
real	0m 0.04s
user	0m 0.01s
sys	0m 0.02s
make[5]: *** [Makefile:1640: fortranlib_test.chkexe_] Error 1

Platform (please complete the following information)

  • HDF5 version - 1.14.5
  • OS and version - Alpine Linux Edge
  • Compiler and version - gcc/gfortran 14.2.0
  • Build system - autotools 2.72
  • Any configure options you specified - ./configure --prefix=/usr --docdir=/usr/share/doc/hdf5/ --with-examplesdir='/usr/share/doc/hdf5/examples' --enable-static --disable-sharedlib-rpath --enable-build-mode=production --enable-hl --enable-cxx --enable-fortran --enable-java --with-pic --with-zlib --with-szlib --with-default-api-version=v18

@pini-gh
Copy link

pini-gh commented Nov 18, 2024

For what it's worth, I've run a git bisect on this issue between tags hdf5_1.14.4.3 and hdf5_1.14.5. And the first bad commit is a354576. Unfortunately this commit is quite huge and doesn't speak by itself :(

I've run another git bisect on the develop branch between april 22nd and may 7th and found abf8b01 as the first bad commit:

commit abf8b01f5530b7f20e3840ffd0024c02798d110b
Author: Scot Breitenfeld <brtnfld@hdfgroup.org>
Date:   Wed May 1 07:39:01 2024 -0500

    H5R Fortran wrappers and misc. H5R API/DOC updates (#4446)
    
        - Add Fortran H5R APIs:
          h5rcreate_attr_f, h5rcreate_object_f, h5rcreate_region_f,
          h5ropen_attr_f, h5ropen_object_f, h5ropen_region_f,
          h5rget_file_name_f, h5rget_attr_name_f, h5rget_obj_name_f,
          h5rcopy_f, h5requal_f, h5rdestroy_f, h5rget_type_f
    
        - Fixed function H5Requal actually to compare the reference pointers
    
          Fixed an issue with H5Requal always returning true because the
          function was only comparing the ref2_ptr to itself.

 doxygen/aliases                    |   4 +
 fortran/src/H5Rff.F90              | 622 ++++++++++++++++++++++++++++++++++++-
 fortran/src/H5Sff.F90              |   2 +-
 fortran/src/H5_f.c                 |  10 +-
 fortran/src/H5_ff.F90              |  14 +-
 fortran/src/H5f90global.F90        |  25 +-
 fortran/src/hdf5_fortrandll.def.in |  13 +
 fortran/test/fortranlib_test.F90   |   5 +
 fortran/test/tH5R.F90              | 394 ++++++++++++++++++++++-
 release_docs/RELEASE.txt           |  12 +
 src/H5Fpublic.h                    |  16 +-
 src/H5Ipublic.h                    |  12 +-
 src/H5Ppublic.h                    |  20 +-
 src/H5R.c                          |   2 +-
 src/H5Rpublic.h                    |  85 ++---
 test/trefer.c                      |  47 ++-
 16 files changed, 1164 insertions(+), 119 deletions(-)

@brtnfld I hope you can take over from here. Please let me know if you need more information.

EDIT: Fixed the commit link which was wrong. Sorry about that.

@pini-gh
Copy link

pini-gh commented Nov 18, 2024

Full backtrace:

Backtrace for this error:
#0  0xf76fc885 in ???
#1  0xf76fb97d in ???
#2  0xf7f8b56f in ???
#3  0xf7f8b559 in ???
#4  0xf73eea1e in ???
#5  0xf7397ef0 in ???
#6  0xf737f2d4 in ???
#7  0xf738031f in ???
#8  0xf73f9f8a in ???
#9  0xf73fa882 in ???
#10  0xf73fdca7 in ???
#11  0xf73feba5 in ???
#12  0xf7bfa2e2 in H5MM_realloc
	at /home/hdf5/hdf5/src/H5MM.c:87
#13  0xf7b89a8d in H5G__visit_cb
	at /home/hdf5/hdf5/src/H5Gint.c:941
#14  0xf7b923fc in H5G__node_iterate
	at /home/hdf5/hdf5/src/H5Gnode.c:939
#15  0xf7a2e5a5 in H5B__iterate_helper
	at /home/hdf5/hdf5/src/H5B.c:1088
#16  0xf7a2e703 in H5B_iterate
	at /home/hdf5/hdf5/src/H5B.c:1127
#17  0xf7b9a5c7 in H5G__stab_iterate
	at /home/hdf5/hdf5/src/H5Gstab.c:504
#18  0xf7b95cea in H5G__obj_iterate
	at /home/hdf5/hdf5/src/H5Gobj.c:664
#19  0xf7b8a038 in H5G__visit_cb
	at /home/hdf5/hdf5/src/H5Gint.c:1040
#20  0xf7b923fc in H5G__node_iterate
	at /home/hdf5/hdf5/src/H5Gnode.c:939
#21  0xf7a2e5a5 in H5B__iterate_helper
	at /home/hdf5/hdf5/src/H5B.c:1088
#22  0xf7a2e703 in H5B_iterate
	at /home/hdf5/hdf5/src/H5B.c:1127
#23  0xf7b9a5c7 in H5G__stab_iterate
	at /home/hdf5/hdf5/src/H5Gstab.c:504
#24  0xf7b95cea in H5G__obj_iterate
	at /home/hdf5/hdf5/src/H5Gobj.c:664
#25  0xf7b8a6f1 in H5G_visit
	at /home/hdf5/hdf5/src/H5Gint.c:1177
#26  0xf7b900cf in H5G_get_name_by_addr
	at /home/hdf5/hdf5/src/H5Gname.c:1133
#27  0xf7e1dd1e in H5VL__native_object_get
	at /home/hdf5/hdf5/src/H5VLnative_object.c:223
#28  0xf7e047b9 in H5VL__object_get
	at /home/hdf5/hdf5/src/H5VLcallback.c:5887
#29  0xf7e04904 in H5VL_object_get
	at /home/hdf5/hdf5/src/H5VLcallback.c:5919
#30  0xf7cb90e1 in H5Rget_obj_name
	at /home/hdf5/hdf5/src/H5R.c:1128
#31  0xf7f4df05 in __h5r_MOD_h5rget_obj_name_f
	at /home/hdf5/hdf5/fortran/src/H5Rff.F90:1136
#32  0x5665c7bb in __th5r_MOD_v3reftest
	at /home/hdf5/hdf5/fortran/test/tH5R.F90:677
#33  0x56677ff1 in fortranlibtest
	at /home/hdf5/hdf5/fortran/test/fortranlib_test.F90:145
#34  0x566788d6 in main
	at /home/hdf5/hdf5/fortran/test/fortranlib_test.F90:28

@pini-gh
Copy link

pini-gh commented Nov 19, 2024

As I understand it the error corrupted size vs. prev_size and the core dump are triggered by realloc() when its internal data is corrupted.

This corruption occurs for 32bit architectures only and seems caused by this line in the test:

  CALL h5rget_obj_name_f(C_LOC(ref_ptr(2)), "", error, name_len=buf_size )

If I replace the empty string parameter with a 14 chars string then the whole test is successful.

@brtnfld
Copy link
Contributor

brtnfld commented Nov 20, 2024

Correct, that is what I discovered for #5036. The only test that fails is with h5rget_obj_name_f with optional parameters and a blank string (or a smaller string) being passed in. But with the optional parameters, it does not use the string, so it really should not matter. It seg faults when returning from the Fortran call; the C call is successful. If I specify a specific string length to pass to the API, I can get it to pass, as you've seen. I think it is probably a compiler issue, but I've had not had the time to investigate it further. We are not typically testing with GCC 14.x. Is it possible to use an older version of the compiler to see if it is problem? We've not had this issue and we test with a wide variety of compilers.

@pini-gh
Copy link

pini-gh commented Nov 20, 2024

I've tested with GCC 13 and GCC 12. Same problem. I guess this might be a glibc issue then. Debian unstable has glibc 2.40 while Debian bookworm has 2.36 and it doesn't fail there.

EDIT: Actually it fails on Debian bookworm as well.

EDIT2: I've tested on Debian 11 (bullseye) with GCC 9 and GCC 10. Same error. If this is a compiler issue it is very old then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component - Fortran Fortran wrappers Component - Testing Code in test or testpar directories, GitHub workflows Priority - 3. Low 🔽 Code cleanup, small feature change requests, etc. Type - Bug / Bugfix Please report security issues to help@hdfgroup.org instead of creating an issue on GitHub
Projects
None yet
Development

No branches or pull requests

7 participants