HomeFreeBSD

dd(1): neutralize SIGINT while non-async-signal safe code is executing

Description

dd(1): neutralize SIGINT while non-async-signal safe code is executing

making the SIGINT handler (the terminate() function) safe to execute at
any interruption moment. This fixes a race in
5807f35c541c26bbd91a3ae12506cd8dd8f20688 where SIGINT delivered right
after the check_terminate() but before a blocking syscall would not
cause abort.

Do it by setting the in_io flag around potentially blocking io syscalls.
If handler sees the flag, it terminates the program. Otherwise,
termination is delegated to the before_io/after_io fences.

Reviewed by: Andrew Gierth <andrew@tao146.riddles.org.uk>
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D40281

Details

Provenance
kibAuthored on May 26 2023, 10:27 AM
Reviewer
andrew
Differential Revision
D40281: dd(1): neutralize SIGINT while non-async-signal safe code is executing
Parents
rG54dfc97b0bd9: Add gve, the driver for Google Virtual NIC (gVNIC)
Branches
Unknown
Tags
Unknown