On Fri, 27 Jun 2025 21:55:25 +0200 Harald Welte <laforge@gnumonks.org> wrote:> Package: dynamips
regression between the build for debian bookworm and unstable.
Hello Harald,
I just tried to find out why it is crashing.
And it happens with this instruction, inside glibc:
=> 0x7f365e01bd98 <__vsnprintf_internal+72>: movaps %xmm0,(%rsp)
(rr) print/x $rsp
$1 = 0x7f36501fe5f8
(rr) bt
#0 0x00007f365e01bd98 in __printf_buffer_init_end (buf=0x7f36501fe5f8, base=0x7f36501fe7c8 "", end=0x7f36501fe8c8 "\200\b\363z\217U", mode=__printf_buffer_mode_snprintf) at ../include/printf_buffer.h:124
#1 __printf_buffer_init (buf=0x7f36501fe5f8, base=0x7f36501fe7c8 "", len=256, mode=__printf_buffer_mode_snprintf) at ../include/printf_buffer.h:137
#2 __printf_buffer_snprintf_init (buf=0x7f36501fe5f8, buffer=0x7f36501fe7c8 "", length=256) at ./libio/vsnprintf.c:61
#3 __vsnprintf_internal (string=string@entry=0x7f36501fe7c8 "", maxlen=maxlen@entry=256, format=0x558f51dd5d55 "CPU%u: %s", args=args@entry=0x7f36501fe6b8, mode_flags=mode_flags@entry=2) at ./libio/vsnprintf.c:95
#4 0x00007f365e0b0aa0 in ___snprintf_chk (s=s@entry=0x7f36501fe7c8 "", maxlen=maxlen@entry=256, flag=flag@entry=1, slen=slen@entry=256, format=format@entry=0x558f51dd5d55 "CPU%u: %s") at ./debug/snprintf_chk.c:38
#5 0x0000558f51d5907c in snprintf (__fmt=0x558f51dd5d55 "CPU%u: %s", __n=256, __s=<optimized out>) at /usr/include/x86_64-linux-gnu/bits/stdio2.h:54
#6 cpu_log (cpu=cpu@entry=0x558f7af9d6e0, module=module@entry=0x558f51dd77ae "IO_FPGA", format=format@entry=0x558f51ddf480 "read from addr 0x%x, pc=0x%llx (size=%u)\n") at ./stable/cpu.c:128
#7 0x0000558f51d91b12 in dev_c7200_iofpga_access (cpu=0x558f7af9d6e0, dev=<optimized out>, offset=928, op_size=2, op_type=<optimized out>, data=0x7f36501fea00) at ./common/dev_c7200_iofpga.c:637
#8 0x0000558f51d5ff0d in dev_access_fast (data=0x7f36501fea00, op_type=0, op_size=2, offset=<optimized out>, dev_id=<optimized out>, cpu=<optimized out>) at ./common/device.h:94
#9 mips64_mts32_access (data=<optimized out>, op_type=<optimized out>, op_size=<optimized out>, op_code=<optimized out>, vaddr=<optimized out>, cpu=<optimized out>) at ./stable/mips64_mem.c:439
#10 mips64_mts32_lhu (cpu=0x558f7af9d8f0, vaddr=18446744072610907040, reg=<optimized out>) at ./stable/mips_mts.c:183
#11 0x00007f36540e2cc9 in ?? ()
#12 0x0000558f51d62fe5 in mips64_jit_tcb_exec (block=<optimized out>, cpu=<optimized out>) at ./stable/mips64_amd64_trans.h:58
#13 mips64_jit_tcb_run (block=<optimized out>, cpu=<optimized out>) at ./stable/mips64_jit.c:687
#14 mips64_jit_run_cpu (gen=<optimized out>) at ./stable/mips64_jit.c:775
#15 0x00007f365e026b7b in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:448
#16 0x00007f365e0a45f0 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:100
And unfortunately $rsp is not aligned at a 16 byte boundary,
which seems to be causing the crash.
This may be a result of the JIT usage.
And leads to this upstream pull request:
https://github.com/GNS3/dynamips/pull/129
A package built with this single patch applied seems
to no longer crash.
Kind regards,
Bernhard
apt source dynamips
cd dynamips-0.2.14
wget https://github.com/GNS3/dynamips/commit/38e0c26aa34d38b5b002814842c688c6439c7a37.patch -O debian/patches/38e0c26aa34d38b5b002814842c688c6439c7a37.patch
echo 38e0c26aa34d38b5b002814842c688c6439c7a37.patch >> debian/patches/series
dpkg-buildpackage