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)
Mar 1 2024, 9:06 AM
Unknown Object (File)
Feb 6 2024, 12:20 AM
Unknown Object (File)
Jan 8 2024, 10:50 AM
Unknown Object (File)
Dec 20 2023, 3:27 AM
Unknown Object (File)
Nov 20 2023, 11:16 PM
Unknown Object (File)
Sep 28 2023, 5:34 AM
Unknown Object (File)
Aug 7 2023, 4:33 AM
Unknown Object (File)
Apr 24 2023, 7:13 AM
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 Passed
Unit
No Test Coverage
Build Status
Buildable 31701
Build 29272: arc lint + arc unit

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.