]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
libcasper: fix descriptors numbers
authorMariusz Zaborski <oshogbo@FreeBSD.org>
Wed, 9 Jun 2021 21:46:51 +0000 (23:46 +0200)
committerMark Johnston <markj@FreeBSD.org>
Tue, 29 Jun 2021 17:08:43 +0000 (13:08 -0400)
commitee56c5900ae39748aa8dfcde743ad3815e4e78c2
tree5f8121e6ede17e29c66ab48f091a08a007b7e186
parent6e927d10c5871fa2c1e77d6bf01646523a317de7
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)
lib/libcasper/libcasper/libcasper_impl.c
lib/libcasper/libcasper/libcasper_impl.h
lib/libcasper/libcasper/service.c
lib/libcasper/libcasper/zygote.c