HomeFreeBSD

libcasper: fix descriptors numbers

Description

libcasper: fix descriptors numbers

Casper services expect that the first 3 descriptors (stdin/stdout/stderr)
will point to /dev/null. Which Casper will ensure later. The Casper
services are forked from the original process. If the initial process
closes one of those descriptors, Casper may reuse one of them for it on
purpose. If this is the case, then renumarate the descriptors used by
Casper to higher numbers. This is done already after the fork, so it
doesn't break the parent process.

Approved by: so
Security: EN-21:19.libcasper
PR: 255339
Reported by: Borja Marcos <borjam (at) sarenet.es>
Tested by: jkim@

(cherry picked from commit aa310ebfba3d49a0b6b03a103b969731a8136a73)
(cherry picked from commit 4e2ae05c3ae8c470829b4c3a78aa8c34a7f0b617)

Details

Provenance
oshogboAuthored on Jun 9 2021, 9:46 PM
markjCommitted on Jun 29 2021, 5:08 PM
Parents
rG6e927d10c587: Add UPDATING entries and bump version
Branches
Unknown
Tags
Unknown