Page MenuHomeFreeBSD

Fix the case where stdin is closed, second attempt.
ClosedPublic

Authored by markj on Feb 16 2019, 8:51 PM.
Tags
None
Referenced Files
F157286674: D19216.id.diff
Wed, May 20, 12:56 AM
Unknown Object (File)
Mon, May 18, 8:08 AM
Unknown Object (File)
Mon, May 18, 5:42 AM
Unknown Object (File)
Sun, May 17, 8:18 AM
Unknown Object (File)
Wed, Apr 29, 2:37 PM
Unknown Object (File)
Tue, Apr 28, 7:29 PM
Unknown Object (File)
Apr 15 2026, 11:46 PM
Unknown Object (File)
Apr 15 2026, 2:21 AM
Subscribers

Details

Summary

We have to be careful with caph_limit_stdio(): we cannot use it if one
of the input files is stdin, and we cannot use it after opening the
input files, since if one of the standard descriptors is closed it may
be reused for one of the input files.

Rather than partially duplicating caph_limit_stream() in main(), limit
rights in c_regular() and c_special(). Don't register a SIGSEGV handler
until we're committed to using mmap().

Add a regression test.

Diff Detail

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