Skip to content

Commit 3e4f390

Browse files
committed
rules: finish renaming module_base_from_va_bits to loongarch64_module_base
The file moved but the name it is keyed by did not. check-rule-registry requires a rule's symbol to match its filename, and the confidence-floor allowlist is keyed by basename, so both failed: an unregistered rule and an orphan registry entry on one side, an unreviewed pin and a stale allowlist entry on the other.
1 parent ad23ed5 commit 3e4f390

6 files changed

Lines changed: 12 additions & 12 deletions

File tree

src/components/proc_cpuinfo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ static int detect_ppc64_mmu(void) {
210210
* What it is NOT is the shift. The field and the printed line differ by one:
211211
* cpu_vabits is VALEN and M is VALEN + 1, so a consumer placing a region at
212212
* `0 - (1 << M)` lands a full bit low. SF_VIRT_ADDR_BITS carries the width, and
213-
* a consumer that needs the shift subtracts one -- module_base_from_va_bits is
213+
* a consumer that needs the shift subtracts one -- loongarch64_module_base is
214214
* the one that does.
215215
*
216216
* Note also that an mmap boundary probe CANNOT substitute for this read.

src/engine_rules.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ static const rule_fn k_rules[] = {
8484
rule_module_base_bounds,
8585
rule_module_base_execmem_window,
8686
rule_module_base_from_text,
87-
rule_module_base_from_va_bits,
87+
rule_loongarch64_module_base,
8888
rule_module_base_ppc64_vmalloc,
8989

9090
/* Multi-entry EFI_LOADER_CODE → Q_PHYS_IMAGE_BASE pin */

src/include/kasld/engine_rules.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ R(module_text_bracket);
330330
R(module_base_bounds);
331331
R(module_base_execmem_window);
332332
R(module_base_from_text);
333-
R(module_base_from_va_bits);
333+
R(loongarch64_module_base);
334334
R(module_base_ppc64_vmalloc);
335335

336336
/* Multi-entry EFI_LOADER_CODE → Q_PHYS_IMAGE_BASE pin (arm64/riscv64/x86_64) */

src/rules/loongarch64_module_base.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838

3939
#include <string.h>
4040

41-
int rule_module_base_from_va_bits(const struct evidence_set *ev,
42-
const struct estimate *est,
43-
struct constraint *out, int out_max) {
41+
int rule_loongarch64_module_base(const struct evidence_set *ev,
42+
const struct estimate *est,
43+
struct constraint *out, int out_max) {
4444
#if defined(MODULES_BASE_LOONGARCH64_PCI_IOSIZE)
4545
(void)est;
4646
if (out_max < 1)
@@ -85,7 +85,7 @@ int rule_module_base_from_va_bits(const struct evidence_set *ev,
8585
}
8686
if (psrc && c->lineage_count < MAX_LINEAGE)
8787
c->derived_from[c->lineage_count++] = psrc;
88-
snprintf(c->origin, ORIGIN_LEN, "module_base_from_va_bits");
88+
snprintf(c->origin, ORIGIN_LEN, "loongarch64_module_base");
8989
return 1;
9090
#else
9191
(void)ev;

tests/check-confidence-floor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ RULES=$ROOT/src/rules
103103
# KASLR_*_ALIGN is the MINIMUM over every config
104104
# it admits -- a value taken from one config is
105105
# too coarse and excludes the finer-aligned bases
106-
# module_base_from_va_bits computed: vm_map_base + addend + pages. The
106+
# loongarch64_module_base computed: vm_map_base + addend + pages. The
107107
# shift is the width the KERNEL places the region
108108
# with, which is not always the width cpuinfo
109109
# reports (SHIFT_BIAS), and the page term follows
@@ -172,7 +172,7 @@ directmap_kaslr_disabled_pin
172172
efi_loader_kernel_pick
173173
initrd_phys_exclude
174174
kaslr_align_arch_default
175-
module_base_from_va_bits
175+
loongarch64_module_base
176176
module_base_ppc64_vmalloc
177177
page_offset_from_config
178178
page_offset_from_leak

tests/test_engine.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7780,9 +7780,9 @@ static void test_module_base_from_text(void) {
77807780
* width as CPUCFG1.VALEN + 1 while vm_map_base shifts by VALEN, so a reported
77817781
* 48 places the region at -(1 << 47); the 2-page term follows the kernel's page
77827782
* size, not the analysing build's. */
7783-
static void test_module_base_from_va_bits(void) {
7783+
static void test_loongarch64_module_base(void) {
77847784
struct engine e;
7785-
const rule_fn rules[] = {rule_module_base_from_va_bits};
7785+
const rule_fn rules[] = {rule_loongarch64_module_base};
77867786
struct estimate top;
77877787
quantities[Q_MODULE_BASE].init_top(&top);
77887788

@@ -8766,7 +8766,7 @@ int main(void) {
87668766
RUN(test_module_base_band_bounds);
87678767
RUN(test_module_base_execmem_window);
87688768
RUN(test_module_base_from_text);
8769-
RUN(test_module_base_from_va_bits);
8769+
RUN(test_loongarch64_module_base);
87708770
RUN(test_module_base_ppc64_vmalloc);
87718771

87728772
BEGIN_CATEGORY("EFI Loader Code disambiguation");

0 commit comments

Comments
 (0)