fix: close the VBS-side gaps noted on Void/Library#61
VoidBuildSystem CI / sanitizers-gcc16 (push) Failing after 7s
VoidBuildSystem CI / signing-openssl-gcc16 (push) Failing after 13s
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 5s
VoidBuildSystem CI / wine-windows-gcc16 (push) Failing after 57s

This commit is contained in:
faumaray committed 2026-12-05 10:30:57 +03:00
1 parent 4f581d1b51
commit 4d51331777
13 files changed
+158 -14

No files matched your search

+9
View File
@@ -608,6 +608,9 @@ discover_profiles(const CompiledDescriptor &descriptor, const FrontendOptions &o
req.arguments = {"--mode", "profiles", "--output", out_file.string(), "--request-id", req_id};
req.working_directory = options.project_root;
req.timeout = options.eval_timeout;
for (const auto &[key, value] : options.extra_environment) {
req.environment.set_vars[key] = value;
}
auto proc = Platform::run_supervised(req);
auto cleanup = [&] { std::filesystem::remove(out_file, ec); };
@@ -735,6 +738,9 @@ evaluate_project(const CompiledDescriptor &descriptor, const ProfileContext &con
"--context-hash", ctx_hash};
req.working_directory = options.project_root;
req.timeout = options.eval_timeout;
for (const auto &[key, value] : options.extra_environment) {
req.environment.set_vars[key] = value;
}
auto proc = Platform::run_supervised(req);
if (!proc) {
@@ -819,6 +825,9 @@ evaluate_workspace(const CompiledDescriptor &descriptor, const FrontendOptions &
req.arguments = {"--mode", "workspace", "--output", out_file.string(), "--request-id", req_id};
req.working_directory = options.project_root;
req.timeout = options.eval_timeout;
for (const auto &[key, value] : options.extra_environment) {
req.environment.set_vars[key] = value;
}
auto proc = Platform::run_supervised(req);
auto cleanup = [&] { std::filesystem::remove(out_file, ec); };
+20 -6
View File
@@ -496,6 +496,11 @@ write_deb_package(const std::filesystem::path &output, const InstallOptions &opt
return Platform::atomic_write_file(output, deb, true);
}
// Canonical short message signed for installer archives (independent of archive size).
std::string installer_signing_message(std::string_view archive_sha256) {
return "vbs-installer-v1\n" + std::string{archive_sha256} + "\n";
}
} // namespace
Void::Result::Result<InstallReport, Void::Result::Error>
@@ -904,13 +909,15 @@ install_project(const Graph::ProjectDescription &description, const Graph::Build
}
report.archive_path = *options.archive_path;
// Optional detached signature and checksums over the final archive bytes.
// Optional detached signature and checksums over the final archive. The signed message
// is a short canonical digest statement, not the archive bytes, so archives of any size
// stay within the crypto one-shot limit.
if (options.signing_seed_path) {
auto bytes = Void::FileSystem::read_file(*options.archive_path);
if (!bytes) {
return std::unexpected{bytes.error()};
auto digest = Util::sha256_file_hex(*options.archive_path);
if (!digest) {
return std::unexpected{digest.error()};
}
report.archive_sha256 = Util::sha256_hex(*bytes);
report.archive_sha256 = *digest;
report.checksum_path = options.archive_path->string() + ".sha256";
if (auto written = Platform::atomic_write_file(
*report.checksum_path,
@@ -920,8 +927,10 @@ install_project(const Graph::ProjectDescription &description, const Graph::Build
return std::unexpected{written.error()};
}
const std::string canonical_message = installer_signing_message(report.archive_sha256);
auto signature = Provenance::sign_message(
std::as_bytes(std::span<const char>{bytes->data(), bytes->size()}),
std::as_bytes(std::span<const char>{canonical_message.data(),
canonical_message.size()}),
*options.signing_seed_path);
if (!signature) {
return std::unexpected{signature.error()};
@@ -942,6 +951,11 @@ install_project(const Graph::ProjectDescription &description, const Graph::Build
!written) {
return std::unexpected{written.error()};
}
if (auto written = Platform::atomic_write_file(
options.archive_path->string() + ".msg", canonical_message, true);
!written) {
return std::unexpected{written.error()};
}
}
}
return report;
+28 -3
View File
@@ -158,8 +158,11 @@ run_supervised(const ProcessRequest &request, std::stop_token stop) {
// drains, times out, or is cancelled, then escalate via SIGTERM -> kill_grace -> SIGKILL.
bool group_timed_out = comm->timed_out;
bool group_cancelled = comm->cancelled;
bool descendants_terminated = false;
const pid_t pgid = static_cast<pid_t>(child->pgid());
if (!group_timed_out && !group_cancelled && !comm->overflowed) {
const auto descendant_deadline =
std::chrono::steady_clock::now() + request.descendant_grace;
while (child->process_group_alive()) {
// Reap any adopted descendants in this process group (subreaper) so zombies clear.
int wstatus = 0;
@@ -172,18 +175,40 @@ run_supervised(const ProcessRequest &request, std::stop_token stop) {
group_cancelled = true;
break;
}
if (has_timeout && std::chrono::steady_clock::now() >= deadline) {
const auto now = std::chrono::steady_clock::now();
if (has_timeout && now >= deadline) {
group_timed_out = true;
break;
}
// Orphans must not keep the supervisor (or a test run) alive forever.
if (request.descendant_grace.count() > 0 && now >= descendant_deadline) {
descendants_terminated = true;
break;
}
std::this_thread::sleep_for(std::chrono::milliseconds{10});
}
}
if (group_cancelled || group_timed_out || comm->overflowed || child->process_group_alive()) {
if (group_cancelled || group_timed_out || descendants_terminated || comm->overflowed ||
child->process_group_alive()) {
(void)child->terminate(request.kill_grace);
// Reap the whole group until it is really gone (bounded), so no zombie or orphan is
// left behind after test supervision.
const auto reap_deadline =
std::chrono::steady_clock::now() + request.kill_grace + std::chrono::seconds{2};
int wstatus = 0;
while (pgid > 0 && ::waitpid(-pgid, &wstatus, WNOHANG) > 0) {
while (pgid > 0) {
const pid_t reaped = ::waitpid(-pgid, &wstatus, WNOHANG);
if (reaped < 0) { // ECHILD: no descendants left.
break;
}
if (reaped == 0) {
if (std::chrono::steady_clock::now() >= reap_deadline) {
break;
}
std::this_thread::sleep_for(std::chrono::milliseconds{5});
continue;
}
}
}
+5
View File
@@ -1065,6 +1065,11 @@ run_native_provider(const ProviderRequest &request, const std::filesystem::path
if (request.sdk_library_path) {
fopts.sdk_library_path = *request.sdk_library_path;
}
// Pass the consumer's `.native_builder({...})` options to the dependency's build.cpp.
fopts.extra_environment["VBS_DEP_NAME"] = request.dependency.name;
for (const auto &[key, value] : request.dependency.options) {
fopts.extra_environment["VBS_DEP_OPTION_" + key] = cmake_option_value(value);
}
auto compiled = Config::compile_descriptor(fopts);
if (!compiled) {
return std::unexpected{compiled.error()};