linuxkm: work around aarch64 dependency on alt_cb_patch_nops for enable-linuxkm-pie (FIPS support).

This commit is contained in:
Daniel Pouzzner
2024-11-26 00:12:29 -06:00
parent ea8c7c8322
commit 7dcec3e62f
3 changed files with 31 additions and 0 deletions

View File

@ -118,6 +118,11 @@
_Pragma("GCC diagnostic ignored \"-Wcast-function-type\""); /* needed for kernel 4.14.336 */
#include <linux/kconfig.h>
#if defined(__PIE__) && defined(CONFIG_ARM64)
#define alt_cb_patch_nops my__alt_cb_patch_nops
#endif
#include <linux/kernel.h>
#include <linux/ctype.h>
@ -668,6 +673,18 @@
typeof(dump_stack) *dump_stack;
#endif
#ifdef CONFIG_ARM64
#ifdef __PIE__
/* alt_cb_patch_nops defined early to allow shimming in system
* headers, but now we need the native one.
*/
#undef alt_cb_patch_nops
typeof(my__alt_cb_patch_nops) *alt_cb_patch_nops;
#else
typeof(alt_cb_patch_nops) *alt_cb_patch_nops;
#endif
#endif
const void *_last_slot;
};

View File

@ -595,6 +595,10 @@ static int set_up_wolfssl_linuxkm_pie_redirect_table(void) {
wolfssl_linuxkm_pie_redirect_table.dump_stack = dump_stack;
#endif
#ifdef CONFIG_ARM64
wolfssl_linuxkm_pie_redirect_table.alt_cb_patch_nops = alt_cb_patch_nops;
#endif
/* runtime assert that the table has no null slots after initialization. */
{
unsigned long *i;

View File

@ -4238,3 +4238,13 @@ char* mystrnstr(const char* s1, const char* s2, unsigned int n)
#endif /* Environment check */
#endif /* not SINGLE_THREADED */
#if defined(WOLFSSL_LINUXKM) && defined(CONFIG_ARM64) && \
defined(USE_WOLFSSL_LINUXKM_PIE_REDIRECT_TABLE)
noinstr void my__alt_cb_patch_nops(struct alt_instr *alt, __le32 *origptr,
__le32 *updptr, int nr_inst)
{
return (wolfssl_linuxkm_get_pie_redirect_table()->
alt_cb_patch_nops)(alt, origptr, updptr, nr_inst);
}
#endif