[PATCH v3 13/19] modpost: Warn about calls from __pitext into other text sections

Ard Biesheuvel
2024-01-29T18:06:01Z

From: Ard Biesheuvel <ardb@kernel.org>

Ensure that code that is marked as being able to safely run from a 1:1
mapping does not call into other code which might lack that property.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
scripts/mod/modpost.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 962d00df47ab..33b56d6b4e7b 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -825,6 +825,7 @@ enum mismatch {
ANY_INIT_TO_ANY_EXIT,
ANY_EXIT_TO_ANY_INIT,
EXTABLE_TO_NON_TEXT,
+ PI_TEXT_TO_NON_PI_TEXT,
};

/**
@@ -887,6 +888,11 @@ static const struct sectioncheck sectioncheck[] = {
.bad_tosec = { ".altinstr_replacement", NULL },
.good_tosec = {ALL_TEXT_SECTIONS , NULL},
.mismatch = EXTABLE_TO_NON_TEXT,
+},
+{
+ .fromsec = { ALL_PI_TEXT_SECTIONS, NULL },
+ .bad_tosec = { ALL_NON_PI_TEXT_SECTIONS, NULL },
+ .mismatch = PI_TEXT_TO_NON_PI_TEXT,
}
};

--
2.43.0.429.g432eaa2c6b-goog