Segmentation fault on invalid gw_src/gw_dst
As of 5e9351c7 (2021-05-27) and release v3.27, a segmentation fault occurs when using a platform with invalid bw_src
and bw_dst
in a zoneRoute
.
This issue has been initially reported on batsim#57.
I feel like this can be solved by more checks at platform initialization.
Reproduce
mwe.cpp platform_bad.xml platform_ok.xml default.nix
g++ -o mwe $(pkg-config simgrid --libs --include) ./mwe.cpp
With good platform
./mwe platform_ok.xml
[0.000000] [xbt_cfg/INFO] Configuration change: Set 'host/model' to 'ptask_L07'
[0.000000] [xbt_cfg/INFO] Switching to the L07 model to handle parallel tasks.
[c1_0:actor:(1) 0.002150] [mwe/INFO] ptask on hosts 0 and 1 completed
[0.002150] [mwe/INFO] Simulation done.
With bad platform
./mwe platform_bad.xml
[0.000000] [xbt_cfg/INFO] Configuration change: Set 'host/model' to 'ptask_L07'
[0.000000] [xbt_cfg/INFO] Switching to the L07 model to handle parallel tasks.
Segmentation fault.
Segmentation fault (core dumped)
gdb stack trace:
#0 0x00007ffff6e1669e in _int_malloc () from /nix/store/9df65igwjmf2wbw0gbrrgair6piqjgmi-glibc-2.31/lib/libc.so.6
#1 0x00007ffff6e18004 in malloc () from /nix/store/9df65igwjmf2wbw0gbrrgair6piqjgmi-glibc-2.31/lib/libc.so.6
#2 0x00007ffff715b615 in operator new(unsigned long) () from /nix/store/vran8acwir59772hj4vscr7zribvp7l5-gcc-9.3.0-lib/lib/libstdc++.so.6
#3 0x00007ffff7a18040 in __gnu_cxx::new_allocator<simgrid::kernel::routing::NetZoneImpl*>::allocate (this=0x7fffff7ff220, __n=2) at /nix/store/h31cy7jm6g7cfqbhc5pm4rf9c53i3qfb-gcc-9.3.0/incl
ude/c++/9.3.0/ext/new_allocator.h:114
#4 0x00007ffff7a173fc in std::allocator_traits<std::allocator<simgrid::kernel::routing::NetZoneImpl*> >::allocate (__a=..., __n=2) at /nix/store/h31cy7jm6g7cfqbhc5pm4rf9c53i3qfb-gcc-9.3.0/in
clude/c++/9.3.0/bits/alloc_traits.h:444
#5 0x00007ffff7a161b2 in std::_Vector_base<simgrid::kernel::routing::NetZoneImpl*, std::allocator<simgrid::kernel::routing::NetZoneImpl*> >::_M_allocate (this=0x7fffff7ff220, __n=2) at /nix/
store/h31cy7jm6g7cfqbhc5pm4rf9c53i3qfb-gcc-9.3.0/include/c++/9.3.0/bits/stl_vector.h:343
#6 0x00007ffff7a15217 in std::vector<simgrid::kernel::routing::NetZoneImpl*, std::allocator<simgrid::kernel::routing::NetZoneImpl*> >::_M_realloc_insert<simgrid::kernel::routing::NetZoneImpl
* const&> (this=0x7fffff7ff220, __position=...) at /nix/store/h31cy7jm6g7cfqbhc5pm4rf9c53i3qfb-gcc-9.3.0/include/c++/9.3.0/bits/vector.tcc:440
#7 0x00007ffff7a14352 in std::vector<simgrid::kernel::routing::NetZoneImpl*, std::allocator<simgrid::kernel::routing::NetZoneImpl*> >::push_back (this=0x7fffff7ff220, __x=@0x7fffff7ff1e0: 0x
430080) at /nix/store/h31cy7jm6g7cfqbhc5pm4rf9c53i3qfb-gcc-9.3.0/include/c++/9.3.0/bits/stl_vector.h:1195
#8 0x00007ffff7a11a23 in simgrid::kernel::routing::find_common_ancestors (src=0x42b750, dst=0x43faf0, common_ancestor=0x7fffff7ff2f8, src_ancestor=0x7fffff7ff300, dst_ancestor=0x7fffff7ff308
) at ../src/kernel/routing/NetZoneImpl.cpp:303
#9 0x00007ffff7a1291a in simgrid::kernel::routing::NetZoneImpl::get_global_route_with_netzones (src=0x42b750, dst=0x43faf0, links=..., latency=0x7fffffffb408, netzones=...) at ../src/kernel/
routing/NetZoneImpl.cpp:443
#10 0x00007ffff7a12cc0 in simgrid::kernel::routing::NetZoneImpl::get_global_route_with_netzones (src=0x42b750, dst=0x43faf0, links=..., latency=0x7fffffffb408, netzones=...) at ../src/kernel/
routing/NetZoneImpl.cpp:469
#11 0x00007ffff7a12cc0 in simgrid::kernel::routing::NetZoneImpl::get_global_route_with_netzones (src=0x42b750, dst=0x43faf0, links=..., latency=0x7fffffffb408, netzones=...) at ../src/kernel/
routing/NetZoneImpl.cpp:469
...
#29078 0x00007ffff7a12cc0 in simgrid::kernel::routing::NetZoneImpl::get_global_route_with_netzones (src=0x42b750, dst=0x43f280, links=..., latency=0x7fffffffb408, netzones=...) at ../src/kern
el/routing/NetZoneImpl.cpp:469
#29079 0x00007ffff7a127a5 in simgrid::kernel::routing::NetZoneImpl::get_global_route (src=0x42b750, dst=0x43f280, links=..., latency=0x7fffffffb408) at ../src/kernel/routing/NetZoneImpl.cpp:4
28
#29080 0x00007ffff7923ace in simgrid::s4u::Host::route_to (this=0x42d8e0, dest=0x42d820, links=..., latency=0x7fffffffb408) at ../src/s4u/s4u_Host.cpp:165
#29081 0x00007ffff7a89624 in simgrid::surf::L07Action::L07Action (this=0x432640, model=0x422900, host_list=..., flops_amount=0x4325e0, bytes_amount=0x42a7c0, rate=-1) at ../src/surf/ptask_L07
.cpp:174
#29082 0x00007ffff7a892be in simgrid::surf::HostL07Model::execute_parallel (this=0x422900, host_list=..., flops_amount=0x4325e0, bytes_amount=0x42a7c0, rate=-1) at ../src/surf/ptask_L07.cpp:1
47
#29083 0x00007ffff7996223 in simgrid::kernel::activity::ExecImpl::start (this=0x432480) at ../src/kernel/activity/ExecImpl.cpp:92
#29084 0x00007ffff7915e45 in simgrid::s4u::Exec::<lambda()>::operator()(void) const (__closure=0x7ffff6d51bb0) at ../src/s4u/s4u_Exec.cpp:45
#29085 0x00007ffff7918c6e in simgrid::xbt::fulfill_promise<simgrid::xbt::Result<void>, simgrid::s4u::Exec::start()::<lambda()> >(simgrid::xbt::Result<void> &, simgrid::s4u::Exec::<lambda()> &
&) (promise=..., code=...) at ../include/xbt/promise.hpp:105
#29086 0x00007ffff7917cf7 in simgrid::kernel::actor::<lambda()>::operator()(void) const (this=0x7ffff6d51b40) at ../include/simgrid/simix.hpp:57
#29087 0x00007ffff7919f76 in std::_Function_handler<void(), simgrid::kernel::actor::simcall(F&&, simgrid::kernel::actor::SimcallObserver*) [with F = simgrid::s4u::Exec::start()::<lambda()>; s
td::result_of_t<F()> = void]::<lambda()> >::_M_invoke(const std::_Any_data &) (__functor=...) at /nix/store/h31cy7jm6g7cfqbhc5pm4rf9c53i3qfb-gcc-9.3.0/include/c++/9.3.0/bits/std_function.h:30
0
#29088 0x00007ffff795b66c in std::function<void ()>::operator()() const (this=0x7ffff6d51b40) at /nix/store/h31cy7jm6g7cfqbhc5pm4rf9c53i3qfb-gcc-9.3.0/include/c++/9.3.0/bits/std_function.h:68
8
#29089 0x00007ffff7989791 in SIMIX_run_kernel(std::function<void ()> const*) (code=0x7ffff6d51b40) at ../src/simix/popping.cpp:13
#29090 0x00007ffff79b050a in simgrid::kernel::actor::ActorImpl::simcall_handle (this=0x432240, times_considered=0) at ../src/simix/popping_generated.cpp:95
#29091 0x00007ffff7a2c164 in simgrid::kernel::EngineImpl::run (this=0x429b00) at ../src/kernel/EngineImpl.cpp:331
#29092 0x00007ffff78fda28 in simgrid::s4u::Engine::run (this=0x7fffffffb9b0) at ../src/s4u/s4u_Engine.cpp:341
#29093 0x000000000040249b in main ()