Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

20241125-linuxkm-aarch64-pie #8227

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions linuxkm/linuxkm_wc_port.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down Expand Up @@ -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;
};

Expand Down
4 changes: 4 additions & 0 deletions linuxkm/module_hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 10 additions & 0 deletions wolfcrypt/src/wc_port.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading