The runtime library's module tables hold 32 modules, not the release's MOD_COUNT: an install's plugins fit (#845)

loader.c and memory.c sized their tables by MOD_COUNT of the layout.h make_release.py built libtotkrt.a against (3:
main, subsdk0, sdk). An install whose rebuild adds a plugin has 4, and its service run stopped at once with "loader: 4
modules in the layout"; dev builds compile those files against their own layout and never saw it. RT_MAX_MODULES
(host.h) is the bound now; the loader still refuses a layout above it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Valiantsin DzerakhandClaude Opus 5.5 committed 2026-11-17 10:35:49 +03:00
1 parent c97ceb6451
commit c477b67a09
4 files changed
+11 -7

No files matched your search

+2 -2
View File
@@ -57,7 +57,7 @@ static uint8_t *alias_pages; // 1 per mapped 4 KiB page of the alias regi
typedef struct { uint64_t dst, src, size; } StackMap;
static StackMap stack_maps[MAX_STACK_MAPS];
static unsigned nstack_maps;
static uint8_t *module_perm[MOD_COUNT]; // per data page of each module: perm | ATTR_PERMISSION_LOCKED
static uint8_t *module_perm[RT_MAX_MODULES]; // per data page of each module: perm | ATTR_PERMISSION_LOCKED
static uint64_t align_up(uint64_t v, uint64_t a) { return (v + a - 1) & ~(a - 1); }
@@ -530,7 +530,7 @@ uint32_t mem_unmap_physical(uint64_t a, uint64_t n) { return alias_map(1, a, n);
// as taken (Code, RX), so the SDK never picks it.
static void taken_gap(uint64_t a, uint64_t *base, uint64_t *size) {
uint64_t lo = 0, hi = RT_ADDRESS_LIMIT;
RtRange known[3 + MOD_COUNT + 2];
RtRange known[3 + RT_MAX_MODULES + 2];
int n = 0;
known[n++] = (RtRange){L.aslr.base, low_size};
known[n++] = L.alias;