Skip to content

Access to non-volatile non-atomic global in signal handler context #2245

Description

@mafrasi2

There is an access to a non-volatile non-atomic global in a signal handler context in nmap_tty.cc: the signal handler shutdown_clean calls tty_done which accesses tty_fd. This is undefined behavior and a compiler could, for example, replace the access by an immediate 0:

20 Two actions are potentially concurrent if
(20.1) * they are performed by different threads, or
(20.2) * they are unsequenced, at least one is performed by a signal handler, and they are not both performed by the same signal handler invocation.
The execution of a program contains a data race if it contains two potentially concurrent conflicting actions, at least one of which is not atomic, and neither happens before the other, except for the special case for signal handlers described below. Any such data race results in undefined behavior. [...]

Expected behavior
No undefined behavior.

Version info:

  • OS: all non-win32 platforms
  • nmap version: master@e2f1df9

Additional context
This behavior was detected using techniques developed by the SYMBIOSYS research project at COMSYS, RWTH Aachen University. This research is supported by the European Research Council (ERC) under the EU's Horizon 2020 Research and Innovation Programme grant agreement n. 647295 (SYMBIOSYS).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions