]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
cap_fileargs: Fix a descriptor leak in the service process.
authormarkj <markj@FreeBSD.org>
Mon, 1 Jun 2020 15:32:13 +0000 (15:32 +0000)
committermarkj <markj@FreeBSD.org>
Mon, 1 Jun 2020 15:32:13 +0000 (15:32 +0000)
commitd4a3acbc0757e32dc9b0cc609e380fb472c80724
tree7561fbdab6bda23bba08cd2a032fb8fba1cf9762
parentb43c8782bd15fa4fed7fed02a2d446366be18dac
cap_fileargs: Fix a descriptor leak in the service process.

The service handler for fileargs_open() tries to pre-open multiple files
and pass descriptors for each back to the sandboxed process in a single
message.  This is to amortize the cost of round-trips between the two
processes.

The service process adds a "cache" nvlist to the reply to "open",
containing file descriptors for pre-opened files.  However, when adding
that nvlist to the reply, it was making a copy, effectively leaking the
cached descriptors.

While here, fix spelling in a local variable name.

PR: 241226
Reviewed by: oshogbo
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25095
lib/libcasper/services/cap_fileargs/cap_fileargs.c