Bug#947400: hkl FTBFS on arm64: sirius segfaults
Bernhard Übelacker
bernhardu at mailbox.org
Sat Dec 28 16:06:37 GMT 2019
Dear Maintainer,
I tried to have a look and might have found something.
The crash happens because coroutine_stack_init returns NULL.
This is because of a buffer size check.
Building a package with doubled "DEFAULT_STATE_SIZE" went
through without crash (just tested on aarch64).
However, I am unfamiliar with that package, therefore cannot
estimate other consequences of that change.
Kind regards,
Bernhard
(gdb) bt
#0 0x0000aaaae0e16e30 in generator_new_ (fn=fn at entry=0xaaaae0e18ed8 <trajectory_gen_generator__>, retsize=48, retsize at entry=40) at generator/generator.c:36
#1 0x0000aaaae0e194c0 in trajectory_gen (tconfig=...) at hkl2.c:250
#2 0x0000aaaae0e19574 in Trajectory_solve (tconfig=..., gconfig=..., sconfig=..., move=1) at hkl2.c:292
#3 0x0000aaaae0e18168 in main_1 () at sirius.c:161
#4 0x0000aaaae0dee47c in main () at sirius.c:246
-------------- next part --------------
# Buster aarch64 qemu VM 2019-12-28 (running at a raspberry 3)
apt update
apt dist-upgrade
apt install systemd-coredump fakeroot htop git gdb
apt build-dep hkl
mkdir /home/benutzer/source/hkl/orig -p
cd /home/benutzer/source/hkl/orig
apt source hkl
cd
cd /home/benutzer/source/hkl
cp orig try1 -a
cd try1/hkl-5.0.0.2569
script -a "../dpkg-buildpackage_$(date +%Y-%m-%d_%H-%M-%S).log" -c "dpkg-buildpackage"
dmesg
journalctl --no-pager
coredumpctl list
coredumpctl gdb 9919
set width 0
set pagination off
bt
display/i $pc
info reg
make[4]: Entering directory '/home/benutzer/source/hkl/try1/hkl-5.0.0.2569/Documentation/figures'
gcc -DHAVE_CONFIG_H -I. -I../.. -Wextra -D_DEFAULT_SOURCE -I../.. -I../../hkl -I/usr/include/glib-2.0 -I/usr/lib/aarch64-linux-gnu/glib-2.0/include -I/usr/include/glib-2.0 -I/usr/lib/aarch64-linux-gnu/glib-2.0/include -I/usr/include -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/home/benutzer/source/hkl/try1/hkl-5.0.0.2569=. -fstack-protector-strong -Wformat -Werror=format-security -c -o sirius.o sirius.c
sirius.c:244:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
244 | main(void)
| ^~~~
/bin/bash ../../libtool --tag=CC --mode=link gcc -g -O2 -fdebug-prefix-map=/home/benutzer/source/hkl/try1/hkl-5.0.0.2569=. -fstack-protector-strong -Wformat -Werror=format-security -Wl,--whole-archive,../../hkl/.libs/libhkl.a,--no-whole-archive -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o sirius sirius.o ../../hkl/libhkl.la ../../hkl/api2/libhkl2.la -lglib-2.0 -lgobject-2.0 -lglib-2.0 -L/usr/lib/aarch64-linux-gnu -lgsl -lgslcblas -lm -lyaml
libtool: link: gcc -g -O2 -fdebug-prefix-map=/home/benutzer/source/hkl/try1/hkl-5.0.0.2569=. -fstack-protector-strong -Wformat -Werror=format-security -Wl,--whole-archive -Wl,../../hkl/.libs/libhkl.a -Wl,--no-whole-archive -Wl,-z -Wl,relro -Wl,-z -Wl,now -Wl,--as-needed -o .libs/sirius sirius.o ../../hkl/.libs/libhkl.so ../../hkl/api2/.libs/libhkl2.a -lgobject-2.0 -lglib-2.0 -L/usr/lib/aarch64-linux-gnu -lgsl -lgslcblas -lm -lyaml
cd . && ./sirius
make[4]: *** [Makefile:739: sirius-stamp] Segmentation fault (core dumped)
make[4]: Leaving directory '/home/benutzer/source/hkl/try1/hkl-5.0.0.2569/Documentation/figures'
make[3]: *** [Makefile:459: all-recursive] Error 1
make[3]: Leaving directory '/home/benutzer/source/hkl/try1/hkl-5.0.0.2569/Documentation'
make[2]: *** [Makefile:559: all-recursive] Error 1
make[2]: Leaving directory '/home/benutzer/source/hkl/try1/hkl-5.0.0.2569'
make[1]: *** [Makefile:443: all] Error 2
make[1]: Leaving directory '/home/benutzer/source/hkl/try1/hkl-5.0.0.2569'
dh_auto_build: make -j4 returned exit code 2
make: *** [debian/rules:10: build] Error 255
dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2
Script done, file is ../dpkg-buildpackage_2019-12-28_15-26-39.log
root at debian:~# journalctl --no-pager
...
Dec 28 15:36:32 debian systemd[1]: Started Process Core Dump (PID 9933/UID 0).
Dec 28 15:36:34 debian systemd-coredump[9934]: Process 9919 (sirius) of user 1000 dumped core.
Stack trace of thread 9919:
#0 0x0000aaaae0e16e30 n/a (/home/benutzer/source/hkl/try1/hkl-5.0.0.2569/Documentation/figures/.libs/sirius + 0x40e30)
#1 0x0000aaaae0e16e28 n/a (/home/benutzer/source/hkl/try1/hkl-5.0.0.2569/Documentation/figures/.libs/sirius + 0x40e28)
#2 0x0000aaaae0e194c0 n/a (/home/benutzer/source/hkl/try1/hkl-5.0.0.2569/Documentation/figures/.libs/sirius + 0x434c0)
#3 0x0000aaaae0e19574 n/a (/home/benutzer/source/hkl/try1/hkl-5.0.0.2569/Documentation/figures/.libs/sirius + 0x43574)
#4 0x0000aaaae0e18168 n/a (/home/benutzer/source/hkl/try1/hkl-5.0.0.2569/Documentation/figures/.libs/sirius + 0x42168)
#5 0x0000aaaae0dee47c n/a (/home/benutzer/source/hkl/try1/hkl-5.0.0.2569/Documentation/figures/.libs/sirius + 0x1847c)
#6 0x0000ffffa4acf2ac __libc_start_main (libc.so.6 + 0x242ac)
Dec 28 15:36:34 debian systemd[1]: systemd-coredump at 0-9933-0.service: Succeeded.
root at debian:~# coredumpctl list
TIME PID UID GID SIG COREFILE EXE
Sat 2019-12-28 15:36:34 CET 9919 1000 1000 11 present /home/benutzer/source/hkl/try1/hkl-5.0.0.2569/Documentation/figures/.libs/sirius
root at debian:~# coredumpctl gdb 9919
PID: 9919 (sirius)
UID: 1000 (benutzer)
GID: 1000 (benutzer)
Signal: 11 (SEGV)
Timestamp: Sat 2019-12-28 15:36:29 CET (4min 4s ago)
Command Line: /home/benutzer/source/hkl/try1/hkl-5.0.0.2569/Documentation/figures/.libs/sirius
Executable: /home/benutzer/source/hkl/try1/hkl-5.0.0.2569/Documentation/figures/.libs/sirius
Control Group: /user.slice/user-1000.slice/session-3.scope
Unit: session-3.scope
Slice: user-1000.slice
Session: 3
Owner UID: 1000 (benutzer)
Boot ID: ebef1b5fe6a043d2a94b1f9329380b29
Machine ID: b26c6a7c3b16414d8985adaa2301400c
Hostname: debian
Storage: /var/lib/systemd/coredump/core.sirius.1000.ebef1b5fe6a043d2a94b1f9329380b29.9919.1577543789000000000000.lz4
Message: Process 9919 (sirius) of user 1000 dumped core.
Stack trace of thread 9919:
#0 0x0000aaaae0e16e30 n/a (/home/benutzer/source/hkl/try1/hkl-5.0.0.2569/Documentation/figures/.libs/sirius + 0x40e30)
#1 0x0000aaaae0e16e28 n/a (/home/benutzer/source/hkl/try1/hkl-5.0.0.2569/Documentation/figures/.libs/sirius + 0x40e28)
#2 0x0000aaaae0e194c0 n/a (/home/benutzer/source/hkl/try1/hkl-5.0.0.2569/Documentation/figures/.libs/sirius + 0x434c0)
#3 0x0000aaaae0e19574 n/a (/home/benutzer/source/hkl/try1/hkl-5.0.0.2569/Documentation/figures/.libs/sirius + 0x43574)
#4 0x0000aaaae0e18168 n/a (/home/benutzer/source/hkl/try1/hkl-5.0.0.2569/Documentation/figures/.libs/sirius + 0x42168)
#5 0x0000aaaae0dee47c n/a (/home/benutzer/source/hkl/try1/hkl-5.0.0.2569/Documentation/figures/.libs/sirius + 0x1847c)
#6 0x0000ffffa4acf2ac __libc_start_main (libc.so.6 + 0x242ac)
GNU gdb (Debian 8.3.1-1) 8.3.1
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://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.
Type "show copying" and "show warranty" for details.
This GDB was configured as "aarch64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/benutzer/source/hkl/try1/hkl-5.0.0.2569/Documentation/figures/.libs/sirius...
[New LWP 9919]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".
Core was generated by `/home/benutzer/source/hkl/try1/hkl-5.0.0.2569/Documentation/figures/.libs/siriu'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x0000aaaae0e16e30 in generator_new_ (fn=fn at entry=0xaaaae0e18ed8 <trajectory_gen_generator__>, retsize=48, retsize at entry=40) at generator/generator.c:36
36 generator/generator.c: No such file or directory.
(gdb) set width 0
(gdb) set pagination off
(gdb) bt
#0 0x0000aaaae0e16e30 in generator_new_ (fn=fn at entry=0xaaaae0e18ed8 <trajectory_gen_generator__>, retsize=48, retsize at entry=40) at generator/generator.c:36
#1 0x0000aaaae0e194c0 in trajectory_gen (tconfig=...) at hkl2.c:250
#2 0x0000aaaae0e19574 in Trajectory_solve (tconfig=..., gconfig=..., sconfig=..., move=1) at hkl2.c:292
#3 0x0000aaaae0e18168 in main_1 () at sirius.c:161
#4 0x0000aaaae0dee47c in main () at sirius.c:246
(gdb) display/i $pc
1: x/i $pc
=> 0xaaaae0e16e30 <generator_new_+72>: str x20, [x0, #9128]
(gdb) info reg
x0 0x18 24
x1 0x2000 8192
x2 0xfffffffffffffc08 -1016
x3 0x0 0
x4 0x2bf8 11256
x5 0x1ff 511
x6 0x7 7
x7 0x1 1
x8 0x0 0
x9 0xffffa4c11b70 281473445862256
x10 0x3 3
x11 0x0 0
x12 0x2030 8240
x13 0x0 0
x14 0x3 3
x15 0xaaaaf12cc008 187651167404040
x16 0x20 32
x17 0x0 0
x18 0x1fff 8191
x19 0x23e0 9184
x20 0xaaaaf12d7810 187651167451152
x21 0xaaaae0e18ed8 187650894040792
x22 0xfffffc73fbf0 281474917202928
x23 0xfffffc73fe40 281474917203520
x24 0xaaaaf12d77e0 187651167451104
x25 0xfffffc73fc30 281474917202992
x26 0xaaaae0e43268 187650894213736
x27 0xfffffc73ff00 281474917203712
x28 0xfffffc73fdc0 281474917203392
x29 0xfffffc73fab0 281474917202608
x30 0xaaaae0e16e28 187650894032424
sp 0xfffffc73fab0 0xfffffc73fab0
pc 0xaaaae0e16e30 0xaaaae0e16e30 <generator_new_+72>
cpsr 0x20001000 [ EL=0 C ]
fpsr 0x10 16
fpcr 0x0 0
(gdb) bt full
#0 0x0000aaaae0e16e30 in generator_new_ (fn=fn at entry=0xaaaae0e18ed8 <trajectory_gen_generator__>, retsize=48, retsize at entry=40) at generator/generator.c:36
base = 0xaaaaf12d7810 ""
metasize = 9184
stack = 0x0
ret = <optimized out>
gen = 0x18
#1 0x0000aaaae0e194c0 in trajectory_gen (tconfig=...) at hkl2.c:250
gen = <optimized out>
args = <optimized out>
#2 0x0000aaaae0e19574 in Trajectory_solve (tconfig=..., gconfig=..., sconfig=..., move=1) at hkl2.c:292
econfig = <optimized out>
solutions = 0xaaaaf12d77e0
gen = <optimized out>
geometry = <optimized out>
engines = <optimized out>
sample = <optimized out>
detector = <optimized out>
stats = <optimized out>
#3 0x0000aaaae0e18168 in main_1 () at sirius.c:161
i = <optimized out>
solutions = <optimized out>
plot = {x = {item = 0x0, size = 0, alloc = 0}, y = {item = 0x0, size = <optimized out>, alloc = <optimized out>}}
gaas = {name = 0xaaaae0e1f368 "GaAs", lattice = {tag = LATTICE_CUBIC, {cubic = {a = 5.6532999999999998}, hexagonal = {a = 5.6532999999999998, c = 0}, tetragonal = {a = 5.6532999999999998, c = 0}}}, ux = -1.570855353830199, uy = 0.0022526964655490808, uz = -2.7910209331123066}
gconfig = {tag = GEOMETRY_SOLEIL_SIRIUS_KAPPA, {e4ch = {wavelength = 1.458637, {positions = {-0.51932020000000001, 64.785315999999995, 133.562138, -80.968999999999994}, {omega = -0.51932020000000001, chi = 64.785315999999995, phi = 133.562138, tth = -80.968999999999994}}}, e4cv = {wavelength = 1.458637, {positions = {-0.51932020000000001, 64.785315999999995, 133.562138, -80.968999999999994}, {omega = -0.51932020000000001, chi = 64.785315999999995, phi = 133.562138, tth = -80.968999999999994}}}, e6c = {wavelength = 1.458637, {positions = {-0.51932020000000001, 64.785315999999995, 133.562138, -80.968999999999994, -0.0223369, 30.000029900000001}, {mu = -0.51932020000000001, komega = 64.785315999999995, kappa = 133.562138, kphi = -80.968999999999994, gamma = -0.0223369, delta = 30.000029900000001}}}, k4ch = {wavelength = 1.458637, {positions = {-0.51932020000000001, 64.785315999999995, 133.562138, -80.968999999999994}, {komega = -0.51932020000000001, kappa = 64.785315999999995, kphi = 133.562138, tth = -80.968999999999994}}}, k4cv = {wavelength = 1.458637, {positions = {-0.51932020000000001, 64.785315999999995, 133.562138, -80.968999999999994}, {komega = -0.51932020000000001, kappa = 64.785315999999995, kphi = 133.562138, tth = -80.968999999999994}}}, k6c = {wavelength = 1.458637, {positions = {-0.51932020000000001, 64.785315999999995, 133.562138, -80.968999999999994, -0.0223369, 30.000029900000001}, {mu = -0.51932020000000001, komega = 64.785315999999995, kappa = 133.562138, kphi = -80.968999999999994, gamma = -0.0223369, delta = 30.000029900000001}}}, soleil_sirius_kappa = {wavelength = 1.458637, {positions = {-0.51932020000000001, 64.785315999999995, 133.562138, -80.968999999999994, -0.0223369, 30.000029900000001}, {mu = -0.51932020000000001, komega = 64.785315999999995, kappa = 133.562138, kphi = -80.968999999999994, delta = -0.0223369, gamma = 30.000029900000001}}}, soleil_sixs_med_2_3 = {wavelength = 1.458637, {positions = {-0.51932020000000001, 64.785315999999995, 133.562138, -80.968999999999994, -0.0223369, 30.000029900000001}, {beta = -0.51932020000000001, mu = 64.785315999999995, omega = 133.562138, gamma = -80.968999999999994, delta = -0.0223369, eta_a = 30.000029900000001}}}, soleil_sixs_med_2_3_v2 = {wavelength = 1.458637, {positions = {-0.51932020000000001, 64.785315999999995, 133.562138, -80.968999999999994, -0.0223369}, {mu = -0.51932020000000001, omega = 64.785315999999995, gamma = 133.562138, delta = -80.968999999999994, eta_a = -0.0223369}}}, zaxis = {wavelength = 1.458637, {positions = {-0.51932020000000001, 64.785315999999995, 133.562138, -80.968999999999994}, {mu = -0.51932020000000001, omega = 64.785315999999995, delta = 133.562138, gamma = -80.968999999999994}}}}}
gconfig2 = {tag = GEOMETRY_SOLEIL_SIRIUS_KAPPA, {e4ch = {wavelength = 1.458637, {positions = {-0.51932020000000001, 64.785315999999995, 133.562138, 124.96899999999999}, {omega = -0.51932020000000001, chi = 64.785315999999995, phi = 133.562138, tth = 124.96899999999999}}}, e4cv = {wavelength = 1.458637, {positions = {-0.51932020000000001, 64.785315999999995, 133.562138, 124.96899999999999}, {omega = -0.51932020000000001, chi = 64.785315999999995, phi = 133.562138, tth = 124.96899999999999}}}, e6c = {wavelength = 1.458637, {positions = {-0.51932020000000001, 64.785315999999995, 133.562138, 124.96899999999999, -0.0223369, 30.000029900000001}, {mu = -0.51932020000000001, komega = 64.785315999999995, kappa = 133.562138, kphi = 124.96899999999999, gamma = -0.0223369, delta = 30.000029900000001}}}, k4ch = {wavelength = 1.458637, {positions = {-0.51932020000000001, 64.785315999999995, 133.562138, 124.96899999999999}, {komega = -0.51932020000000001, kappa = 64.785315999999995, kphi = 133.562138, tth = 124.96899999999999}}}, k4cv = {wavelength = 1.458637, {positions = {-0.51932020000000001, 64.785315999999995, 133.562138, 124.96899999999999}, {komega = -0.51932020000000001, kappa = 64.785315999999995, kphi = 133.562138, tth = 124.96899999999999}}}, k6c = {wavelength = 1.458637, {positions = {-0.51932020000000001, 64.785315999999995, 133.562138, 124.96899999999999, -0.0223369, 30.000029900000001}, {mu = -0.51932020000000001, komega = 64.785315999999995, kappa = 133.562138, kphi = 124.96899999999999, gamma = -0.0223369, delta = 30.000029900000001}}}, soleil_sirius_kappa = {wavelength = 1.458637, {positions = {-0.51932020000000001, 64.785315999999995, 133.562138, 124.96899999999999, -0.0223369, 30.000029900000001}, {mu = -0.51932020000000001, komega = 64.785315999999995, kappa = 133.562138, kphi = 124.96899999999999, delta = -0.0223369, gamma = 30.000029900000001}}}, soleil_sixs_med_2_3 = {wavelength = 1.458637, {positions = {-0.51932020000000001, 64.785315999999995, 133.562138, 124.96899999999999, -0.0223369, 30.000029900000001}, {beta = -0.51932020000000001, mu = 64.785315999999995, omega = 133.562138, gamma = 124.96899999999999, delta = -0.0223369, eta_a = 30.000029900000001}}}, soleil_sixs_med_2_3_v2 = {wavelength = 1.458637, {positions = {-0.51932020000000001, 64.785315999999995, 133.562138, 124.96899999999999, -0.0223369}, {mu = -0.51932020000000001, omega = 64.785315999999995, gamma = 133.562138, delta = 124.96899999999999, eta_a = -0.0223369}}}, zaxis = {wavelength = 1.458637, {positions = {-0.51932020000000001, 64.785315999999995, 133.562138, 124.96899999999999}, {mu = -0.51932020000000001, omega = 64.785315999999995, delta = 133.562138, gamma = 124.96899999999999}}}}}
mode = {tag = MODE_HKL_BISSECTOR_VERTICAL}
tconfig1 = {tag = TRAJECTORY_HKL_FROM_TO, {hklfromto = {h0 = 0, k0 = 0, l0 = 1, h1 = 0, k1 = 0, l1 = 6, n = 11, mode = {tag = MODE_HKL_BISSECTOR_VERTICAL}}}}
tconfig2 = {tag = TRAJECTORY_HKL_FROM_TO, {hklfromto = {h0 = 0, k0 = 0, l0 = 1, h1 = 0, k1 = 0, l1 = 6, n = 101, mode = {tag = MODE_HKL_BISSECTOR_VERTICAL}}}}
#4 0x0000aaaae0dee47c in main () at sirius.c:246
(gdb) print *environ at 78
$52 = {
0xfffffc740e53 "SHELL=/bin/bash"
0xfffffc740e63 "DEB_HOST_ARCH_LIBC=gnu"
0xfffffc740e7a "DEB_TARGET_GNU_SYSTEM=linux-gnu"
0xfffffc740e9a "GCJFLAGS=-g -O2 -fdebug-prefix-map=/home/benutzer/source/hkl/try1/hkl-5.0.0.2569=. -fstack-protector-strong"
0xfffffc740f06 "DEB_HOST_MULTIARCH=aarch64-linux-gnu"
0xfffffc740f2b "LANGUAGE=en_US:en"
0xfffffc740f3d "MAKE_TERMOUT=/dev/pts/2"
0xfffffc740f55 "DEB_TARGET_ARCH_CPU=arm64"
0xfffffc740f6f "DEB_TARGET_ARCH_BITS=64"
0xfffffc740f87 "FFLAGS=-g -O2 -fdebug-prefix-map=/home/benutzer/source/hkl/try1/hkl-5.0.0.2569=. -fstack-protector-strong"
0xfffffc740ff1 "PWD=/home/benutzer/source/hkl/try1/hkl-5.0.0.2569/Documentation/figures"
0xfffffc741039 "DEB_BUILD_MULTIARCH=aarch64-linux-gnu"
0xfffffc74105f "SOURCE_DATE_EPOCH=1576084701"
0xfffffc74107c "LOGNAME=benutzer"
0xfffffc74108d "XDG_SESSION_TYPE=tty"
0xfffffc7410a2 "DEB_HOST_GNU_SYSTEM=linux-gnu"
0xfffffc7410c0 "DEB_RULES_REQUIRES_ROOT=binary-targets"
0xfffffc7410e7 "DEB_BUILD_ARCH_BITS=64"
0xfffffc7410fe "CXXFLAGS=-g -O2 -fdebug-prefix-map=/home/benutzer/source/hkl/try1/hkl-5.0.0.2569=. -fstack-protector-strong -Wformat -Werror=format-security"
0xfffffc74118b "DEB_BUILD_ARCH_OS=linux"
0xfffffc7411a3 "LDFLAGS=-Wl,-z,relro -Wl,-z,now -Wl,--as-needed"
0xfffffc7411d3 "HOME=/home/benutzer"
0xfffffc7411e7 "LANG=en_US.UTF-8"
0xfffffc7411f8 "LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc"...
0xfffffc7417da "DEB_HOST_ARCH_ABI=base"
0xfffffc7417f1 "DEB_TARGET_ARCH_LIBC=gnu"
0xfffffc74180a "DEB_TARGET_GNU_TYPE=aarch64-linux-gnu"
0xfffffc741830 "DEB_TARGET_ARCH_ABI=base"
0xfffffc741849 "CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2"
0xfffffc741872 "SSH_CONNECTION=192.168.178.25 53482 10.0.2.15 22"
0xfffffc7418a3 "DEB_TARGET_ARCH=arm64"
0xfffffc7418b9 "DH_VERBOSE=1"
0xfffffc7418c6 "DEB_BUILD_ARCH=arm64"
0xfffffc7418db "DEB_TARGET_ARCH_OS=linux"
0xfffffc7418f4 "MFLAGS=-w -j4 --jobserver-auth=3,4"
0xfffffc741917 "FCFLAGS=-g -O2 -fdebug-prefix-map=/home/benutzer/source/hkl/try1/hkl-5.0.0.2569=. -fstack-protector-strong"
0xfffffc741982 "XDG_SESSION_CLASS=user"
0xfffffc741999 "MAKEFLAGS=w -j4 --jobserver-auth=3,4"
0xfffffc7419be "BIN_SH=xpg4"
0xfffffc7419ca "TERM=xterm-256color"
0xfffffc7419de "DEB_TARGET_MULTIARCH=aarch64-linux-gnu"
0xfffffc741a05 "DEB_BUILD_ARCH_CPU=arm64"
0xfffffc741a1e "DEB_BUILD_ARCH_LIBC=gnu"
0xfffffc741a36 "OBJCFLAGS=-g -O2 -fdebug-prefix-map=/home/benutzer/source/hkl/try1/hkl-5.0.0.2569=. -fstack-protector-strong -Wformat -Werror=format-security"
0xfffffc741ac4 "USER=benutzer"
0xfffffc741ad2 "MAKE_TERMERR=/dev/pts/2"
0xfffffc741aea "DEB_HOST_ARCH_BITS=64"
0xfffffc741b00 "DEB_BUILD_GNU_TYPE=aarch64-linux-gnu"
0xfffffc741b25 "DEB_BUILD_OPTIONS=parallel=4"
0xfffffc741b42 "SHLVL=3"
0xfffffc741b4a "MAKELEVEL=5"
0xfffffc741b56 "DEB_BUILD_GNU_SYSTEM=linux-gnu"
0xfffffc741b75 "MPLCONFIGDIR=/home/benutzer/source/hkl/try1/hkl-5.0.0.2569"
0xfffffc741bb0 "XDG_SESSION_ID=3"
0xfffffc741bc1 "DEB_BUILD_MAINT_OPTIONS=hardening=+all"
0xfffffc741be8 "DEB_TARGET_GNU_CPU=aarch64"
0xfffffc741c03 "DEB_TARGET_ARCH_ENDIAN=little"
0xfffffc741c21 "DEB_HOST_ARCH=arm64"
0xfffffc741c35 "DUALCASE=1"
0xfffffc741c40 "LD_LIBRARY_PATH=/home/benutzer/source/hkl/try1/hkl-5.0.0.2569/hkl/.libs"
0xfffffc741c88 "DEB_HOST_ARCH_ENDIAN=little"
0xfffffc741ca4 "XDG_RUNTIME_DIR=/run/user/1000"
0xfffffc741cc3 "SSH_CLIENT=192.168.178.25 53482 22"
0xfffffc741ce6 "DEB_HOST_GNU_TYPE=aarch64-linux-gnu"
0xfffffc741d0a "PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
0xfffffc741d48 "DEB_BUILD_ARCH_ENDIAN=little"
0xfffffc741d65 "DEB_HOST_ARCH_CPU=arm64"
0xfffffc741d7d "CFLAGS=-g -O2 -fdebug-prefix-map=/home/benutzer/source/hkl/try1/hkl-5.0.0.2569=. -fstack-protector-strong -Wformat -Werror=format-security"
0xfffffc741e08 "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus"
0xfffffc741e3e "OBJCXXFLAGS=-g -O2 -fdebug-prefix-map=/home/benutzer/source/hkl/try1/hkl-5.0.0.2569=. -fstack-protector-strong -Wformat -Werror=format-security"
0xfffffc741ece "SSH_TTY=/dev/pts/1"
0xfffffc741ee1 "DEB_HOST_GNU_CPU=aarch64"
0xfffffc741efa "DEB_HOST_ARCH_OS=linux"
0xfffffc741f11 "DEB_BUILD_GNU_CPU=aarch64"
0xfffffc741f2b "DEB_BUILD_ARCH_ABI=base"
0xfffffc741f43 "DH_INTERNAL_BUILDFLAGS=1"
0xfffffc741f5c "OLDPWD=/home/benutzer/source/hkl/try1/hkl-5.0.0.2569/Documentation/figures"
0x0}
######################
######################
######################
######################
cd /home/benutzer/source/hkl/try1/hkl-5.0.0.2569/Documentation/figures
export LD_LIBRARY_PATH=/home/benutzer/source/hkl/try1/hkl-5.0.0.2569/hkl/.libs
gdb -q --args /home/benutzer/source/hkl/try1/hkl-5.0.0.2569/Documentation/figures/.libs/sirius
set width 0
set pagination off
directory /home/benutzer/source/hkl/try1/hkl-5.0.0.2569/hkl/ccan
display/i $pc
b coroutine_stack_init
run
benutzer at debian:~/source/hkl/try1/hkl-5.0.0.2569/Documentation/figures$ gdb -q --args /home/benutzer/source/hkl/try1/hkl-5.0.0.2569/Documentation/figures/.libs/sirius
Reading symbols from /home/benutzer/source/hkl/try1/hkl-5.0.0.2569/Documentation/figures/.libs/sirius...
(gdb) set width 0
(gdb) set pagination off
(gdb) directory /home/benutzer/source/hkl/try1/hkl-5.0.0.2569/hkl/ccan
Source directories searched: /home/benutzer/source/hkl/try1/hkl-5.0.0.2569/hkl/ccan:$cdir:$cwd
(gdb) display/i $pc
1: x/i $pc
<error: No registers.>
(gdb) b coroutine_stack_init
Breakpoint 1 at 0x40ab8: file coroutine/coroutine.c, line 60.
(gdb) run
Starting program: /home/benutzer/source/hkl/try1/hkl-5.0.0.2569/Documentation/figures/.libs/sirius
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".
Breakpoint 1, coroutine_stack_init (buf=buf at entry=0xaaaaaab28810, bufsize=bufsize at entry=8192, metasize=metasize at entry=9184) at coroutine/coroutine.c:60
60 size_t size = bufsize - sizeof(*stack) - metasize;
1: x/i $pc
=> 0xaaaaaaaeaab8 <coroutine_stack_init>: add x4, x2, #0x818
(gdb) stepi
0x0000aaaaaaaeaabc 60 size_t size = bufsize - sizeof(*stack) - metasize;
1: x/i $pc
=> 0xaaaaaaaeaabc <coroutine_stack_init+4>: sub x2, x1, x2
(gdb)
0x0000aaaaaaaeaac0 60 size_t size = bufsize - sizeof(*stack) - metasize;
1: x/i $pc
=> 0xaaaaaaaeaac0 <coroutine_stack_init+8>: mov x3, x0
(gdb)
0x0000aaaaaaaeaac4 60 size_t size = bufsize - sizeof(*stack) - metasize;
1: x/i $pc
=> 0xaaaaaaaeaac4 <coroutine_stack_init+12>: cmp x4, x1
(gdb)
0x0000aaaaaaaeaac8 60 size_t size = bufsize - sizeof(*stack) - metasize;
1: x/i $pc
=> 0xaaaaaaaeaac8 <coroutine_stack_init+16>: sub x2, x2, #0x18
(gdb)
66 if (bufsize < (COROUTINE_MIN_STKSZ + sizeof(*stack) + metasize))
1: x/i $pc
=> 0xaaaaaaaeaacc <coroutine_stack_init+20>: b.hi 0xaaaaaaaeaaf0 <coroutine_stack_init+56> // b.pmore
(gdb)
0x0000aaaaaaaeaaf0 79 return stack;
1: x/i $pc
=> 0xaaaaaaaeaaf0 <coroutine_stack_init+56>: mov x0, #0x0 // #0
(gdb)
0x0000aaaaaaaeaaf4 79 return stack;
1: x/i $pc
=> 0xaaaaaaaeaaf4 <coroutine_stack_init+60>: ret
(gdb)
0x0000aaaaaaaeae28 in generator_new_ (fn=fn at entry=0xaaaaaaaeced8 <trajectory_gen_generator__>, retsize=48, retsize at entry=40) at generator/generator.c:34
34 stack = coroutine_stack_init(base, size, metasize);
1: x/i $pc
=> 0xaaaaaaaeae28 <generator_new_+64>: mov x3, x0
(gdb)
36 ret = gen + 1;
1: x/i $pc
=> 0xaaaaaaaeae2c <generator_new_+68>: add x0, x0, #0x18
(gdb)
0x0000aaaaaaaeae30 36 ret = gen + 1;
1: x/i $pc
=> 0xaaaaaaaeae30 <generator_new_+72>: str x20, [x0, #9128]
(gdb)
Program received signal SIGSEGV, Segmentation fault.
0x0000aaaaaaaeae30 in generator_new_ (fn=fn at entry=0xaaaaaaaeced8 <trajectory_gen_generator__>, retsize=48, retsize at entry=40) at generator/generator.c:36
36 ret = gen + 1;
1: x/i $pc
=> 0xaaaaaaaeae30 <generator_new_+72>: str x20, [x0, #9128]
(gdb) disassemble coroutine_stack_init
Dump of assembler code for function coroutine_stack_init:
0x0000aaaaaaaeaab8 <+0>: add x4, x2, #0x818
0x0000aaaaaaaeaabc <+4>: sub x2, x1, x2
0x0000aaaaaaaeaac0 <+8>: mov x3, x0
0x0000aaaaaaaeaac4 <+12>: cmp x4, x1
0x0000aaaaaaaeaac8 <+16>: sub x2, x2, #0x18
0x0000aaaaaaaeaacc <+20>: b.hi 0xaaaaaaaeaaf0 <coroutine_stack_init+56> // b.pmore
0x0000aaaaaaaeaad0 <+24>: mov x1, #0xb00f // #45071
0x0000aaaaaaaeaad4 <+28>: add x0, x0, x2
0x0000aaaaaaaeaad8 <+32>: movk x1, #0x574c, lsl #16
0x0000aaaaaaaeaadc <+36>: movk x1, #0xc040, lsl #32
0x0000aaaaaaaeaae0 <+40>: movk x1, #0xc040, lsl #48
0x0000aaaaaaaeaae4 <+44>: str x1, [x3, x2]
0x0000aaaaaaaeaae8 <+48>: str x2, [x0, #8]
0x0000aaaaaaaeaaec <+52>: ret
0x0000aaaaaaaeaaf0 <+56>: mov x0, #0x0 // #0
0x0000aaaaaaaeaaf4 <+60>: ret
End of assembler dump.
(gdb) list coroutine_stack_init
55
56 struct coroutine_stack *coroutine_stack_init(void *buf, size_t bufsize,
57 size_t metasize)
58 {
59 struct coroutine_stack *stack;
60 size_t size = bufsize - sizeof(*stack) - metasize;
61
62 #ifdef MINSIGSTKSZ
63 BUILD_ASSERT(COROUTINE_MIN_STKSZ >= MINSIGSTKSZ);
64 #endif
65
66 if (bufsize < (COROUTINE_MIN_STKSZ + sizeof(*stack) + metasize))
67 return NULL; <<<<<<<<<<< seems we leave here?
68
69 #if HAVE_STACK_GROWS_UPWARDS
70 stack = (char *)buf + metasize;
71 #else
72 stack = (struct coroutine_stack *)
73 ((char *)buf + bufsize - metasize) - 1;
74 #endif
75
76 stack->magic = COROUTINE_STACK_MAGIC_BUF;
77 stack->size = size;
78 vg_register_stack(stack);
79 return stack;
80 }
81
./hkl/ccan/coroutine/coroutine.h:53:#define COROUTINE_MIN_STKSZ 2048
(gdb) print bufsize
$1 = 8192
(gdb) print sizeof(*stack)
$2 = 24
(gdb) print metasize
$3 = 9184
(gdb) print 2048 + sizeof(*stack) + metasize
$4 = 11256
(gdb) print bufsize < 2048 + sizeof(*stack) + metasize
$5 = 1
(gdb) list generator_new_
18
19 void *generator_new_(void (*fn)(void *), size_t retsize)
20 {
21 char *base;
22 size_t size = DEFAULT_STATE_SIZE;
23 size_t metasize = generator_metasize(retsize);
24 struct coroutine_stack *stack;
25 void *ret;
26 struct generator_ *gen;
27
28 base = malloc(size);
29 if (!base)
30 abort();
31
32 retsize = (retsize + STATE_ALIGN) & ~(STATE_ALIGN - 1);
33
34 stack = coroutine_stack_init(base, size, metasize); <<<<<<<<<< size
35 gen = coroutine_stack_to_metadata(stack, metasize);
36 ret = gen + 1;
37
38 gen->base = base;
39 gen->complete = false;
40
41 coroutine_init(&gen->gen, fn, ret, stack);
42
43 return ret;
44 }
./hkl/ccan/generator/generator.c:10:#define DEFAULT_STATE_SIZE 8192
################
################
################
################
cd /home/benutzer/source/hkl
cp orig try2 -a
cd try2/hkl-5.0.0.2569
sed -i 's/#define DEFAULT_STATE_SIZE\t8192/#define DEFAULT_STATE_SIZE\t16384/g' ./hkl/ccan/generator/generator.c
dpkg-source --commit
script -a "../dpkg-buildpackage_$(date +%Y-%m-%d_%H-%M-%S).log" -c "dpkg-buildpackage"
benutzer at debian:~/source/hkl/try3/hkl-5.0.0.2569$ git diff
diff --git a/hkl-5.0.0.2569/hkl/ccan/coroutine/coroutine.c b/hkl-5.0.0.2569/hkl/ccan/coroutine/coroutine.c
index c245760..130a969 100644
--- a/hkl-5.0.0.2569/hkl/ccan/coroutine/coroutine.c
+++ b/hkl-5.0.0.2569/hkl/ccan/coroutine/coroutine.c
@@ -63,8 +63,11 @@ struct coroutine_stack *coroutine_stack_init(void *buf, size_t bufsize,
BUILD_ASSERT(COROUTINE_MIN_STKSZ >= MINSIGSTKSZ);
#endif
- if (bufsize < (COROUTINE_MIN_STKSZ + sizeof(*stack) + metasize))
+ if (bufsize < (COROUTINE_MIN_STKSZ + sizeof(*stack) + metasize)) {
+ fprintf(stderr, "coroutine_stack_init: buffer too small, size=%zd given, minimum=%zd\n",
+ bufsize, (COROUTINE_MIN_STKSZ + sizeof(*stack) + metasize));
return NULL;
+ }
#if HAVE_STACK_GROWS_UPWARDS
stack = (char *)buf + metasize;
diff --git a/hkl-5.0.0.2569/hkl/ccan/generator/generator.c b/hkl-5.0.0.2569/hkl/ccan/generator/generator.c
index 98b05e3..1e00cc8 100644
--- a/hkl-5.0.0.2569/hkl/ccan/generator/generator.c
+++ b/hkl-5.0.0.2569/hkl/ccan/generator/generator.c
@@ -7,7 +7,7 @@
#include <hkl/ccan/generator/generator.h>
-#define DEFAULT_STATE_SIZE 8192
+#define DEFAULT_STATE_SIZE 16384
#define STATE_ALIGN ALIGNOF(struct generator_)
static size_t generator_metasize(size_t retsize)
More information about the debian-science-maintainers
mailing list