Skip to content

Shim logging seems to cause memory corruption #2457

@stevenengler

Description

@stevenengler

When running the following simulation, shadow gets stuck (0% CPU usage, memory and disk usage don't noticeably increase). Shadow is built in debug mode in an Ubuntu 22.04 container.

apt install npm
npm install http-server -g
rm -rf shadow.data && shadow --strace-logging-mode standard --log-level trace shadow.yaml > shadow.log
general:
  stop_time: 10s
  model_unblocked_syscall_latency: true

network:
  graph:
    type: 1_gbit_switch

hosts:
  server:
    network_node_id: 0
    processes:
    - path: /usr/bin/node
      args: /usr/local/bin/http-server -p 80 -d
      start_time: 3s
  client:
    network_node_id: 0
    processes:
    - path: /usr/bin/curl
      args: server
      start_time: 5s

The simulation completes successfully if the --log-level trace is changed to --log-level debug, or if an early return is added to shimlogger_log.

If you debug the node plugin in gdb:

break _managedthread_fork_exec
handle SIGSYS noprint
run
set follow-fork-mode child
cont

the backtrace after shadow becomes stuck shows:

(gdb) bt
#0  0x00007ffff541c9ca in shim_native_syscallv () from /tmp/shadow/build/src/lib/shim/libshadow-shim.so
Backtrace stopped: Cannot access memory at address 0x7ffff2a8c9f8

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: LibrariesSupport functions like LD_PRELOAD and loggingType: BugError or flaw producing unexpected results

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions