mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-07-05 12:00:51 +02:00
linuxkm/linuxkm_wc_port.h, linuxkm/module_hooks.c: on kernel >= 7.2, remove indirect symbol support for strncpy and add backward-compat implementation wc_linuxkm_strncpy().
This commit is contained in:
@@ -1012,9 +1012,12 @@
|
||||
#ifndef __ARCH_STRSTR_NO_REDIRECT
|
||||
typeof(strstr) *strstr;
|
||||
#endif
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(7, 2, 0)
|
||||
/* note strncpy() purged from kernel by 079a028d63 */
|
||||
#ifndef __ARCH_STRNCPY_NO_REDIRECT
|
||||
typeof(strncpy) *strncpy;
|
||||
#endif
|
||||
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(7, 2, 0) */
|
||||
#ifndef __ARCH_STRNCAT_NO_REDIRECT
|
||||
typeof(strncat) *strncat;
|
||||
#endif
|
||||
@@ -1364,9 +1367,11 @@
|
||||
#ifndef __ARCH_STRSTR_NO_REDIRECT
|
||||
#define strstr WC_PIE_INDIRECT_SYM(strstr)
|
||||
#endif
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(7, 2, 0)
|
||||
#ifndef __ARCH_STRNCPY_NO_REDIRECT
|
||||
#define strncpy WC_PIE_INDIRECT_SYM(strncpy)
|
||||
#endif
|
||||
#endif
|
||||
#ifndef __ARCH_STRNCAT_NO_REDIRECT
|
||||
#define strncat WC_PIE_INDIRECT_SYM(strncat)
|
||||
#endif
|
||||
@@ -1774,6 +1779,23 @@
|
||||
|
||||
#endif /* BUILDING_WOLFSSL */
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(7, 2, 0)
|
||||
/* note strncpy() purged from kernel by 079a028d63 */
|
||||
static __always_inline char *wc_linuxkm_strncpy(char *dst, const char *src, size_t dsize) {
|
||||
char *dstart = dst, *dend = dst + dsize;
|
||||
while (dst < dend) {
|
||||
if (*src == 0) {
|
||||
*dst = 0;
|
||||
/* don't bother zero-filling dst. */
|
||||
break;
|
||||
}
|
||||
*dst++ = *src++;
|
||||
}
|
||||
return dstart;
|
||||
}
|
||||
#define strncpy wc_linuxkm_strncpy
|
||||
#endif
|
||||
|
||||
#if !defined(BUILDING_WOLFSSL)
|
||||
/* some caller code needs these. */
|
||||
#if defined(WOLFSSL_USE_SAVE_VECTOR_REGISTERS)
|
||||
|
||||
@@ -1412,9 +1412,11 @@ static int set_up_wolfssl_linuxkm_pie_redirect_table(void) {
|
||||
#ifndef __ARCH_STRSTR_NO_REDIRECT
|
||||
wolfssl_linuxkm_pie_redirect_table.strstr = strstr;
|
||||
#endif
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(7, 2, 0)
|
||||
#ifndef __ARCH_STRNCPY_NO_REDIRECT
|
||||
wolfssl_linuxkm_pie_redirect_table.strncpy = strncpy;
|
||||
#endif
|
||||
#endif
|
||||
#ifndef __ARCH_STRNCAT_NO_REDIRECT
|
||||
wolfssl_linuxkm_pie_redirect_table.strncat = strncat;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user