Page MenuHomeFreeBSD

sh: Do not ignore INTOFF during a trap
ClosedPublic

Authored by jilles on Jun 14 2020, 7:49 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Dec 14, 12:36 AM
Unknown Object (File)
Wed, Nov 27, 2:54 PM
Unknown Object (File)
Wed, Nov 27, 2:52 PM
Unknown Object (File)
Nov 5 2024, 8:31 PM
Unknown Object (File)
Oct 5 2024, 3:24 AM
Unknown Object (File)
Oct 4 2024, 5:52 AM
Unknown Object (File)
Oct 3 2024, 12:34 PM
Unknown Object (File)
Oct 2 2024, 7:32 PM
Subscribers

Details

Summary

INTOFF postpones SIGINT processing and INTON enables it again. This is
important so an interactive shell can return to the top level prompt when
Ctrl+C is pressed.

Given that INTON is automatically done when a builtin completes, the part
where onsig() ignores suppressint when in_dotrap is true is both unnecessary
and unsafe. If the trap is for some other signal than SIGINT, arbitrary code
could have been interrupted.

Historically, INTOFF remained in effect for longer.

Test Plan

installworld; kyua test in /usr/tests/bin/sh

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Tested this with a builtin and agree it's redundant and dangerous.

This revision is now accepted and ready to land.Jul 9 2020, 8:26 PM
This revision was automatically updated to reflect the committed changes.