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

Dynamips segmentation fault on Fedora 26 x86-64 #83

Closed
ddragic opened this Issue Nov 5, 2017 · 6 comments

Comments

Projects
None yet
5 participants
@ddragic
Contributor

ddragic commented Nov 5, 2017

Starting a dynamips node crashes almost immediately:
Dynamips hypervisor process has stopped, return code: -11

Have tried several different platforms, IOS images and even changing idle-pc values.

I'm building from source on Fedora 26 64-bit, but have tried the rpm package from athmane/gns3-extra copr with same results. It used to work fine on Fedora 24, I skipped F25, but just tried it in a container and it works there too (so F26 kernel with F25 userspace works).

This is possibly related to issue #82. If I build dynamips without JIT support (-DDYNAMIPS_ARCH=nojit) it doesn't crash any more, at the expense of performance and cpu usage.

Backtrace (dynamips was built with -DCMAKE_BUILD_TYPE=Debug for this):

(gdb) bt
#0  0x00007fe85234b3e5 in _int_malloc (av=av@entry=0x7fe838000020, bytes=bytes@entry=24) at malloc.c:3449
#1  0x00007fe85234ecb8 in __GI___libc_malloc (bytes=bytes@entry=24) at malloc.c:2890
#2  0x0000000000476a8a in rommon_var_create (name=0x7fe844014a54 "BSI") at /mnt/data-disk/src/gns3-2.0/dynamips/common/rommon_var.c:78
#3  rommon_var_add (rvl=0x7fe8440034b0, name=0x7fe844014a54 "BSI", value=0x7fe844014a58 "0") at /mnt/data-disk/src/gns3-2.0/dynamips/common/rommon_var.c:116
#4  0x0000000000476b4b in rommon_var_add_str (rvl=<optimized out>, str=<optimized out>) at /mnt/data-disk/src/gns3-2.0/dynamips/common/rommon_var.c:148
#5  0x000000000044516f in dev_remote_control_access (cpu=0x7fe84400b4a0, dev=<optimized out>, offset=<optimized out>, op_size=<optimized out>, op_type=<optimized out>, data=<optimized out>)
    at /mnt/data-disk/src/gns3-2.0/dynamips/common/dev_remote.c:255
#6  0x000000000042a7bd in dev_access_fast (data=0x7fe84af57e50, op_type=1, op_size=4, offset=<optimized out>, dev_id=<optimized out>, cpu=<optimized out>)
    at /mnt/data-disk/src/gns3-2.0/dynamips/common/device.h:94
#7  mips64_mts32_access (data=0x7fe84af57e50, op_type=1, op_size=4, op_code=10, vaddr=18446744072468037720, cpu=0x7fe84400b6b0) at /mnt/data-disk/src/gns3-2.0/dynamips/stable/mips64_mem.c:439
#8  mips64_mts32_sw (cpu=0x7fe84400b6b0, vaddr=18446744072468037720, reg=<optimized out>) at /mnt/data-disk/src/gns3-2.0/dynamips/stable/mips_mts.c:250
#9  0x00007fe841cf9776 in ?? ()
#10 0x000000000042cec8 in mips64_jit_tcb_exec (block=<optimized out>, cpu=0x7fe84400b6b0) at /mnt/data-disk/src/gns3-2.0/dynamips/stable/mips64_amd64_trans.h:58
#11 mips64_jit_tcb_run (block=<optimized out>, cpu=0x7fe84400b6b0) at /mnt/data-disk/src/gns3-2.0/dynamips/stable/mips64_jit.c:687
#12 mips64_jit_run_cpu (gen=<optimized out>) at /mnt/data-disk/src/gns3-2.0/dynamips/stable/mips64_jit.c:775
#13 0x00007fe8528e036d in start_thread (arg=0x7fe84af58700) at pthread_create.c:456
#14 0x00007fe8523d2e1f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
(gdb)

bt full:

(gdb) bt full
#0  0x00007fe85234b3e5 in _int_malloc (av=av@entry=0x7fe838000020, bytes=bytes@entry=24) at malloc.c:3449
        nb = <optimized out>
        idx = <optimized out>
        bin = <optimized out>
        victim = <optimized out>
        size = <optimized out>
        victim_index = <optimized out>
        remainder = <optimized out>
        remainder_size = <optimized out>
        block = <optimized out>
        bit = <optimized out>
        map = <optimized out>
        fwd = <optimized out>
        bck = <optimized out>
        errstr = 0x0
        __func__ = "_int_malloc"
#1  0x00007fe85234ecb8 in __GI___libc_malloc (bytes=bytes@entry=24) at malloc.c:2890
        ar_ptr = 0x7fe838000020
        victim = <optimized out>
        hook = <optimized out>
#2  0x0000000000476a8a in rommon_var_create (name=0x7fe844014a54 "BSI") at /mnt/data-disk/src/gns3-2.0/dynamips/common/rommon_var.c:78
        var = <optimized out>
#3  rommon_var_add (rvl=0x7fe8440034b0, name=0x7fe844014a54 "BSI", value=0x7fe844014a58 "0") at /mnt/data-disk/src/gns3-2.0/dynamips/common/rommon_var.c:116
No locals.
#4  0x0000000000476b4b in rommon_var_add_str (rvl=<optimized out>, str=<optimized out>) at /mnt/data-disk/src/gns3-2.0/dynamips/common/rommon_var.c:148
        eq_sym = <optimized out>
#5  0x000000000044516f in dev_remote_control_access (cpu=0x7fe84400b4a0, dev=<optimized out>, offset=<optimized out>, op_size=<optimized out>, op_type=<optimized out>, data=<optimized out>)
    at /mnt/data-disk/src/gns3-2.0/dynamips/common/dev_remote.c:255
        vm = 0x7fe844003400
        d = 0x7fe8440147d0
        storage_dev = <optimized out>
        len = <optimized out>
#6  0x000000000042a7bd in dev_access_fast (data=0x7fe84af57e50, op_type=1, op_size=4, offset=<optimized out>, dev_id=<optimized out>, cpu=<optimized out>)
    at /mnt/data-disk/src/gns3-2.0/dynamips/common/device.h:94
        dev = <optimized out>
#7  mips64_mts32_access (data=0x7fe84af57e50, op_type=1, op_size=4, op_code=10, vaddr=18446744072468037720, cpu=0x7fe84400b6b0) at /mnt/data-disk/src/gns3-2.0/dynamips/stable/mips64_mem.c:439
        hash_bucket = 8192
        haddr = <optimized out>
        cow = <optimized out>
        entry = <optimized out>
        alt_entry = {gvpa = 4688672, gppa = 0, hpa = 88, flags = 1}
        dev_id = <optimized out>
#8  mips64_mts32_sw (cpu=0x7fe84400b6b0, vaddr=18446744072468037720, reg=<optimized out>) at /mnt/data-disk/src/gns3-2.0/dynamips/stable/mips_mts.c:250
        data = 1
#9  0x00007fe841cf9776 in ?? ()
No symbol table info available.
#10 0x000000000042cec8 in mips64_jit_tcb_exec (block=<optimized out>, cpu=0x7fe84400b6b0) at /mnt/data-disk/src/gns3-2.0/dynamips/stable/mips64_amd64_trans.h:58
        jit_code = <optimized out>
        offset = <optimized out>
#11 mips64_jit_tcb_run (block=<optimized out>, cpu=0x7fe84400b6b0) at /mnt/data-disk/src/gns3-2.0/dynamips/stable/mips64_jit.c:687
No locals.
#12 mips64_jit_run_cpu (gen=<optimized out>) at /mnt/data-disk/src/gns3-2.0/dynamips/stable/mips64_jit.c:775
        cpu = <optimized out>
        timer_irq_thread = 140635658352384
        block = <optimized out>
        timer_irq_check = <optimized out>
        pc_hash = <optimized out>
#13 0x00007fe8528e036d in start_thread (arg=0x7fe84af58700) at pthread_create.c:456
        __res = <optimized out>
        pd = 0x7fe84af58700
        now = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140635666745088, -5487278157266267129, 0, 140635676195680, 140635666745792, 0, 5479139653779084295, 5479157308103742471}, mask_was_saved = 0}}, priv = {
        pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
        pagesize_m1 = <optimized out>
        sp = <optimized out>
        freesize = <optimized out>
        __PRETTY_FUNCTION__ = "start_thread"
#14 0x00007fe8523d2e1f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
No locals.
(gdb)
@ddragic

This comment has been minimized.

Contributor

ddragic commented Nov 13, 2017

Small update, looks like the 32-bit build (-DDYNAMIPS_ARCH=x86) doesn't segfault, much better workaround then nojit build.

@nschmura

This comment has been minimized.

nschmura commented Nov 27, 2017

@ddragic I'm running Fedora 26 64-bit. cmake .. -DDYNAMIPS_ARCH=nojit will run, but when trying x86 as the arch I get the following error:

-- dependencies - BEGIN
-- ARCH_AMD64=1
-- ARCH_X86=
-- DYNAMIPS_ARCH=x86
CMake Error at cmake/dependencies.cmake:95 (message):
cannot build target arch DYNAMIPS_ARCH=x86

Am I missing something when trying to run -DDYNAMIPS_ARCH=x86?

@ddragic

This comment has been minimized.

Contributor

ddragic commented Nov 27, 2017

You need development packages for a couple of 32-bit libraries (dnf install somelib-devel.i686), of the top of my head... glibc, elfutils, libpcap

@nschmura

This comment has been minimized.

nschmura commented Nov 27, 2017

@ddragic The three you listed was enough to get it to work. Thanks! Can confirm this workaround to prevent the immediate crash of dynamips on Fedora 26 x86-64 with GNS3 2.1.0rc1 (the version from the official repos).

@jalalsfs

This comment has been minimized.

jalalsfs commented Nov 30, 2017

Problem with dynamips with Fedora 27, when I start a router it shows this message
Dynamips hypervisor process has stopped, return code: -11
C3600 'Ghost': generic_nvram_extract_config: Unknown error -61605

@wilyarti

This comment has been minimized.

wilyarti commented Feb 7, 2018

This also gets it working on FreeBSD 11.1 amd64! Thank you. I compiled it with the -DDYNAMIPS_ARCH=x86 option and now it runs lightning fast with JIT enabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment