1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-10 20:46:01 +01:00

Don't censor root info for trusted users

This commit is contained in:
Eelco Dolstra 2025-06-27 15:09:19 +02:00
parent 59700c0978
commit 774c4ba740
3 changed files with 9 additions and 2 deletions

View file

@ -730,6 +730,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
options.action = (GCOptions::GCAction) readInt(conn.from); options.action = (GCOptions::GCAction) readInt(conn.from);
options.pathsToDelete = WorkerProto::Serialise<StorePathSet>::read(*store, rconn); options.pathsToDelete = WorkerProto::Serialise<StorePathSet>::read(*store, rconn);
conn.from >> options.ignoreLiveness >> options.maxFreed; conn.from >> options.ignoreLiveness >> options.maxFreed;
options.censor = !trusted;
// obsolete fields // obsolete fields
readInt(conn.from); readInt(conn.from);
readInt(conn.from); readInt(conn.from);

View file

@ -614,12 +614,12 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results)
permanent roots cannot increase now. */ permanent roots cannot increase now. */
printInfo("finding garbage collector roots..."); printInfo("finding garbage collector roots...");
if (!options.ignoreLiveness) if (!options.ignoreLiveness)
findRootsNoTemp(roots, true); findRootsNoTemp(roots, options.censor);
/* Read the temporary roots created before we acquired the global /* Read the temporary roots created before we acquired the global
GC root. Any new roots will be sent to our socket. */ GC root. Any new roots will be sent to our socket. */
Roots tempRoots; Roots tempRoots;
findTempRoots(tempRoots, true); findTempRoots(tempRoots, options.censor);
for (auto & root : tempRoots) for (auto & root : tempRoots)
_shared.lock()->tempRoots.insert(std::string(root.first.hashPart())); _shared.lock()->tempRoots.insert(std::string(root.first.hashPart()));

View file

@ -53,6 +53,12 @@ struct GCOptions
* Stop after at least `maxFreed` bytes have been freed. * Stop after at least `maxFreed` bytes have been freed.
*/ */
uint64_t maxFreed{std::numeric_limits<uint64_t>::max()}; uint64_t maxFreed{std::numeric_limits<uint64_t>::max()};
/**
* Whether to hide potentially sensitive information about GC
* roots (such as PIDs).
*/
bool censor = false;
}; };