NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/56254: script(1) abuses non-async-signal-safe functions in signal handlers



>Number:         56254
>Category:       bin
>Synopsis:       script(1) abuses non-async-signal-safe functions in signal handlers
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jun 17 00:00:01 +0000 2021
>Originator:     Taylor R Campbell
>Release:        9.99.x
>Organization:
>Environment:
>Description:
The script(1) command sets up signal handlers that call functions which are not async-signal-safe, such as exit():

https://nxr.netbsd.org/xref/src/usr.bin/script/script.c?r=1.28#182
https://nxr.netbsd.org/xref/src/usr.bin/script/script.c?r=1.28#232
https://nxr.netbsd.org/xref/src/usr.bin/script/script.c?r=1.28#333

This can cause a deadlock in rtld:

https://mail-index.netbsd.org/current-users/2021/06/14/msg041121.html

script(1) should use only async-signal-safe functions in signal handlers -- for example, it could set a flag in the signal handler and check the flags whenever any blocking syscall fails with EINTR.
>How-To-Repeat:
code inspection
>Fix:
Yes, please!



Home | Main Index | Thread Index | Old Index