Closed anton60 closed 5 years ago
Looks like the source of the problem comes from using the libc6. Adding an early return;
in these functions seems to fix the problem.
https://github.com/GNS3/dynamips/blob/master/stable/vm.c#L259 https://github.com/GNS3/dynamips/blob/master/stable/vm.c#L264
Dynamips actually segfault on this line: https://github.com/GNS3/dynamips/blob/3736192f7652979f0f96bbfc5181dd3aabe1b470/common/utils.c#L268
localtime_r(&ct,&tmn); How to fix this? I try remove this block from file if (fd != NULL) { gettimeofday(&now,0); ct = now.tv_sec; localtime_r(&ct,&tmn);
strftime(buf,sizeof(buf),"%b %d %H:%M:%S",&tmn);
fprintf(fd,"%s.%03ld %s: ",buf,(long)now.tv_usec/1000,module);
vfprintf(fd,fmt,ap);
fflush(fd);
}
ios don't start [user@laptop stable]$ ./dynamips /mnt/ios/gns3/IOS\ images/c7200-adventerprisek9-mz.124-24.T5.image Cisco Router Simulation Platform (version 0.2.18-amd64/Linux stable) Copyright (c) 2005-2011 Christophe Fillot. Build date: Aug 3 2018 14:15:02
IOS image file: /mnt/ios/gns3/IOS images/c7200-adventerprisek9-mz.124-24.T5.image
ILT: loaded table "mips64j" from cache. ILT: loaded table "mips64e" from cache. ILT: loaded table "ppc32j" from cache. ILT: loaded table "ppc32e" from cache. CPU0: carved JIT exec zone of 64 Mb into 2048 pages of 32 Kb. C7200 instance 'default' (id 0): VM Status : 0 RAM size : 256 Mb IOMEM size : 0 Mb NVRAM size : 128 Kb NPE model : npe-400 Midplane : vxr IOS image : /mnt/ios/gns3/IOS images/c7200-adventerprisek9-mz.124-24.T5.image
Loading ELF file '/mnt/ios/gns3/IOS images/c7200-adventerprisek9-mz.124-24.T5.image'... ELF entry point: 0x80008000
C7200 'default': starting simulation (CPU0 PC=0xffffffffbfc00000), JIT enabled. ROMMON emulation microcode.
Launching IOS image at 0x80008000...
Restricted Rights Legend
Use, duplication, or disclosure by the Government is subject to restrictions as set forth in subparagraph (c) of the Commercial Computer Software - Restricted Rights clause at FAR sec. 52.227-19 and subparagraph (c) (1) (ii) of the Rights in Technical Data and Computer Software clause at DFARS sec. 252.227-7013.
cisco Systems, Inc.
170 West Tasman Drive
San Jose, California 95134-1706
Cisco IOS Software, 7200 Software (C7200-ADVENTERPRISEK9-M), Version 12.4(24)T5, RELEASE SOFTWARE (fc3) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2011 by Cisco Systems, Inc. Compiled Fri 04-Mar-11 06:49 by prod_rel_team
Segmentation fault (core dumped)
Try to just comment the following lines:
localtime_r(&ct,&tmn);
strftime(buf,sizeof(buf),"%b %d %H:%M:%S",&tmn);
On Fri, Aug 3, 2018, 7:27 PM anton60 notifications@github.com wrote:
localtime_r(&ct,&tmn); How to fix this? I try remove this block from file if (fd != NULL) { gettimeofday(&now,0); ct = now.tv_sec; localtime_r(&ct,&tmn);
strftime(buf,sizeof(buf),"%b %d %H:%M:%S",&tmn);
fprintf(fd,"%s.%03ld %s: ",buf,(long)now.tv_usec/1000,module); vfprintf(fd,fmt,ap); fflush(fd);
}
ios don't start [user@laptop stable]$ ./dynamips /mnt/ios/gns3/IOS\ images/c7200-adventerprisek9-mz.124-24.T5.image
Cisco Router Simulation Platform (version 0.2.18-amd64/Linux stable) Copyright (c) 2005-2011 Christophe Fillot.
Build date: Aug 3 2018 14:15:02
IOS image file: /mnt/ios/gns3/IOS images/c7200-adventerprisek9-mz.124-24.T5.image
ILT: loaded table "mips64j" from cache. ILT: loaded table "mips64e" from cache. ILT: loaded table "ppc32j" from cache. ILT: loaded table "ppc32e" from cache. CPU0: carved JIT exec zone of 64 Mb into 2048 pages of 32 Kb. C7200 instance 'default' (id 0): VM Status : 0 RAM size : 256 Mb IOMEM size : 0 Mb NVRAM size : 128 Kb NPE model : npe-400 Midplane : vxr
IOS image : /mnt/ios/gns3/IOS images/c7200-adventerprisek9-mz.124-24.T5.image
Loading ELF file '/mnt/ios/gns3/IOS images/c7200-adventerprisek9-mz.124-24.T5.image'... ELF entry point: 0x80008000
C7200 'default': starting simulation (CPU0 PC=0xffffffffbfc00000), JIT enabled. ROMMON emulation microcode.
Launching IOS image at 0x80008000...
Restricted Rights Legend
Use, duplication, or disclosure by the Government is subject to restrictions as set forth in subparagraph (c) of the Commercial Computer Software - Restricted Rights clause at FAR sec. 52.227-19 and subparagraph (c) (1) (ii) of the Rights in Technical Data and Computer Software clause at DFARS sec. 252.227-7013.
cisco Systems, Inc. 170 West Tasman Drive San Jose, California 95134 <https://maps.google.com/?q=170+West+Tasman+Drive%0D%0A+++++++San+Jose,+California+95134&entry=gmail&source=g>-1706
Cisco IOS Software, 7200 Software (C7200-ADVENTERPRISEK9-M), Version 12.4(24)T5, RELEASE SOFTWARE (fc3) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2011 by Cisco Systems, Inc. Compiled Fri 04-Mar-11 06:49 by prod_rel_team
Segmentation fault (core dumped)
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/GNS3/dynamips/issues/91#issuecomment-410225557, or mute the thread https://github.com/notifications/unsubscribe-auth/AEiE5n6zfr9tX0Ka1CYLtz960ZJiejdCks5uNDOegaJpZM4VQ2w3 .
Don't work.
if (fd != NULL) { gettimeofday(&now,0); ct = now.tv_sec; /* localtime_r(&ct,&tmn);
strftime(buf,sizeof(buf),"%b %d %H:%M:%S",&tmn);*/
fprintf(fd,"%s.%03ld %s: ",buf,(long)now.tv_usec/1000,module);
vfprintf(fd,fmt,ap);
fflush(fd);
}
[user@laptop stable]$ ./dynamips /mnt/ios/gns3/IOS\ images/c7200-adventerprisek9-mz.124-24.T5.image Cisco Router Simulation Platform (version 0.2.18-amd64/Linux stable) Copyright (c) 2005-2011 Christophe Fillot. Build date: Aug 3 2018 15:45:02
IOS image file: /mnt/ios/gns3/IOS images/c7200-adventerprisek9-mz.124-24.T5.image
ILT: loaded table "mips64j" from cache. ILT: loaded table "mips64e" from cache. ILT: loaded table "ppc32j" from cache. ILT: loaded table "ppc32e" from cache. CPU0: carved JIT exec zone of 64 Mb into 2048 pages of 32 Kb. C7200 instance 'default' (id 0): VM Status : 0 RAM size : 256 Mb IOMEM size : 0 Mb NVRAM size : 128 Kb NPE model : npe-400 Midplane : vxr IOS image : /mnt/ios/gns3/IOS images/c7200-adventerprisek9-mz.124-24.T5.image
Loading ELF file '/mnt/ios/gns3/IOS images/c7200-adventerprisek9-mz.124-24.T5.image'... ELF entry point: 0x80008000
C7200 'default': starting simulation (CPU0 PC=0xffffffffbfc00000), JIT enabled. ROMMON emulation microcode.
Launching IOS image at 0x80008000...
Restricted Rights Legend
Use, duplication, or disclosure by the Government is subject to restrictions as set forth in subparagraph (c) of the Commercial Computer Software - Restricted Rights clause at FAR sec. 52.227-19 and subparagraph (c) (1) (ii) of the Rights in Technical Data and Computer Software clause at DFARS sec. 252.227-7013.
cisco Systems, Inc.
170 West Tasman Drive
San Jose, California 95134-1706
Cisco IOS Software, 7200 Software (C7200-ADVENTERPRISEK9-M), Version 12.4(24)T5, RELEASE SOFTWARE (fc3) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2011 by Cisco Systems, Inc. Compiled Fri 04-Mar-11 06:49 by prod_rel_team
Segmentation fault (core dumped)
I still suspect something wrong with localtime. The only other location where localtime() is used is there: https://github.com/GNS3/dynamips/blob/246e32a2fa5e0e9a61af1b2cf089612b35b33b95/common/dev_nvram.c#L56 but I don't know how we could fix this...
0x00007ffff6fc94d6 in char_buffer_rewind (buffer=0x7fffec3ee618)
at vfscanf.c:224
224 vfscanf.c: No such file or directory.
(gdb) bt
#0 0x00007ffff6fc94d6 in char_buffer_rewind (buffer=0x7fffec3ee618)
at vfscanf.c:224
#1 _IO_vfscanf_internal (s=s@entry=0x7fffec3eea98,
format=format@entry=0x7ffff7113204 "%hu%n:%hu%n:%hu%n",
argptr=argptr@entry=0x7fffec3eebc8, errp=errp@entry=0x0) at vfscanf.c:487
#2 0x00007ffff6fdf79d in _IO_vsscanf (string=0x7fffd469745b "0",
format=0x7ffff7113204 "%hu%n:%hu%n:%hu%n", args=args@entry=0x7fffec3eebc8)
at iovsscanf.c:41
#3 0x00007ffff6fd91a4 in __sscanf (s=s@entry=0x7fffd469745b "0",
format=format@entry=0x7ffff7113204 "%hu%n:%hu%n:%hu%n") at sscanf.c:32
#4 0x00007ffff7031696 in parse_offset (whichrule=0, tzp=0x7fffec3eecd0)
at tzset.c:208
#5 __tzset_parse_tz (tz=<optimized out>) at tzset.c:329
#6 0x00007ffff7033c60 in __tzfile_compute (timer=<optimized out>,
use_localtime=use_localtime@entry=1,
leap_correct=leap_correct@entry=0x7fffec3eedb8,
leap_hit=leap_hit@entry=0x7fffec3eedb4,
tp=tp@entry=0x7ffff734e6a0 <_tmbuf>) at tzfile.c:684
#7 0x00007ffff703251e in __tz_convert (timer=timer@entry=0x7fffec3eedf8,
use_localtime=use_localtime@entry=1, tp=tp@entry=0x7ffff734e6a0 <_tmbuf>)
at tzset.c:587
#8 0x00007ffff702f591 in __GI_localtime (t=t@entry=0x7fffec3eedf8)
at localtime.c:39
---Type <return> to continue, or q <return> to quit---
#9 0x00005555555a5209 in get_current_time (cpu=<optimized out>)
at /root/dynamips/dynamips/common/dev_nvram.c:56
#10 dev_nvram_access (cpu=<optimized out>, dev=<optimized out>,
offset=<optimized out>, op_size=<optimized out>, op_type=<optimized out>,
data=<optimized out>) at /root/dynamips/dynamips/common/dev_nvram.c:100
#11 0x000055555558be91 in dev_access_fast (data=0x7fffec3eee30, op_type=1,
op_size=1, offset=<optimized out>, dev_id=<optimized out>,
cpu=<optimized out>) at /root/dynamips/dynamips/common/device.h:94
#12 mips64_mts32_access (data=0x7fffec3eee30, op_type=1, op_size=1, op_code=8,
vaddr=503316483, cpu=0x555555879830)
at /root/dynamips/dynamips/stable/mips64_mem.c:439
#13 mips64_mts32_sb (cpu=0x555555879830, vaddr=503316483, reg=<optimized out>)
at /root/dynamips/dynamips/stable/mips_mts.c:228
#14 0x00007fffecff9054 in ?? ()
#15 0x000055555558fc82 in mips64_jit_tcb_exec (block=<optimized out>,
cpu=0x555555879830)
at /root/dynamips/dynamips/stable/mips64_amd64_trans.h:58
#16 mips64_jit_tcb_run (block=<optimized out>, cpu=0x555555879830)
at /root/dynamips/dynamips/stable/mips64_jit.c:687
#17 mips64_jit_run_cpu (gen=<optimized out>)
at /root/dynamips/dynamips/stable/mips64_jit.c:775
#18 0x00007ffff75976db in start_thread (arg=0x7fffec3ef700)
at pthread_create.c:463
---Type <return> to continue, or q <return> to quit---
#19 0x00007ffff707f88f in clone ()
at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
The current workaround is to compile in 32-bit, please see instructions how to compile there: https://github.com/GNS3/gns3-server/issues/1363#issuecomment-404542913
Workaround doesn't work. My action is
`
[user@laptop tmp]$
[user@laptop tmp]$
[user@laptop tmp]$ git clone https://github.com/GNS3/dynamips.git
Cloning into 'dynamips'...
remote: Counting objects: 2958, done.
remote: Total 2958 (delta 0), reused 0 (delta 0), pack-reused 2958
Receiving objects: 100% (2958/2958), 2.70 MiB | 630.00 KiB/s, done.
Resolving deltas: 100% (1986/1986), done.
[user@laptop tmp]$ cd dynamips/
[user@laptop dynamips]$
[user@laptop dynamips]$ mkdir build && cd build
[user@laptop build]$
[user@laptop build]$ cmake .. -DDYNAMIPS_ARCH=x86
-- CMAKE_MODULE_PATH=/tmp/dynamips/cmake
-- The C compiler identification is GNU 8.2.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- dependencies - BEGIN
-- Performing Test ARCH_AMD64
-- Performing Test ARCH_AMD64 - Success
-- Performing Test ARCH_X86
-- Performing Test ARCH_X86 - Success
-- ARCH_AMD64=1
-- ARCH_X86=1
-- DYNAMIPS_ARCH=x86
-- Performing Test FLAGMDYNAMIC_NO_PIC
-- Performing Test FLAGMDYNAMIC_NO_PIC - Failed
-- Looking for clock_gettime in rt
-- Looking for clock_gettime in rt - found
-- USE_LIBRT=1
-- Looking for connect in socket
-- Looking for connect in socket - not found
-- Looking for gethostbyname in nsl
-- Looking for gethostbyname in nsl - not found
-- Found LibElf: /usr/lib/libelf.so
-- LIBELF_FOUND=TRUE
-- LIBELF_INCLUDE_DIRS=/usr/include
-- LIBELF_LIBRARIES=/usr/lib/libelf.so
-- LIBELF_DEFINITIONS=
-- Looking for elf_begin in /usr/lib/libelf.so
-- Looking for elf_begin in /usr/lib/libelf.so - not found
-- Looking for elf_begin in elf
-- Looking for elf_begin in elf - found
-- LIBELF_LIBRARIES=elf
-- Performing Test LIBELF_LARGEFILE
-- Performing Test LIBELF_LARGEFILE - Success
-- LIBELF_LARGEFILE=1
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- CMAKE_THREAD_LIBS_INIT=-lpthread
-- CMAKE_USE_PTHREADS_INIT=1
-- Pcap include dirs set to /usr/include
-- Pcap library set to /usr/lib/libpcap.so
-- PCAP_FOUND=YES
-- PCAP_INCLUDE_DIRS=/usr/include
-- PCAP_LIBRARIES=/usr/lib/libpcap.so
-- Looking for pcap_open_live in /usr/lib/libpcap.so
-- Looking for pcap_open_live in /usr/lib/libpcap.so - not found
-- Looking for pcap_open_live in pcap
-- Looking for pcap_open_live in pcap - found
-- PCAP_LIBRARIES=pcap
-- HAVE_PCAP=1
-- Looking for arpa/inet.h
-- Looking for arpa/inet.h - found
-- Looking for arpa/telnet.h
-- Looking for arpa/telnet.h - found
-- Looking for assert.h
-- Looking for assert.h - found
-- Looking for ctype.h
-- Looking for ctype.h - found
-- Looking for dlfcn.h
-- Looking for dlfcn.h - found
-- Looking for errno.h
-- Looking for errno.h - found
-- Looking for fcntl.h
-- Looking for fcntl.h - found
-- Looking for getopt.h
-- Looking for getopt.h - found
-- Looking for glob.h
-- Looking for glob.h - found
-- Looking for netdb.h
-- Looking for netdb.h - found
-- Looking for setjmp.h
-- Looking for setjmp.h - found
-- Looking for signal.h
-- Looking for signal.h - found
-- Looking for stdarg.h
-- Looking for stdarg.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Looking for stdio.h
-- Looking for stdio.h - found
-- Looking for stdlib.h
-- Looking for stdlib.h - found
-- Looking for string.h
-- Looking for string.h - found
-- Looking for sys/ioctl.h
-- Looking for sys/ioctl.h - found
-- Looking for sys/mman.h
-- Looking for sys/mman.h - found
-- Looking for sys/select.h
-- Looking for sys/select.h - found
-- Looking for sys/socket.h
-- Looking for sys/socket.h - found
-- Looking for sys/stat.h
-- Looking for sys/stat.h - found
-- Looking for sys/time.h
-- Looking for sys/time.h - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for sys/uio.h
-- Looking for sys/uio.h - found
-- Looking for sys/un.h
-- Looking for sys/un.h - found
-- Looking for sys/wait.h
-- Looking for sys/wait.h - found
-- Looking for termios.h
-- Looking for termios.h - found
-- Looking for time.h
-- Looking for time.h - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Looking for include files sys/types.h, netinet/tcp.h
-- Looking for include files sys/types.h, netinet/tcp.h - found
-- Looking for posix_memalign
-- Looking for posix_memalign - found
-- HAVE_POSIX_MEMALIGN=1
-- Looking for 5 include files sys/socket.h, ..., netinet/in.h
-- Looking for 5 include files sys/socket.h, ..., netinet/in.h - found
-- Looking for getaddrinfo
-- Looking for getaddrinfo - found
-- Looking for freeaddrinfo
-- Looking for freeaddrinfo - found
-- Looking for gai_strerror
-- Looking for gai_strerror - found
-- Looking for inet_pton
-- Looking for inet_pton - found
-- Looking for inet_ntop
-- Looking for inet_ntop - found
-- HAVE_IPV6=1
-- dependencies - END
-- configure - BEGIN
-- DYNAMIPS_VERSION="0.2.18"
-- DYNAMIPS_ARCH=x86
-- DYNAMIPS_CODE=stable
-- BUILD_DYNAMIPS_STABLE=ON
-- BUILD_DYNAMIPS_UNSTABLE=OFF
-- DYNAMIPS_RENAME=auto
-- DYNAMIPS_RENAME_TARGET=dynamips_x86_stable
-- BUILD_NVRAM_EXPORT=ON
-- BUILD_UDP_SEND=OFF
-- BUILD_UDP_RECV=OFF
-- ENABLE_LINUX_ETH=ON
-- ENABLE_GEN_ETH=ON
-- ENABLE_IPV6=ON
-- DYNAMIPS_FLAGS=-m32;-Wall;-O2;-fomit-frame-pointer
-- DYNAMIPS_DEFINITIONS=-DHAS_POSIX_MEMALIGN=1;-DDYNAMIPS_VERSION="0.2.18";-DJIT_ARCH="x86";-DJIT_CPU=CPU_x86;-DMIPS64_ARCH_INC_FILE="mips64_x86_trans.h";-DPPC32_ARCH_INC_FILE="ppc32_x86_trans.h";-D_FILE_OFFSET_BITS=64;-D_LARGEFILE_SOURCE;-D_LARGEFILE64_SOURCE;-DLINUX_ETH;-DGEN_ETH;-DHAS_RFC2553=1;-DOSNAME=Linux
-- DYNAMIPS_INCLUDES=/usr/include
-- DYNAMIPS_LIBRARIES=dl;rt;elf;-lpthread;pcap
-- configure - END
Summary:
CMAKE_INSTALL_PREFIX : /usr/local
DYNAMIPS_ARCH : x86
DYNAMIPS_CODE : stable
DYNAMIPS_RENAME : dynamips_x86_stable -> dynamips (auto)
BUILD_NVRAM_EXPORT : ON
BUILD_UDP_SEND : OFF
BUILD_UDP_RECV : OFF
Large File support : ENABLE_LARGEFILE=ON
Linux Ethernet (RAW sockets) : ENABLE_LINUX_ETH=ON (linux_eth)
Generic Ethernet (libpcap/WinPcap) : ENABLE_GEN_ETH=ON (gen_eth)
IPv6 support (RFC 2553) : ENABLE_IPV6=ON
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/dynamips/build
[user@laptop build]$ make
Scanning dependencies of target nvram_export
[ 0%] Building C object stable/CMakeFiles/nvram_export.dir//common/fs_nvram.c.o
[ 1%] Building C object stable/CMakeFiles/nvram_export.dir//common/nvram_export.c.o
[ 1%] Linking C executable nvram_export
[ 1%] Built target nvram_export
Scanning dependencies of target rom2c
[ 1%] Building C object stable/CMakeFiles/rom2c.dir//common/rom2c.c.o
[ 2%] Linking C executable rom2c
[ 2%] Built target rom2c
Scanning dependencies of target ppc32_microcode_dump_stable
[ 3%] Generating ppc32_microcode_dump.inc
Extracting ROM from ELF file '/tmp/dynamips/stable/ppc32_microcode'...
[ 3%] Built target ppc32_microcode_dump_stable
Scanning dependencies of target mips64_microcode_dump_stable
[ 4%] Generating mips64_microcode_dump.inc
Extracting ROM from ELF file '/tmp/dynamips/stable/mips64_microcode'...
[ 4%] Built target mips64_microcode_dump_stable
Scanning dependencies of target dynamips_x86_stable
[ 4%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/mempool.c.o
[ 5%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/registry.c.o
[ 5%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/rbtree.c.o
/tmp/dynamips/common/rbtree.c:9:19: warning: ‘rcsid’ defined but not used [-Wunused-const-variable=]
static const char rcsid[] = "$Id$";
^~~~~
[ 6%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/hash.c.o
[ 7%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/sbox.c.o
[ 7%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/utils.c.o
[ 8%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/parser.c.o
[ 8%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/plugin.c.o
[ 9%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/ptask.c.o
[ 10%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/timer.c.o
[ 10%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/crc.c.o
[ 11%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/base64.c.o
[ 11%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/net.c.o
[ 12%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/net_io.c.o
In function ‘netio_tap_open’,
inlined from ‘netio_tap_create’ at /tmp/dynamips/common/net_io.c:640:14,
inlined from ‘netio_desc_create_tap’ at /tmp/dynamips/common/net_io.c:681:8:
/tmp/dynamips/common/net_io.c:601:7: warning: ‘strncpy’ specified bound 16 equals destination size [-Wstringop-truncation]
strncpy(ifr.ifr_name,tap_devname,IFNAMSIZ);
^~~~~~~~~~
[ 13%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/net_io_bridge.c.o
[ 13%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/net_io_filter.c.o
[ 14%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/atm.c.o
[ 15%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/atm_vsar.c.o
[ 15%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/atm_bridge.c.o
[ 16%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/frame_relay.c.o
[ 16%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir/__/common/eth_switch.c.o
[ 17%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dynamips.c.o
[ 18%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/insn_lookup.c.o
[ 18%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir/vm.c.o
[ 19%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir/cpu.c.o
[ 19%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir/__/common/jit_op.c.o
[ 20%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir/mips64.c.o
[ 21%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir/mips64_mem.c.o
[ 21%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir/mips64_cp0.c.o
[ 22%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir/mips64_jit.c.o
[ 23%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir/mips64_exec.c.o
[ 23%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir/ppc32.c.o
[ 24%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir/ppc32_mem.c.o
[ 24%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir/ppc32_jit.c.o
[ 25%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir/ppc32_exec.c.o
[ 26%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir/ppc32_vmtest.c.o
[ 26%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/memory.c.o
[ 27%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/device.c.o
[ 27%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/nmc93cX6.c.o
[ 28%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/cisco_eeprom.c.o
[ 29%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir/__/common/cisco_card.c.o
[ 29%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/pci_dev.c.o
[ 30%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/pci_io.c.o
[ 30%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir/__/common/dev_zero.c.o
[ 31%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_bswap.c.o
[ 32%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_vtty.c.o
[ 32%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir/__/common/dev_ram.c.o
[ 34%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_rom.c.o
[ 35%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_nvram.c.o
[ 35%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir/__/common/dev_bootflash.c.o
[ 36%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_flash.c.o
[ 36%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_mpc860.c.o
[ 37%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir/__/common/dev_ds1620.c.o
[ 38%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_remote.c.o
[ 38%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_clpd6729.c.o
[ 39%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_pcmcia_disk.c.o
[ 39%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_gt.c.o
[ 40%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_mv64460.c.o
[ 41%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_plx.c.o
[ 41%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir/__/common/dev_dec21x50.c.o
[ 42%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_pericom.c.o
[ 43%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_ti2050b.c.o
[ 43%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir/__/common/dev_ap1011.c.o
[ 44%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_plx6520cb.c.o
[ 44%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_ns16552.c.o
[ 45%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir/__/common/dev_dec21140.c.o
[ 46%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_am79c971.c.o
[ 46%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_i8254x.c.o
[ 47%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir/__/common/dev_i8255x.c.o
[ 47%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_mueslix.c.o
[ 48%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_wic_serial.c.o
[ 49%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c3600.c.o
[ 49%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c3600_bay.c.o
[ 50%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c3600_iofpga.c.o
[ 51%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c3600_eth.c.o
[ 51%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c3600_serial.c.o
[ 52%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c7200.c.o
[ 52%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c7200_iofpga.c.o
[ 53%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c7200_mpfpga.c.o
[ 54%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c7200_sram.c.o
[ 54%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c7200_eth.c.o
[ 55%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c7200_serial.c.o
[ 55%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c7200_pos.c.o
[ 56%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c7200_bri.c.o
[ 57%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c7200_jcpa.c.o
[ 57%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir/__/common/dev_c2691.c.o
[ 58%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c2691_iofpga.c.o
[ 58%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c2691_eth.c.o
[ 59%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c2691_serial.c.o
[ 60%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c2691_wic.c.o
[ 60%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c2691_pcmod.c.o
[ 61%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c3725.c.o
[ 62%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c3725_iofpga.c.o
[ 62%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c3725_eth.c.o
[ 63%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c3725_serial.c.o
[ 63%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c3725_wic.c.o
[ 64%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c3725_pcmod.c.o
[ 65%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c3745.c.o
[ 65%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c3745_iofpga.c.o
[ 67%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c3745_eth.c.o
[ 67%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c3745_serial.c.o
[ 68%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c3745_wic.c.o
[ 69%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c3745_pcmod.c.o
[ 69%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c2600.c.o
[ 70%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c2600_pci.c.o
[ 71%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c2600_iofpga.c.o
[ 71%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c2600_eth.c.o
[ 72%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c2600_pcmod.c.o
[ 72%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c2600_wic.c.o
[ 73%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c1700.c.o
[ 74%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c1700_iofpga.c.o
[ 74%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c1700_eth.c.o
[ 75%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c1700_wic.c.o
[ 75%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c6msfc1.c.o
[ 76%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c6msfc1_iofpga.c.o
[ 77%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c6msfc1_mpfpga.c.o
[ 77%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir/__/common/dev_c6sup1.c.o
[ 78%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c6sup1_iofpga.c.o
[ 79%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_c6sup1_mpfpga.c.o
[ 79%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_nm_16esw.c.o
[ 80%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_pa_a1.c.o
[ 80%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_pa_mc8te1.c.o
[ 81%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_sb1.c.o
[ 82%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_sb1_io.c.o
[ 82%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_sb1_pci.c.o
[ 83%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir/hypervisor.c.o
[ 83%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir/__/common/hv_nio.c.o
[ 84%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/hv_nio_bridge.c.o
[ 85%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/hv_frsw.c.o
[ 85%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir/__/common/hv_atmsw.c.o
[ 86%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/hv_atm_bridge.c.o
[ 86%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/hv_ethsw.c.o
[ 87%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir/hv_vm.c.o
[ 88%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/hv_vm_debug.c.o
[ 88%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/hv_store.c.o
[ 89%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir/__/common/hv_c7200.c.o
[ 90%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/hv_c3600.c.o
[ 90%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/hv_c2691.c.o
[ 91%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir/__/common/hv_c3725.c.o
[ 91%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/hv_c3745.c.o
[ 92%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/hv_c2600.c.o
[ 93%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir/__/common/hv_c1700.c.o
[ 93%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/rommon_var.c.o
[ 94%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/get_cpu_time.c.o
[ 94%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/fs_fat.c.o
/tmp/dynamips/common/fs_fat.c: In function ‘fs_fat_format16’:
/tmp/dynamips/common/fs_fat.c:208:42: warning: ‘MB’ directive output may be truncated writing 2 bytes into a region of size between 1 and 7 [-Wformat-truncation=]
snprintf(name,sizeof(name), "DISK%dMB", (nr_sectors / (1048576 / FS_FAT_SECTOR_SIZE)));
^~
/tmp/dynamips/common/fs_fat.c:208:7: note: ‘snprintf’ output between 8 and 14 bytes into a destination of size 12
snprintf(name,sizeof(name), "DISK%dMB", (nr_sectors / (1048576 / FS_FAT_SECTOR_SIZE)));
^~~~~~~~~~~~~~~~~~
[ 95%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/fs_mbr.c.o
[ 96%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir/__/common/fs_nvram.c.o
[ 96%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir//common/dev_lxt970a.c.o
[ 97%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir/__/common/linux_eth.c.o
[ 98%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir/__/common/gen_eth.c.o
[ 98%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir/mips64_x86_trans.c.o
[100%] Building C object stable/CMakeFiles/dynamips_x86_stable.dir/ppc32_x86_trans.c.o
[100%] Linking C executable dynamips
[100%] Built target dynamips_x86_stable
[user@laptop build]$ ls
CMakeCache.txt CMakeFiles cmake_install.cmake cmake_uninstall.cmake common Makefile man stable unstable
[user@laptop build]$ cd stable/
[user@laptop stable]$ ls
CMakeFiles cmake_install.cmake dynamips Makefile mips64_microcode_dump.inc nvram_export ppc32_microcode_dump.inc rom2c
[user@laptop stable]$ ./dynamips /tmp/c7200-adventerprisek9-mz.124-24.T5.image
Cisco Router Simulation Platform (version 0.2.18-x86/Linux stable)
Copyright (c) 2005-2011 Christophe Fillot.
Build date: Aug 15 2018 18:40:04
IOS image file: /tmp/c7200-adventerprisek9-mz.124-24.T5.image
CPU0: carved JIT exec zone of 64 Mb into 2048 pages of 32 Kb. NVRAM is empty, setting config register to 0x2142 C7200 instance 'default' (id 0): VM Status : 0 RAM size : 256 Mb IOMEM size : 0 Mb NVRAM size : 128 Kb NPE model : npe-400 Midplane : vxr IOS image : /tmp/c7200-adventerprisek9-mz.124-24.T5.image
Loading ELF file '/tmp/c7200-adventerprisek9-mz.124-24.T5.image'... ELF entry point: 0x80008000
C7200 'default': starting simulation (CPU0 PC=0xffffffffbfc00000), JIT enabled. ROMMON emulation microcode.
Launching IOS image at 0x80008000... Segmentation fault (core dumped) [user@laptop stable]$ `
After make ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime dynamimps launched. Solution https://aur.archlinux.org/packages/dynamips/ bgeschka commented on 2018-10-15 14:21
I ran into a segfault, referenced here: https://github.com/GNS3/dynamips/issues/91
As for the failing call to localtime setting your timezone fixes it: ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime
Seems to run fine as for version: 0.2.18-amd64/Linux stable
Thanks for the workaround!
Like said before, the crash happens when locatime() is called in https://github.com/GNS3/dynamips/blob/master/common/dev_nvram.c#L56 and localtime_r() called in https://github.com/GNS3/dynamips/blob/master/common/utils.c#L268
It seems to only crash when the timezone set to UTC.
ls -l /etc/localtime
lrwxrwxrwx 1 root root 27 Jan 19 06:45 /etc/localtime -> /usr/share/zoneinfo/Etc/UTC
Dynamips doesn't crash anymore if the timezone is set manually with for instance ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime
or via sudo dpkg-reconfigure tzdata
.
I tried to understand why localtime()
would crash, tried many things like using localtime_r(), initializing/using the structures differently and using pthread mutexes etc. Some other projects have had a similar issue in the past but in the end I still don't understand what is wrong, maybe some problem with the libc? I couldn't reproduce the issue outside Dynamips by creating small standalone programs too :(
However, I found out that using gmtime_r()
with the timezone set to UTC appears to fix the issue. So here is the fix I came up with and that seems to work when the timezone is set to UTC or something else. Hopefully, this shouldn't bring any unexpected bug.
if (timezone == 0)
tmx = gmtime_r(&ct,&tmn);
else
tmx = localtime_r(&ct,&tmn);
Some users have reported that Dynamips 0.2.19 still crashes. The current workaround is to set the timezone: https://github.com/GNS3/gns3-server/issues/1510
Now we set a timezone directly from inside Dynamips to go around this bug. Hopefully, this will definitely solve this crash.
/* Force a timezone to avoid a bug with UTC/GMT */
tzset();
if (timezone == 0 && !getenv("TZ")) {
setenv("TZ", "Europe/London", 1);
tzset();
}
Now we set a timezone directly from inside Dynamips to go around this bug. Hopefully, this will definitely solve this crash.
/* Force a timezone to avoid a bug with UTC/GMT */ tzset(); if (timezone == 0 && !getenv("TZ")) { setenv("TZ", "Europe/London", 1); tzset(); }
Doesn't work. dynamips /mnt/files/ios/7200/c7200-adventerprisek9-mz.122-33.SRC1.bin Cisco Router Simulation Platform (version 0.2.20-amd64/Linux stable) Copyright (c) 2005-2011 Christophe Fillot. Build date: Mar 2 2019 16:49:55
IOS image file: /mnt/files/ios/7200/c7200-adventerprisek9-mz.122-33.SRC1.bin
ILT: loaded table "mips64j" from cache. ILT: loaded table "mips64e" from cache. ILT: loaded table "ppc32j" from cache. ILT: loaded table "ppc32e" from cache. CPU0: carved JIT exec zone of 64 Mb into 2048 pages of 32 Kb. C7200 instance 'default' (id 0): VM Status : 0 RAM size : 256 Mb IOMEM size : 0 Mb NVRAM size : 128 Kb NPE model : npe-400 Midplane : vxr IOS image : /mnt/files/ios/7200/c7200-adventerprisek9-mz.122-33.SRC1.bin
Loading ELF file '/mnt/files/ios/7200/c7200-adventerprisek9-mz.122-33.SRC1.bin'... ELF entry point: 0x80008000
C7200 'default': starting simulation (CPU0 PC=0xffffffffbfc00000), JIT enabled. ROMMON emulation microcode.
Segmentation fault (core dumped)
I guess we have to use the x86 version in the meantime...
I've noticed coredump on 0.2.20-x86/Linux stable with workaround
(ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime) and without workaround(ln -sf /usr/share/zoneinfo/Europe/Moscow /etc/localtime). I've collected all output.
getting this error, if i launch gns3, current version 2.1.19, but if i start with New York timezone, works fine.
019-05-28 16:27:14 ERROR project:683 Dynamips hypervisor process has stopped, return code: -11 C7200 'Ghost': generic_nvram_extract_config: Unknown error -61605
Which file can i edit to start gns3/dynamips on New York timezone, tried gns3.desktop and it breaks. Thanks in advance.
We finally got a fix thanks to this PR: https://github.com/GNS3/dynamips/pull/97
It works. Thank you.
Thanks, working. Appreciated.
GNU gdb (Ubuntu 12.0.90-0ubuntu1) 12.0.90 Copyright (C) 2022 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 "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: https://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 /usr/bin/dynamips... (No debugging symbols found in /usr/bin/dynamips)
warning: Can't open file /home/moelharrak/GNS3/projects/IPsec/project-files/dynamips/c3745-adventerprisek9_sna-mz.124-11.XW7.image-256.ghost during file-backed mapping note processing
warning: Can't open file /dev/zero (deleted) during file-backed mapping note processing
warning: Can't open file /home/moelharrak/GNS3/projects/IPsec/project-files/dynamips/5c9f56d5-7a75-4bde-9de0-d861f3eb5610/c3745_i1_rom during file-backed mapping note processing
warning: Can't open file /home/moelharrak/GNS3/projects/IPsec/project-files/dynamips/5c9f56d5-7a75-4bde-9de0-d861f3eb5610/c3745_i1_ssa during file-backed mapping note processing
[New LWP 6603]
[New LWP 6588]
[New LWP 6590]
[New LWP 6586]
[New LWP 6584]
[New LWP 6591]
[New LWP 6587]
[New LWP 6589]
[New LWP 6596]
[New LWP 6592]
[New LWP 6598]
[New LWP 6593]
[New LWP 6594]
[New LWP 6595]
[New LWP 6600]
[New LWP 6604]
[New LWP 6597]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
--Type
372 ./time/tzset.c: No such file or directory. [Current thread is 1 (Thread 0x7fd7e5a50640 (LWP 6603))] (gdb) bt
at ./time/tzset.c:577
(gdb)
The reason given in https://github.com/GNS3/dynamips/pull/97 doesn't seem correct to me:
gcc make some optiomization so registers overlaps in multithread environment
The re-entrant _r
functions exist specifically so that doesn't happen.
In unrelated software (not GNS3) we saw this crash because something else left the stack misaligned.
Note the disassembly is in vfscanf()
varargs parsing on the MOVAPS
instruction to save an SSE register xmm0
to the stack. That instruction requires the stack to be aligned to 16 bytes: https://www.felixcloutier.com/x86/movaps
Maybe https://github.com/GNS3/dynamips/pull/97 changing the library call to gmtime_r()
avoided the SSE callpath because the TZ
variable isn't parsed by glibc because that library call always operates on GMT time, so never needs to enter scanf to parse the timezone?
Anyway, if you can get a core file of this, check the stack base pointer alignment:
(gdb) p (long)$rbp & 15
$1 = 8
If the result is anything except zero, the stack is misaligned.
There's lots of glibc and GCC behaviour which assumes the stack is aligned to 16 bytes on AMD64.
Hope that helps!
Hello! When I try launch c7200-adventerprisek9-mz.124-24.T5.image I notice Segmentation fault (core dumped) error. When I launch dynamips with -j options, it works slow for me. I try x86 and amd64 versions.
I use ArchLinux. I think I have a problem with JIT on my system, but I don't know how to fix it. Why does dynamips show Segmentation fault?
Output:
x86 version output [user@laptop stable]$ ./dynamips ~/GNS3/images/IOS/c7200-adventerprisek9-mz.124-24.T5.image Cisco Router Simulation Platform (version 0.2.18-x86/Linux stable) Copyright (c) 2005-2011 Christophe Fillot. Build date: Jul 16 2018 12:20:26
IOS image file: /home/user/GNS3/images/IOS/c7200-adventerprisek9-mz.124-24.T5.image
ILT: loaded table "mips64j" from cache. ILT: loaded table "mips64e" from cache. ILT: loaded table "ppc32j" from cache. ILT: loaded table "ppc32e" from cache. CPU0: carved JIT exec zone of 64 Mb into 2048 pages of 32 Kb. C7200 instance 'default' (id 0): VM Status : 0 RAM size : 256 Mb IOMEM size : 0 Mb NVRAM size : 128 Kb NPE model : npe-400 Midplane : vxr IOS image : /home/user/GNS3/images/IOS/c7200-adventerprisek9-mz.124-24.T5.image
Loading ELF file '/home/user/GNS3/images/IOS/c7200-adventerprisek9-mz.124-24.T5.image'... ELF entry point: 0x80008000
C7200 'default': starting simulation (CPU0 PC=0xffffffffbfc00000), JIT enabled. ROMMON emulation microcode.
Launching IOS image at 0x80008000... Segmentation fault (core dumped)
[root@laptop stable]# coredumpctl info 25891 PID: 25891 (dynamips) UID: 1000 (user) GID: 997 (users) Signal: 11 (SEGV) Timestamp: Mon 2018-07-16 12:43:30 MSK (5min ago) Command Line: ./dynamips /home/user/GNS3/images/IOS/c7200-adventerprisek9-mz.124-24.T5.image Executable: /tmp/dynamips-0.2.18/stable/dynamips Control Group: /user.slice/user-1000.slice/session-c1.scope Unit: session-c1.scope Slice: user-1000.slice Session: c1 Owner UID: 1000 (user) Boot ID: 9be295ceac534921be0c4d7d8c3062f1 Machine ID: 5dbadcb29e55458dbeb00d57849ed71d Hostname: laptop Storage: /var/lib/systemd/coredump/core.dynamips.1000.9be295ceac534921be0c4d7d8c3062f1.25891.1531734210000000.lz4 Message: Process 25891 (dynamips) of user 1000 dumped core.
[root@laptop stable]# coredumpctl gdb 25891 PID: 25891 (dynamips) UID: 1000 (user) GID: 997 (users) Signal: 11 (SEGV) Timestamp: Mon 2018-07-16 12:43:30 MSK (5min ago) Command Line: ./dynamips /home/user/GNS3/images/IOS/c7200-adventerprisek9-mz.124-24.T5.image Executable: /tmp/dynamips-0.2.18/stable/dynamips Control Group: /user.slice/user-1000.slice/session-c1.scope Unit: session-c1.scope Slice: user-1000.slice Session: c1 Owner UID: 1000 (user) Boot ID: 9be295ceac534921be0c4d7d8c3062f1 Machine ID: 5dbadcb29e55458dbeb00d57849ed71d Hostname: laptop Storage: /var/lib/systemd/coredump/core.dynamips.1000.9be295ceac534921be0c4d7d8c3062f1.25891.1531734210000000.lz4 Message: Process 25891 (dynamips) of user 1000 dumped core.
GNU gdb (GDB) 8.1 Copyright (C) 2018 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 "x86_64-pc-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 /tmp/dynamips-0.2.18/stable/dynamips...(no debugging symbols found)...done. [New LWP 25905] [New LWP 25897] [New LWP 25898] [New LWP 25892] [New LWP 25899] [New LWP 25902] [New LWP 25896] [New LWP 25893] [New LWP 25903] [New LWP 25904] [New LWP 25894] [New LWP 25900] [New LWP 25891] [New LWP 25901] [New LWP 25895] [New LWP 25906] [Thread debugging using libthread_db enabled] Using host libthread_db library "/usr/lib/libthread_db.so.1". Core was generated by `./dynamips /home/user/GNS3/images/IOS/c7200-adventerprisek9-mz.124-24.T5.image'. Program terminated with signal SIGSEGV, Segmentation fault.
0 0x565f1e79 in mips64_exec_JAL ()
[Current thread is 1 (Thread 0xed012b40 (LWP 25905))] (gdb) bt
0 0x565f1e79 in mips64_exec_JAL ()
1 0x565f271b in mips64_exec_single_step ()
2 0xf08c9bac in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
amd64 version [user@laptop stable]$ dynamips ~/GNS3/images/IOS/c7200-adventerprisek9-mz.124-24.T5.image Cisco Router Simulation Platform (version 0.2.18-amd64/Linux stable) Copyright (c) 2005-2011 Christophe Fillot. Build date: Jul 16 2018 08:53:05
IOS image file: /home/user/GNS3/images/IOS/c7200-adventerprisek9-mz.124-24.T5.image
ILT: loaded table "mips64j" from cache. ILT: loaded table "mips64e" from cache. ILT: loaded table "ppc32j" from cache. ILT: loaded table "ppc32e" from cache. CPU0: carved JIT exec zone of 64 Mb into 2048 pages of 32 Kb. C7200 instance 'default' (id 0): VM Status : 0 RAM size : 256 Mb IOMEM size : 0 Mb NVRAM size : 128 Kb NPE model : npe-400 Midplane : vxr IOS image : /home/user/GNS3/images/IOS/c7200-adventerprisek9-mz.124-24.T5.image
Loading ELF file '/home/user/GNS3/images/IOS/c7200-adventerprisek9-mz.124-24.T5.image'... ELF entry point: 0x80008000
C7200 'default': starting simulation (CPU0 PC=0xffffffffbfc00000), JIT enabled. ROMMON emulation microcode.
Segmentation fault (core dumped)
[root@laptop stable]# coredumpctl info 25991 PID: 25991 (dynamips) UID: 1000 (user) GID: 997 (users) Signal: 11 (SEGV) Timestamp: Mon 2018-07-16 12:44:05 MSK (1min 49s ago) Command Line: dynamips /home/user/GNS3/images/IOS/c7200-adventerprisek9-mz.124-24.T5.image Executable: /usr/bin/dynamips Control Group: /user.slice/user-1000.slice/session-c1.scope Unit: session-c1.scope Slice: user-1000.slice Session: c1 Owner UID: 1000 (user) Boot ID: 9be295ceac534921be0c4d7d8c3062f1 Machine ID: 5dbadcb29e55458dbeb00d57849ed71d Hostname: laptop Storage: /var/lib/systemd/coredump/core.dynamips.1000.9be295ceac534921be0c4d7d8c3062f1.25991.1531734245000000.lz4 Message: Process 25991 (dynamips) of user 1000 dumped core.
[root@laptop stable]# coredumpctl gdb 25991 PID: 25991 (dynamips) UID: 1000 (user) GID: 997 (users) Signal: 11 (SEGV) Timestamp: Mon 2018-07-16 12:44:05 MSK (2min 17s ago) Command Line: dynamips /home/user/GNS3/images/IOS/c7200-adventerprisek9-mz.124-24.T5.image Executable: /usr/bin/dynamips Control Group: /user.slice/user-1000.slice/session-c1.scope Unit: session-c1.scope Slice: user-1000.slice Session: c1 Owner UID: 1000 (user) Boot ID: 9be295ceac534921be0c4d7d8c3062f1 Machine ID: 5dbadcb29e55458dbeb00d57849ed71d Hostname: laptop Storage: /var/lib/systemd/coredump/core.dynamips.1000.9be295ceac534921be0c4d7d8c3062f1.25991.1531734245000000.lz4 Message: Process 25991 (dynamips) of user 1000 dumped core.
GNU gdb (GDB) 8.1 Copyright (C) 2018 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 "x86_64-pc-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 /usr/bin/dynamips...(no debugging symbols found)...done. [New LWP 26005] [New LWP 25992] [New LWP 25993] [New LWP 25991] [New LWP 26004] [New LWP 25995] [New LWP 25994] [New LWP 26006] [New LWP 25997] [New LWP 25996] [New LWP 25998] [New LWP 26000] [New LWP 25999] [New LWP 26001] [New LWP 26002] [New LWP 26003] [Thread debugging using libthread_db enabled] Using host libthread_db library "/usr/lib/libthread_db.so.1". Core was generated by `dynamips /home/user/GNS3/images/IOS/c7200-adventerprisek9-mz.124-24.T5.image'. Program terminated with signal SIGSEGV, Segmentation fault.
0 0x00007f02e51a1c0a in GIIO_vfscanf () from /usr/lib/libc.so.6
[Current thread is 1 (Thread 0x7f02d9319700 (LWP 26005))] (gdb) bt
0 0x00007f02e51a1c0a in GIIO_vfscanf () from /usr/lib/libc.so.6
1 0x00007f02e51b56ff in vsscanf () from /usr/lib/libc.so.6
2 0x00007f02e51afe95 in sscanf () from /usr/lib/libc.so.6
3 0x00007f02e51f944e in parse_offset () from /usr/lib/libc.so.6
4 0x00007f02e51f99d2 in __tzset_parse_tz () from /usr/lib/libc.so.6
5 0x00007f02e51fb47c in __tzfile_compute () from /usr/lib/libc.so.6
6 0x00007f02e51f9f59 in __tz_convert () from /usr/lib/libc.so.6
7 0x00005639e1b6132f in ?? ()
8 0x00005639e1b6ea03 in vm_log ()
9 0x00005639e1b9396c in dev_remote_control_access ()
10 0x00005639e1b77940 in mips64_mts32_sw ()
11 0x00007f02dd30be69 in ?? ()
12 0x00005639e1b7a3b2 in mips64_jit_run_cpu ()
13 0x00007f02e574b075 in start_thread () from /usr/lib/libpthread.so.0
14 0x00007f02e523c53f in clone () from /usr/lib/libc.so.6
[user@laptop stable]$ ./dynamips -j ~/GNS3/images/IOS/c7200-adventerprisek9-mz.124-24.T5.image Cisco Router Simulation Platform (version 0.2.18-x86/Linux stable) Copyright (c) 2005-2011 Christophe Fillot. Build date: Jul 16 2018 12:20:26
IOS image file: /home/user/GNS3/images/IOS/c7200-adventerprisek9-mz.124-24.T5.image
ILT: loaded table "mips64j" from cache. ILT: loaded table "mips64e" from cache. ILT: loaded table "ppc32j" from cache. ILT: loaded table "ppc32e" from cache. C7200 instance 'default' (id 0): VM Status : 0 RAM size : 256 Mb IOMEM size : 0 Mb NVRAM size : 128 Kb NPE model : npe-400 Midplane : vxr IOS image : /home/user/GNS3/images/IOS/c7200-adventerprisek9-mz.124-24.T5.image
Loading ELF file '/home/user/GNS3/images/IOS/c7200-adventerprisek9-mz.124-24.T5.image'... ELF entry point: 0x80008000
C7200 'default': starting simulation (CPU0 PC=0xffffffffbfc00000), JIT disabled. ROMMON emulation microcode.
Launching IOS image at 0x80008000...
Use, duplication, or disclosure by the Government is subject to restrictions as set forth in subparagraph (c) of the Commercial Computer Software - Restricted Rights clause at FAR sec. 52.227-19 and subparagraph (c) (1) (ii) of the Rights in Technical Data and Computer Software clause at DFARS sec. 252.227-7013.
Cisco IOS Software, 7200 Software (C7200-ADVENTERPRISEK9-M), Version 12.4(24)T5, RELEASE SOFTWARE (fc3) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2011 by Cisco Systems, Inc. Compiled Fri 04-Mar-11 06:49 by prod_rel_team
[user@laptop stable]$ ./dynamips -j ~/GNS3/images/IOS/c7200-adventerprisek9-mz.124-24.T5.image Cisco Router Simulation Platform (version 0.2.18-x86/Linux stable) Copyright (c) 2005-2011 Christophe Fillot. Build date: Jul 16 2018 12:20:26
IOS image file: /home/user/GNS3/images/IOS/c7200-adventerprisek9-mz.124-24.T5.image
ILT: loaded table "mips64j" from cache. ILT: loaded table "mips64e" from cache. ILT: loaded table "ppc32j" from cache. ILT: loaded table "ppc32e" from cache. C7200 instance 'default' (id 0): VM Status : 0 RAM size : 256 Mb IOMEM size : 0 Mb NVRAM size : 128 Kb NPE model : npe-400 Midplane : vxr IOS image : /home/user/GNS3/images/IOS/c7200-adventerprisek9-mz.124-24.T5.image
Loading ELF file '/home/user/GNS3/images/IOS/c7200-adventerprisek9-mz.124-24.T5.image'... ELF entry point: 0x80008000
C7200 'default': starting simulation (CPU0 PC=0xffffffffbfc00000), JIT disabled. ROMMON emulation microcode.
Launching IOS image at 0x80008000...
Use, duplication, or disclosure by the Government is subject to restrictions as set forth in subparagraph (c) of the Commercial Computer Software - Restricted Rights clause at FAR sec. 52.227-19 and subparagraph (c) (1) (ii) of the Rights in Technical Data and Computer Software clause at DFARS sec. 252.227-7013.
Cisco IOS Software, 7200 Software (C7200-ADVENTERPRISEK9-M), Version 12.4(24)T5, RELEASE SOFTWARE (fc3) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2011 by Cisco Systems, Inc. Compiled Fri 04-Mar-11 06:49 by prod_rel_team