Skip to content

Commit dd158b0

Browse files
committed
linuxkm/linuxkm_wc_port.h and linuxkm/module_hooks.c: remove WOLFSSL_DEBUG_BACKTRACE_ERROR_CODES gate around setup for wolfssl_linuxkm_pie_redirect_table.dump_stack.
linuxkm/module_hooks.c: in wc_linuxkm_relax_long_loop(), use cpu_relax() as a fallback when non-preemptible.
1 parent 500c790 commit dd158b0

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

linuxkm/linuxkm_wc_port.h

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,9 +1072,7 @@
10721072

10731073
#endif /* !WOLFCRYPT_ONLY && !NO_CERTS */
10741074

1075-
#ifdef WOLFSSL_DEBUG_BACKTRACE_ERROR_CODES
10761075
typeof(dump_stack) *dump_stack;
1077-
#endif
10781076

10791077
#ifdef CONFIG_ARM64
10801078
#ifndef CONFIG_ARCH_TEGRA
@@ -1345,9 +1343,7 @@
13451343

13461344
#endif /* !WOLFCRYPT_ONLY && !NO_CERTS */
13471345

1348-
#ifdef WOLFSSL_DEBUG_BACKTRACE_ERROR_CODES
13491346
#define dump_stack WC_PIE_INDIRECT_SYM(dump_stack)
1350-
#endif
13511347

13521348
#undef preempt_count /* just in case -- not a macro on x86. */
13531349
#define preempt_count WC_PIE_INDIRECT_SYM(preempt_count)
@@ -1729,4 +1725,13 @@
17291725
#error unexpected BITS_PER_LONG value.
17301726
#endif
17311727

1728+
/* WC_DUMP_BACKTRACE_NONDEBUG is intended to dump a backtrace only if it hasn't
1729+
* already been dumped by the called function.
1730+
*/
1731+
#if defined(WOLFSSL_DEBUG_TRACE_ERROR_CODES) && defined(WOLFSSL_DEBUG_BACKTRACE_ERROR_CODES)
1732+
#define WC_DUMP_BACKTRACE_NONDEBUG WC_DO_NOTHING
1733+
#else
1734+
#define WC_DUMP_BACKTRACE_NONDEBUG dump_stack()
1735+
#endif
1736+
17321737
#endif /* LINUXKM_WC_PORT_H */

linuxkm/module_hooks.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,10 @@ void wc_linuxkm_relax_long_loop(void) {
297297
*/
298298
}
299299
#endif
300+
return;
300301
}
301302
#endif
303+
cpu_relax();
302304
}
303305

304306
#if defined(WC_LINUXKM_WOLFENTROPY_IN_GLUE_LAYER)
@@ -1475,9 +1477,7 @@ static int set_up_wolfssl_linuxkm_pie_redirect_table(void) {
14751477
#endif /* OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL */
14761478
#endif /* !WOLFCRYPT_ONLY && !NO_CERTS */
14771479

1478-
#ifdef WOLFSSL_DEBUG_BACKTRACE_ERROR_CODES
14791480
wolfssl_linuxkm_pie_redirect_table.dump_stack = dump_stack;
1480-
#endif
14811481

14821482
wolfssl_linuxkm_pie_redirect_table.preempt_count = my_preempt_count;
14831483
#ifndef _raw_spin_lock_irqsave

0 commit comments

Comments
 (0)