diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 94a61d9..2b4f7e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -515,6 +515,11 @@ jobs: name: x86_64, linked with no SDK runs-on: ubuntu-24.04 timeout-minutes: 45 + # The platform release groups the openkal this package requires: 0.28.0 + # named openkal 0.25.3 and was refused since 0.24.0 asks for ^0.26.0. + # 0.32.1 names 0.26.0 and needs mcpp 2026.11.17.1 or later. + env: + MCPP_VERSION: 2026.11.27.1 steps: - uses: actions/checkout@v4 with: { path: openkal-macos } @@ -543,7 +548,7 @@ jobs: kind = "bin" main = "src/main.c" [target.x86_64-macos-musl] - platform = "openkal-platform@0.28.0" + platform = "openkal-platform@0.32.1" [target.x86_64-macos-musl.layers] kernel-abi = { path = "../openkal-macos" } TOML diff --git a/README.md b/README.md index 4a98fcd..4d194ee 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,10 @@ written on the kernel's own calls. ```toml [dependencies] -openkal = "0.26.0" +openkal = "0.26.1" [target.'cfg(os = "macos")'.dependencies] -openkal-macos = "0.24.1" +openkal-macos = "0.24.2" ``` Its purpose is as much to test the specification as to be used. A specification @@ -198,6 +198,17 @@ same image parses as fast on Linux arm64. Since 0.17.1 it is the same kernel ide this system's library keeps for each thread (`pthread_threadid_np`, a name no C library in this ecosystem defines). +## What 0.24.2 changes + +**A start that states no preference leaves the environment as it was given** +(openkal 0.26.1, clause 7.17). A start removed every `KAL_RESOURCES` variable the +caller gave and wrote this process's own preference where it was not balanced, so +a program that is not an openkal program received a variable its caller had not +written, and a caller that composed an environment could not start a program with +the default. The variable is now written only for a start that states a +preference; a caller that passes its own environment on passes its preference with +it. The suite of 0.26.1 observes both starts. + ## What 0.24.1 corrects **A request acted on by another context ends the program as the request.** diff --git a/mcpp.toml b/mcpp.toml index 9389f5f..a8812a5 100644 --- a/mcpp.toml +++ b/mcpp.toml @@ -1,7 +1,7 @@ [package] namespace = "mcpplibs" name = "openkal-macos" -version = "0.24.1" +version = "0.24.2" description = "An implementation of openkal for macOS, written on the kernel's own calls. Its purpose is as much to test the specification as to be used." license = "Apache-2.0" diff --git a/src/process.cpp b/src/process.cpp index 9af9eb4..ac62286 100644 --- a/src/process.cpp +++ b/src/process.cpp @@ -8,7 +8,6 @@ extern "C" int sandbox_init_with_parameters(const char* profile, unsigned long long flags, const char* const parameters[], char** error); namespace okm { -int resource_preference(); void fork_prepare(); void fork_parent(); void fork_child(); @@ -120,7 +119,11 @@ constexpr okm_uptr kPidDigits = 10; // THE TWO VARIABLES 0.23 WRITES BESIDE IT: what each grant carries // (`KAL_GRANT_RIGHTS', read in fs.cpp) and the started program's resource // preference (`KAL_RESOURCES', read in env.cpp). A value of either the caller -// supplied is left out. +// supplied is left out where this start writes its own. A start that states no +// preference writes none and leaves the caller's variable where it is: the +// preference is inherited through the environment the caller gives +// (openkal 0.26.1, clause 7.17), and a program that is not an openkal program +// receives exactly that environment. constexpr char kRights[] = "KAL_GRANT_RIGHTS="; constexpr okm_uptr kRightsLen = sizeof kRights - 1; constexpr char kResources[] = "KAL_RESOURCES="; @@ -265,7 +268,7 @@ struct vector { const kal_preopen* grants, kal_uintptr g, const conveyance& c) { auto left_out = [&](const char* s, kal_uintptr l) { return names_preopens(s, l) || starts_with(s, l, kRights, kRightsLen) - || starts_with(s, l, kResources, kResourcesLen); + || (c.resources && starts_with(s, l, kResources, kResourcesLen)); }; kal_uintptr kept = 0; okm_uptr total = 0; @@ -894,14 +897,9 @@ int kal_process_spawn(const kal_spawn* how, okm::copy(carry.rights + carry.rights_len, prefix, plen); carry.rights_len += plen; carry.any_rights = true; } - { - const int own = okm::resource_preference(); - const int asked = preference == KAL_SPAWN_RESOURCES_PERFORMANCE ? 1 - : preference == KAL_SPAWN_RESOURCES_ECONOMY ? 2 - : preference == KAL_SPAWN_RESOURCES_BALANCED ? 0 : own; - carry.resources = asked == 1 ? "performance" : asked == 2 ? "economy" - : preference != 0 ? "balanced" : nullptr; - } + carry.resources = preference == KAL_SPAWN_RESOURCES_PERFORMANCE ? "performance" + : preference == KAL_SPAWN_RESOURCES_ECONOMY ? "economy" + : preference == KAL_SPAWN_RESOURCES_BALANCED ? "balanced" : nullptr; vector args, envs; if (!args.build(argv, argv_lens, argc)) return kal_err_no_memory;