* [PATCH 1/2] string: move __compiletime_strlen() to string.h
@ 2026-02-05 10:05 Xie Yuanbin
2026-02-05 10:05 ` [PATCH 2/2] powerpc/text-patching: Fix possible stringop-overread compilation error Xie Yuanbin
0 siblings, 1 reply; 11+ messages in thread
From: Xie Yuanbin @ 2026-02-05 10:05 UTC (permalink / raw)
To: maddy, mpe, npiggin, chleroy, kees, andy
Cc: linuxppc-dev, linux-kernel, linux-hardening, lilinjie8, liaohua4,
xieyuanbin1
Move __compiletime_strlen() to string.h, so that others can use.
Signed-off-by: Xie Yuanbin <xieyuanbin1@huawei.com>
---
include/linux/fortify-string.h | 15 ---------------
include/linux/string.h | 15 +++++++++++++++
lib/tests/fortify_kunit.c | 3 ++-
3 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/include/linux/fortify-string.h b/include/linux/fortify-string.h
index 171982e53c9a..c181dac26353 100644
--- a/include/linux/fortify-string.h
+++ b/include/linux/fortify-string.h
@@ -58,21 +58,6 @@ void __read_overflow2_field(size_t avail, size_t wanted) __compiletime_warning("
void __write_overflow(void) __compiletime_error("detected write beyond size of object (1st parameter)");
void __write_overflow_field(size_t avail, size_t wanted) __compiletime_warning("detected write beyond size of field (1st parameter); maybe use struct_group()?");
-#define __compiletime_strlen(p) \
-({ \
- char *__p = (char *)(p); \
- size_t __ret = SIZE_MAX; \
- const size_t __p_size = __member_size(p); \
- if (__p_size != SIZE_MAX && \
- __builtin_constant_p(*__p)) { \
- size_t __p_len = __p_size - 1; \
- if (__builtin_constant_p(__p[__p_len]) && \
- __p[__p_len] == '\0') \
- __ret = __builtin_strlen(__p); \
- } \
- __ret; \
-})
-
#if defined(__SANITIZE_ADDRESS__)
#if !defined(CONFIG_CC_HAS_KASAN_MEMINTRINSIC_PREFIX) && !defined(CONFIG_GENERIC_ENTRY)
diff --git a/include/linux/string.h b/include/linux/string.h
index 1b564c36d721..fbae7d99bb6f 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -19,6 +19,21 @@ extern void *memdup_user(const void __user *, size_t) __realloc_size(2);
extern void *vmemdup_user(const void __user *, size_t) __realloc_size(2);
extern void *memdup_user_nul(const void __user *, size_t);
+#define __compiletime_strlen(p) \
+({ \
+ char *__p = (char *)(p); \
+ size_t __ret = SIZE_MAX; \
+ const size_t __p_size = __member_size(p); \
+ if (__p_size != SIZE_MAX && \
+ __builtin_constant_p(*__p)) { \
+ size_t __p_len = __p_size - 1; \
+ if (__builtin_constant_p(__p[__p_len]) && \
+ __p[__p_len] == '\0') \
+ __ret = __builtin_strlen(__p); \
+ } \
+ __ret; \
+})
+
/**
* memdup_array_user - duplicate array from user space
* @src: source address in user space
diff --git a/lib/tests/fortify_kunit.c b/lib/tests/fortify_kunit.c
index fc9c76f026d6..86181e3bd994 100644
--- a/lib/tests/fortify_kunit.c
+++ b/lib/tests/fortify_kunit.c
@@ -49,7 +49,8 @@ void fortify_add_kunit_error(int write);
#include <linux/vmalloc.h>
/* Handle being built without CONFIG_FORTIFY_SOURCE */
-#ifndef __compiletime_strlen
+#if defined(__NO_FORTIFY) || !defined(__OPTIMIZE__) || !defined(CONFIG_FORTIFY_SOURCE)
+# undef __compiletime_strlen
# define __compiletime_strlen __builtin_strlen
#endif
--
2.51.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/2] powerpc/text-patching: Fix possible stringop-overread compilation error
2026-02-05 10:05 [PATCH 1/2] string: move __compiletime_strlen() to string.h Xie Yuanbin
@ 2026-02-05 10:05 ` Xie Yuanbin
2026-02-05 16:40 ` Andy Shevchenko
2026-02-06 18:26 ` Kees Cook
0 siblings, 2 replies; 11+ messages in thread
From: Xie Yuanbin @ 2026-02-05 10:05 UTC (permalink / raw)
To: maddy, mpe, npiggin, chleroy, kees, andy
Cc: linuxppc-dev, linux-kernel, linux-hardening, lilinjie8, liaohua4,
xieyuanbin1
For strnlen(), if the compiler detects that the maxlen argument exceeds
the valid memory size of the input string object, a compilation error may
occur.
For lastest linux-next source, changing ppc_kallsyms_lookup_name() to
__always_inline, using default ppc64_defconfig, and setting
CONFIG_EXPERT=y, CONFIG_PPC64_BIG_ENDIAN_ELF_ABI_V2=n,
CONFIG_CC_OPTIMIZE_FOR_SIZE=y. Then, when using gcc-15 for compilation,
the following error will be triggered:
```log
CC arch/powerpc/kernel/optprobes.o
In file included from ./arch/powerpc/include/asm/kprobes.h:24,
from ./include/linux/kprobes.h:31,
from arch/powerpc/kernel/optprobes.c:8:
In function ‘ppc_kallsyms_lookup_name’,
inlined from ‘arch_prepare_optimized_kprobe’ at arch/powerpc/kernel/optprobes.c:209:21:
./arch/powerpc/include/asm/text-patching.h:232:13: error: ‘strnlen’ specified bound 512 exceeds source size 19 [-Werror=stringop-overread]
232 | if (strnlen(name, KSYM_NAME_LEN) >= KSYM_NAME_LEN)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘ppc_kallsyms_lookup_name’,
inlined from ‘arch_prepare_optimized_kprobe’ at arch/powerpc/kernel/optprobes.c:210:22:
./arch/powerpc/include/asm/text-patching.h:232:13: error: ‘strnlen’ specified bound 512 exceeds source size 13 [-Werror=stringop-overread]
232 | if (strnlen(name, KSYM_NAME_LEN) >= KSYM_NAME_LEN)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
```
Refer to the implementation of fortify's strnlen(). If the string length
is a compile-time constant, do not call the strnlen() function.
Signed-off-by: Xie Yuanbin <xieyuanbin1@huawei.com>
---
arch/powerpc/include/asm/text-patching.h | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/include/asm/text-patching.h b/arch/powerpc/include/asm/text-patching.h
index e7f14720f630..ce1b2131980a 100644
--- a/arch/powerpc/include/asm/text-patching.h
+++ b/arch/powerpc/include/asm/text-patching.h
@@ -228,8 +228,13 @@ static inline unsigned long ppc_kallsyms_lookup_name(const char *name)
/* check for dot variant */
char dot_name[1 + KSYM_NAME_LEN];
bool dot_appended = false;
+ size_t n_len = __compiletime_strlen(name);
+ const size_t n_size = __member_size(name);
- if (strnlen(name, KSYM_NAME_LEN) >= KSYM_NAME_LEN)
+ if (n_len == SIZE_MAX || KSYM_NAME_LEN < n_size)
+ n_len = strnlen(name, KSYM_NAME_LEN);
+
+ if (n_len >= KSYM_NAME_LEN)
return 0;
if (name[0] != '.') {
--
2.51.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] powerpc/text-patching: Fix possible stringop-overread compilation error
2026-02-05 10:05 ` [PATCH 2/2] powerpc/text-patching: Fix possible stringop-overread compilation error Xie Yuanbin
@ 2026-02-05 16:40 ` Andy Shevchenko
2026-02-06 11:14 ` Xie Yuanbin
2026-02-06 18:26 ` Kees Cook
1 sibling, 1 reply; 11+ messages in thread
From: Andy Shevchenko @ 2026-02-05 16:40 UTC (permalink / raw)
To: Xie Yuanbin
Cc: maddy, mpe, npiggin, chleroy, kees, andy, linuxppc-dev,
linux-kernel, linux-hardening, lilinjie8, liaohua4
On Thu, Feb 05, 2026 at 06:05:17PM +0800, Xie Yuanbin wrote:
First of all, when sending a series, always add a cover letter to explain
dependencies, goal, and how to route the series via the respective tree(s),
et cetera.
> For strnlen(), if the compiler detects that the maxlen argument exceeds
> the valid memory size of the input string object, a compilation error may
> occur.
>
> For lastest linux-next source, changing ppc_kallsyms_lookup_name() to
> __always_inline,
So, there is no issue in upstream without the mentioned change, right?
> using default ppc64_defconfig, and setting
> CONFIG_EXPERT=y, CONFIG_PPC64_BIG_ENDIAN_ELF_ABI_V2=n,
> CONFIG_CC_OPTIMIZE_FOR_SIZE=y. Then, when using gcc-15 for compilation,
> the following error will be triggered:
> ```log
> CC arch/powerpc/kernel/optprobes.o
> In file included from ./arch/powerpc/include/asm/kprobes.h:24,
> from ./include/linux/kprobes.h:31,
> from arch/powerpc/kernel/optprobes.c:8:
> In function ‘ppc_kallsyms_lookup_name’,
> inlined from ‘arch_prepare_optimized_kprobe’ at arch/powerpc/kernel/optprobes.c:209:21:
> ./arch/powerpc/include/asm/text-patching.h:232:13: error: ‘strnlen’ specified bound 512 exceeds source size 19 [-Werror=stringop-overread]
> 232 | if (strnlen(name, KSYM_NAME_LEN) >= KSYM_NAME_LEN)
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> In function ‘ppc_kallsyms_lookup_name’,
> inlined from ‘arch_prepare_optimized_kprobe’ at arch/powerpc/kernel/optprobes.c:210:22:
> ./arch/powerpc/include/asm/text-patching.h:232:13: error: ‘strnlen’ specified bound 512 exceeds source size 13 [-Werror=stringop-overread]
> 232 | if (strnlen(name, KSYM_NAME_LEN) >= KSYM_NAME_LEN)
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
> ```
>
> Refer to the implementation of fortify's strnlen(). If the string length
> is a compile-time constant, do not call the strnlen() function.
I don't with the first patch this is a correct approach.
But I let others to comment, I assume Kees knows better
what's this and how it can be fixed without exporting
special macros.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] powerpc/text-patching: Fix possible stringop-overread compilation error
2026-02-05 16:40 ` Andy Shevchenko
@ 2026-02-06 11:14 ` Xie Yuanbin
0 siblings, 0 replies; 11+ messages in thread
From: Xie Yuanbin @ 2026-02-06 11:14 UTC (permalink / raw)
To: maddy, mpe, npiggin, chleroy, kees, andy
Cc: linuxppc-dev, linux-kernel, linux-hardening, lilinjie8, liaohua4,
xieyuanbin1
On Thu, 5 Feb 2026 18:40:08 +0200, Andy Shevchenko wrote:
>> For strnlen(), if the compiler detects that the maxlen argument exceeds
>> the valid memory size of the input string object, a compilation error may
>> occur.
>>
>> For lastest linux-next source, changing ppc_kallsyms_lookup_name() to
>> __always_inline,
>
> So, there is no issue in upstream without the mentioned change, right?
Yes. However, before the commit 889b3c1245de48ed0cac ("compiler: remove
CONFIG_OPTIMIZE_INLINING entirely") is merged, inline will be changed to
__always_inline, and this error will be directly triggered.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] powerpc/text-patching: Fix possible stringop-overread compilation error
2026-02-05 10:05 ` [PATCH 2/2] powerpc/text-patching: Fix possible stringop-overread compilation error Xie Yuanbin
2026-02-05 16:40 ` Andy Shevchenko
@ 2026-02-06 18:26 ` Kees Cook
2026-02-06 19:53 ` Christophe Leroy (CS GROUP)
1 sibling, 1 reply; 11+ messages in thread
From: Kees Cook @ 2026-02-06 18:26 UTC (permalink / raw)
To: Xie Yuanbin
Cc: maddy, mpe, npiggin, chleroy, andy, linuxppc-dev, linux-kernel,
linux-hardening, lilinjie8, liaohua4
On Thu, Feb 05, 2026 at 06:05:17PM +0800, Xie Yuanbin wrote:
> For strnlen(), if the compiler detects that the maxlen argument exceeds
> the valid memory size of the input string object, a compilation error may
> occur.
>
> For lastest linux-next source, changing ppc_kallsyms_lookup_name() to
> __always_inline, using default ppc64_defconfig, and setting
> CONFIG_EXPERT=y, CONFIG_PPC64_BIG_ENDIAN_ELF_ABI_V2=n,
> CONFIG_CC_OPTIMIZE_FOR_SIZE=y. Then, when using gcc-15 for compilation,
> the following error will be triggered:
> ```log
> CC arch/powerpc/kernel/optprobes.o
> In file included from ./arch/powerpc/include/asm/kprobes.h:24,
> from ./include/linux/kprobes.h:31,
> from arch/powerpc/kernel/optprobes.c:8:
> In function ‘ppc_kallsyms_lookup_name’,
> inlined from ‘arch_prepare_optimized_kprobe’ at arch/powerpc/kernel/optprobes.c:209:21:
> ./arch/powerpc/include/asm/text-patching.h:232:13: error: ‘strnlen’ specified bound 512 exceeds source size 19 [-Werror=stringop-overread]
> 232 | if (strnlen(name, KSYM_NAME_LEN) >= KSYM_NAME_LEN)
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> In function ‘ppc_kallsyms_lookup_name’,
> inlined from ‘arch_prepare_optimized_kprobe’ at arch/powerpc/kernel/optprobes.c:210:22:
> ./arch/powerpc/include/asm/text-patching.h:232:13: error: ‘strnlen’ specified bound 512 exceeds source size 13 [-Werror=stringop-overread]
> 232 | if (strnlen(name, KSYM_NAME_LEN) >= KSYM_NAME_LEN)
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
> ```
>
> Refer to the implementation of fortify's strnlen(). If the string length
> is a compile-time constant, do not call the strnlen() function.
>
> Signed-off-by: Xie Yuanbin <xieyuanbin1@huawei.com>
> ---
> arch/powerpc/include/asm/text-patching.h | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/include/asm/text-patching.h b/arch/powerpc/include/asm/text-patching.h
> index e7f14720f630..ce1b2131980a 100644
> --- a/arch/powerpc/include/asm/text-patching.h
> +++ b/arch/powerpc/include/asm/text-patching.h
> @@ -228,8 +228,13 @@ static inline unsigned long ppc_kallsyms_lookup_name(const char *name)
> /* check for dot variant */
> char dot_name[1 + KSYM_NAME_LEN];
> bool dot_appended = false;
> + size_t n_len = __compiletime_strlen(name);
> + const size_t n_size = __member_size(name);
>
> - if (strnlen(name, KSYM_NAME_LEN) >= KSYM_NAME_LEN)
> + if (n_len == SIZE_MAX || KSYM_NAME_LEN < n_size)
> + n_len = strnlen(name, KSYM_NAME_LEN);
> +
> + if (n_len >= KSYM_NAME_LEN)
> return 0;
Isn't it possible to do this and not need __compiletime_strlen at all?
n_len = strnlen(name, min(__member_size(name), KSYM_NAME_LEN));
?
>
> if (name[0] != '.') {
> --
> 2.51.0
>
--
Kees Cook
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] powerpc/text-patching: Fix possible stringop-overread compilation error
2026-02-06 18:26 ` Kees Cook
@ 2026-02-06 19:53 ` Christophe Leroy (CS GROUP)
2026-02-09 13:25 ` Xie Yuanbin
0 siblings, 1 reply; 11+ messages in thread
From: Christophe Leroy (CS GROUP) @ 2026-02-06 19:53 UTC (permalink / raw)
To: Kees Cook, Xie Yuanbin
Cc: maddy, mpe, npiggin, andy, linuxppc-dev, linux-kernel,
linux-hardening, lilinjie8, liaohua4
Le 06/02/2026 à 19:26, Kees Cook a écrit :
> On Thu, Feb 05, 2026 at 06:05:17PM +0800, Xie Yuanbin wrote:
>> For strnlen(), if the compiler detects that the maxlen argument exceeds
>> the valid memory size of the input string object, a compilation error may
>> occur.
>>
>> For lastest linux-next source, changing ppc_kallsyms_lookup_name() to
>> __always_inline, using default ppc64_defconfig, and setting
>> CONFIG_EXPERT=y, CONFIG_PPC64_BIG_ENDIAN_ELF_ABI_V2=n,
>> CONFIG_CC_OPTIMIZE_FOR_SIZE=y. Then, when using gcc-15 for compilation,
>> the following error will be triggered:
>> ```log
>> CC arch/powerpc/kernel/optprobes.o
>> In file included from ./arch/powerpc/include/asm/kprobes.h:24,
>> from ./include/linux/kprobes.h:31,
>> from arch/powerpc/kernel/optprobes.c:8:
>> In function ‘ppc_kallsyms_lookup_name’,
>> inlined from ‘arch_prepare_optimized_kprobe’ at arch/powerpc/kernel/optprobes.c:209:21:
>> ./arch/powerpc/include/asm/text-patching.h:232:13: error: ‘strnlen’ specified bound 512 exceeds source size 19 [-Werror=stringop-overread]
>> 232 | if (strnlen(name, KSYM_NAME_LEN) >= KSYM_NAME_LEN)
>> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> In function ‘ppc_kallsyms_lookup_name’,
>> inlined from ‘arch_prepare_optimized_kprobe’ at arch/powerpc/kernel/optprobes.c:210:22:
>> ./arch/powerpc/include/asm/text-patching.h:232:13: error: ‘strnlen’ specified bound 512 exceeds source size 13 [-Werror=stringop-overread]
>> 232 | if (strnlen(name, KSYM_NAME_LEN) >= KSYM_NAME_LEN)
>> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> cc1: all warnings being treated as errors
>> ```
>>
>> Refer to the implementation of fortify's strnlen(). If the string length
>> is a compile-time constant, do not call the strnlen() function.
>>
>> Signed-off-by: Xie Yuanbin <xieyuanbin1@huawei.com>
>> ---
>> arch/powerpc/include/asm/text-patching.h | 7 ++++++-
>> 1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/powerpc/include/asm/text-patching.h b/arch/powerpc/include/asm/text-patching.h
>> index e7f14720f630..ce1b2131980a 100644
>> --- a/arch/powerpc/include/asm/text-patching.h
>> +++ b/arch/powerpc/include/asm/text-patching.h
>> @@ -228,8 +228,13 @@ static inline unsigned long ppc_kallsyms_lookup_name(const char *name)
>> /* check for dot variant */
>> char dot_name[1 + KSYM_NAME_LEN];
>> bool dot_appended = false;
>> + size_t n_len = __compiletime_strlen(name);
>> + const size_t n_size = __member_size(name);
>>
>> - if (strnlen(name, KSYM_NAME_LEN) >= KSYM_NAME_LEN)
>> + if (n_len == SIZE_MAX || KSYM_NAME_LEN < n_size)
>> + n_len = strnlen(name, KSYM_NAME_LEN);
>> +
>> + if (n_len >= KSYM_NAME_LEN)
>> return 0;
>
> Isn't it possible to do this and not need __compiletime_strlen at all?
>
> n_len = strnlen(name, min(__member_size(name), KSYM_NAME_LEN));
ppc_kallsyms_lookup_name() only has two callers and they call it with a
built-in string. I think we can do something a lot simpler, something
like (untested):
static inline unsigned long __ppc_kallsyms_lookup_name(const char *name)
{
unsigned long addr = kallsyms_lookup_name(name);
if (IS_ENABLED(CONFIG_PPC64_ELF_ABI_V2) && addr)
addr = ppc_function_entry((void *)addr);
return addr;
}
#ifdef CONFIG_PPC64_ELF_ABI_V1
#define ppc_kallsyms_lookup_name(x) __ppc_kallsyms_lookup_name("." ## x);
#else
#define ppc_kallsyms_lookup_name(x) __ppc_kallsyms_lookup_name(x)
#endif
Christophe
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] powerpc/text-patching: Fix possible stringop-overread compilation error
2026-02-06 19:53 ` Christophe Leroy (CS GROUP)
@ 2026-02-09 13:25 ` Xie Yuanbin
2026-02-09 13:41 ` Christophe Leroy (CS GROUP)
0 siblings, 1 reply; 11+ messages in thread
From: Xie Yuanbin @ 2026-02-09 13:25 UTC (permalink / raw)
To: chleroy, andriy.shevchenko, maddy, mpe, npiggin, kees, andy
Cc: linuxppc-dev, linux-kernel, linux-hardening, lilinjie8, liaohua4,
xieyuanbin1
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="y", Size: 1564 bytes --]
On Fri, 6 Feb 2026 20:53:55 +0100, Christophe Leroy (CS GROUP) wrote:
> Le 06/02/2026 à 19:26, Kees Cook a écrit :
>>
>> Isn't it possible to do this and not need __compiletime_strlen at all?
>>
>> n_len = strnlen(name, min(__member_size(name), KSYM_NAME_LEN));
>
> ppc_kallsyms_lookup_name() only has two callers and they call it with a
> built-in string. I think we can do something a lot simpler, something
> like (untested):
>
> static inline unsigned long __ppc_kallsyms_lookup_name(const char *name)
> {
> unsigned long addr = kallsyms_lookup_name(name);
>
> if (IS_ENABLED(CONFIG_PPC64_ELF_ABI_V2) && addr)
> addr = ppc_function_entry((void *)addr);
>
> return addr;
> }
>
> #ifdef CONFIG_PPC64_ELF_ABI_V1
> #define ppc_kallsyms_lookup_name(x) __ppc_kallsyms_lookup_name("." ## x);
> #else
> #define ppc_kallsyms_lookup_name(x) __ppc_kallsyms_lookup_name(x)
> #endif
>
> Christophe
When CONFIG_PPC64_ELF_ABI_V1=y, it seems that the try of lookupinp
the original non-dot symbol is missing.
What about this (Only the compilation test is performed):
```c
static inline unsigned long __ppc_kallsyms_lookup_name(const char *name)
{
unsigned long addr = kallsyms_lookup_name(name);
if (IS_ENABLED(CONFIG_PPC64_ELF_ABI_V2) && addr)
addr = ppc_function_entry((void *)addr);
return addr;
}
#define ppc_kallsyms_lookup_name(x) ({ \
unsigned long addr = 0; \
if (IS_ENABLED(CONFIG_PPC64_ELF_ABI_V1)) \
addr = __ppc_kallsyms_lookup_name("." x); \
if (!addr) \
addr = __ppc_kallsyms_lookup_name(x); \
addr; \
})
```
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] powerpc/text-patching: Fix possible stringop-overread compilation error
2026-02-09 13:25 ` Xie Yuanbin
@ 2026-02-09 13:41 ` Christophe Leroy (CS GROUP)
2026-02-09 14:11 ` Xie Yuanbin
2026-04-30 7:28 ` Xie Yuanbin
0 siblings, 2 replies; 11+ messages in thread
From: Christophe Leroy (CS GROUP) @ 2026-02-09 13:41 UTC (permalink / raw)
To: Xie Yuanbin, andriy.shevchenko, maddy, mpe, npiggin, kees, andy
Cc: linuxppc-dev, linux-kernel, linux-hardening, lilinjie8, liaohua4
Le 09/02/2026 à 14:25, Xie Yuanbin a écrit :
> On Fri, 6 Feb 2026 20:53:55 +0100, Christophe Leroy (CS GROUP) wrote:
>> Le 06/02/2026 à 19:26, Kees Cook a écrit :
>>>
>>> Isn't it possible to do this and not need __compiletime_strlen at all?
>>>
>>> n_len = strnlen(name, min(__member_size(name), KSYM_NAME_LEN));
>>
>> ppc_kallsyms_lookup_name() only has two callers and they call it with a
>> built-in string. I think we can do something a lot simpler, something
>> like (untested):
>>
>> static inline unsigned long __ppc_kallsyms_lookup_name(const char *name)
>> {
>> unsigned long addr = kallsyms_lookup_name(name);
>>
>> if (IS_ENABLED(CONFIG_PPC64_ELF_ABI_V2) && addr)
>> addr = ppc_function_entry((void *)addr);
>>
>> return addr;
>> }
>>
>> #ifdef CONFIG_PPC64_ELF_ABI_V1
>> #define ppc_kallsyms_lookup_name(x) __ppc_kallsyms_lookup_name("." ## x);
>> #else
>> #define ppc_kallsyms_lookup_name(x) __ppc_kallsyms_lookup_name(x)
>> #endif
>>
>> Christophe
>
> When CONFIG_PPC64_ELF_ABI_V1=y, it seems that the try of lookupinp
> the original non-dot symbol is missing.
>
> What about this (Only the compilation test is performed):
> ```c
> static inline unsigned long __ppc_kallsyms_lookup_name(const char *name)
> {
> unsigned long addr = kallsyms_lookup_name(name);
>
> if (IS_ENABLED(CONFIG_PPC64_ELF_ABI_V2) && addr)
> addr = ppc_function_entry((void *)addr);
>
> return addr;
> }
>
> #define ppc_kallsyms_lookup_name(x) ({ \
> unsigned long addr = 0; \
> if (IS_ENABLED(CONFIG_PPC64_ELF_ABI_V1)) \
> addr = __ppc_kallsyms_lookup_name("." x); \
> if (!addr) \
> addr = __ppc_kallsyms_lookup_name(x); \
> addr; \
> })
> ```
Good point.
To avoid duplicating the string I'd suggest:
static inline unsigned long __ppc_kallsyms_lookup_name(const char *name)
{
unsigned long addr = kallsyms_lookup_name(name);
if (IS_ENABLED(CONFIG_PPC64_ELF_ABI_V1) && !addr)
addr = kallsyms_lookup_name(name + 1);
if (IS_ENABLED(CONFIG_PPC64_ELF_ABI_V2) && addr)
addr = ppc_function_entry((void *)addr);
return addr;
}
#ifdef CONFIG_PPC64_ELF_ABI_V1
#define ppc_kallsyms_lookup_name(x) __ppc_kallsyms_lookup_name("." x);
#else
#define ppc_kallsyms_lookup_name(x) __ppc_kallsyms_lookup_name(x)
#endif
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] powerpc/text-patching: Fix possible stringop-overread compilation error
2026-02-09 13:41 ` Christophe Leroy (CS GROUP)
@ 2026-02-09 14:11 ` Xie Yuanbin
2026-04-30 7:28 ` Xie Yuanbin
1 sibling, 0 replies; 11+ messages in thread
From: Xie Yuanbin @ 2026-02-09 14:11 UTC (permalink / raw)
To: chleroy, andriy.shevchenko, maddy, mpe, npiggin, kees, andy
Cc: linuxppc-dev, linux-kernel, linux-hardening, lilinjie8, liaohua4,
xieyuanbin1
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="y", Size: 2382 bytes --]
On Mon, 9 Feb 2026 14:41:51 +0100, Christophe Leroy (CS GROUP) wrote:
> Le 09/02/2026 à 14:25, Xie Yuanbin a écrit :
>> On Fri, 6 Feb 2026 20:53:55 +0100, Christophe Leroy (CS GROUP) wrote:
>>> ppc_kallsyms_lookup_name() only has two callers and they call it with a
>>> built-in string. I think we can do something a lot simpler, something
>>> like (untested):
>>>
>>> static inline unsigned long __ppc_kallsyms_lookup_name(const char *name)
>>> {
>>> unsigned long addr = kallsyms_lookup_name(name);
>>>
>>> if (IS_ENABLED(CONFIG_PPC64_ELF_ABI_V2) && addr)
>>> addr = ppc_function_entry((void *)addr);
>>>
>>> return addr;
>>> }
>>>
>>> #ifdef CONFIG_PPC64_ELF_ABI_V1
>>> #define ppc_kallsyms_lookup_name(x) __ppc_kallsyms_lookup_name("." ## x);
>>> #else
>>> #define ppc_kallsyms_lookup_name(x) __ppc_kallsyms_lookup_name(x)
>>> #endif
>>>
>>> Christophe
>>
>> When CONFIG_PPC64_ELF_ABI_V1=y, it seems that the try of lookupinp
>> the original non-dot symbol is missing.
>>
>> What about this (Only the compilation test is performed):
>> ```c
>> static inline unsigned long __ppc_kallsyms_lookup_name(const char *name)
>> {
>> unsigned long addr = kallsyms_lookup_name(name);
>>
>> if (IS_ENABLED(CONFIG_PPC64_ELF_ABI_V2) && addr)
>> addr = ppc_function_entry((void *)addr);
>>
>> return addr;
>> }
>>
>> #define ppc_kallsyms_lookup_name(x) ({ \
>> unsigned long addr = 0; \
>> if (IS_ENABLED(CONFIG_PPC64_ELF_ABI_V1)) \
>> addr = __ppc_kallsyms_lookup_name("." x); \
>> if (!addr) \
>> addr = __ppc_kallsyms_lookup_name(x); \
>> addr; \
>> })
>> ```
>
> Good point.
>
> To avoid duplicating the string I'd suggest:
>
> static inline unsigned long __ppc_kallsyms_lookup_name(const char *name)
> {
> unsigned long addr = kallsyms_lookup_name(name);
>
> if (IS_ENABLED(CONFIG_PPC64_ELF_ABI_V1) && !addr)
> addr = kallsyms_lookup_name(name + 1);
> if (IS_ENABLED(CONFIG_PPC64_ELF_ABI_V2) && addr)
> addr = ppc_function_entry((void *)addr);
>
> return addr;
> }
>
> #ifdef CONFIG_PPC64_ELF_ABI_V1
> #define ppc_kallsyms_lookup_name(x) __ppc_kallsyms_lookup_name("." x);
> #else
> #define ppc_kallsyms_lookup_name(x) __ppc_kallsyms_lookup_name(x)
> #endif
This seems good, but there seems to be an extra ';' after
'__ppc_kallsyms_lookup_name("." x)' ?
After removing the extra ';', I performed a compilation test,
no warnings.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] powerpc/text-patching: Fix possible stringop-overread compilation error
2026-02-09 13:41 ` Christophe Leroy (CS GROUP)
2026-02-09 14:11 ` Xie Yuanbin
@ 2026-04-30 7:28 ` Xie Yuanbin
2026-04-30 9:41 ` Christophe Leroy (CS GROUP)
1 sibling, 1 reply; 11+ messages in thread
From: Xie Yuanbin @ 2026-04-30 7:28 UTC (permalink / raw)
To: chleroy, andriy.shevchenko, maddy, mpe, npiggin, kees, andy
Cc: linuxppc-dev, linux-kernel, linux-hardening, lilinjie8, liaohua4,
xieyuanbin1
Hi, Christophe Leroy!
On Mon, 9 Feb 2026 14:41:51 +0100, Christophe Leroy (CS GROUP) wrote:
> On 09/02/2026 14:25, Xie Yuanbin wrote:
>> When CONFIG_PPC64_ELF_ABI_V1=y, it seems that the try of lookupinp
>> the original non-dot symbol is missing.
>>
>> What about this (Only the compilation test is performed):
>> ```c
>> static inline unsigned long __ppc_kallsyms_lookup_name(const char *name)
>> {
>> unsigned long addr = kallsyms_lookup_name(name);
>>
>> if (IS_ENABLED(CONFIG_PPC64_ELF_ABI_V2) && addr)
>> addr = ppc_function_entry((void *)addr);
>>
>> return addr;
>> }
>>
>> #define ppc_kallsyms_lookup_name(x) ({ \
>> unsigned long addr = 0; \
>> if (IS_ENABLED(CONFIG_PPC64_ELF_ABI_V1)) \
>> addr = __ppc_kallsyms_lookup_name("." x); \
>> if (!addr) \
>> addr = __ppc_kallsyms_lookup_name(x); \
>> addr; \
>> })
>> ```
>
> Good point.
>
> To avoid duplicating the string I'd suggest:
>
> static inline unsigned long __ppc_kallsyms_lookup_name(const char *name)
> {
> unsigned long addr = kallsyms_lookup_name(name);
>
> if (IS_ENABLED(CONFIG_PPC64_ELF_ABI_V1) && !addr)
> addr = kallsyms_lookup_name(name + 1);
> if (IS_ENABLED(CONFIG_PPC64_ELF_ABI_V2) && addr)
> addr = ppc_function_entry((void *)addr);
>
> return addr;
> }
>
> #ifdef CONFIG_PPC64_ELF_ABI_V1
> #define ppc_kallsyms_lookup_name(x) __ppc_kallsyms_lookup_name("." x);
> #else
> #define ppc_kallsyms_lookup_name(x) __ppc_kallsyms_lookup_name(x)
> #endif
I would like to submit the modification as a new patch, and include you
as Co-developer. Do you agree?
Full of the patch:
```patch
From fbf07e5c1a97da7c8572435537f2b92213ede39d Mon Sep 17 00:00:00 2001
From: Xie Yuanbin <xieyuanbin1@huawei.com>
Date: Thu, 30 Apr 2026 14:15:26 +0800
Subject: [PATCH V2] powerpc/text-patching: simplify the implementation of ppc_kallsyms_lookup_name()
ppc_kallsyms_lookup_name() is called only twice in the kernel code, and
the parameters are all constant strings. strnlen(name, KSYM_NAME_LEN) is
called inside ppc_kallsyms_lookup_name(), when the compiler detects that
KSYM_NAME_LEN is larger then the constant strings,
the following error will be triggered:
```log
CC arch/powerpc/kernel/optprobes.o
In file included from ./arch/powerpc/include/asm/kprobes.h:24,
from ./include/linux/kprobes.h:31,
from arch/powerpc/kernel/optprobes.c:8:
In function ‘ppc_kallsyms_lookup_name’,
inlined from ‘arch_prepare_optimized_kprobe’ at arch/powerpc/kernel/optprobes.c:209:21:
./arch/powerpc/include/asm/text-patching.h:232:13: error: ‘strnlen’ specified bound 512 exceeds source size 19 [-Werror=stringop-overread]
232 | if (strnlen(name, KSYM_NAME_LEN) >= KSYM_NAME_LEN)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘ppc_kallsyms_lookup_name’,
inlined from ‘arch_prepare_optimized_kprobe’ at arch/powerpc/kernel/optprobes.c:210:22:
./arch/powerpc/include/asm/text-patching.h:232:13: error: ‘strnlen’ specified bound 512 exceeds source size 13 [-Werror=stringop-overread]
232 | if (strnlen(name, KSYM_NAME_LEN) >= KSYM_NAME_LEN)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
```
The error can be reproduced in the following ways:
Use lastest linux-next source, change ppc_kallsyms_lookup_name() to
__always_inline, use default ppc64_defconfig, set CONFIG_EXPERT=y,
CONFIG_PPC64_BIG_ENDIAN_ELF_ABI_V2=n, CONFIG_CC_OPTIMIZE_FOR_SIZE=y,
and use gcc-14 or a later version for compilation.
Since ppc_kallsyms_lookup_name() is called only twice in the kernel,
and the parameters are all constant strins, simplify the implementation
of ppc_kallsyms_lookup_name() and avoid calling strnlen().
Cc: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: Kees Cook <kees@kernel.org>
Co-developed-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
Signed-off-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
Signed-off-by: Xie Yuanbin <xieyuanbin1@huawei.com>
---
v1->v2: https://lore.kernel.org/20260205100517.292858-2-xieyuanbin1@huawei.com
- Not use strlen()
arch/powerpc/include/asm/text-patching.h | 42 ++++++++----------------
1 file changed, 17 insertions(+), 33 deletions(-)
diff --git a/arch/powerpc/include/asm/text-patching.h b/arch/powerpc/include/asm/text-patching.h
index e7f14720f630..2d3f698cb4f1 100644
--- a/arch/powerpc/include/asm/text-patching.h
+++ b/arch/powerpc/include/asm/text-patching.h
@@ -221,39 +221,23 @@ static inline unsigned long ppc_global_function_entry(void *func)
* - For ABIv1, we lookup the dot variant.
* - For ABIv2, we return the local entry point.
*/
-static inline unsigned long ppc_kallsyms_lookup_name(const char *name)
-{
- unsigned long addr;
-#ifdef CONFIG_PPC64_ELF_ABI_V1
- /* check for dot variant */
- char dot_name[1 + KSYM_NAME_LEN];
- bool dot_appended = false;
-
- if (strnlen(name, KSYM_NAME_LEN) >= KSYM_NAME_LEN)
- return 0;
-
- if (name[0] != '.') {
- dot_name[0] = '.';
- dot_name[1] = '\0';
- strlcat(dot_name, name, sizeof(dot_name));
- dot_appended = true;
- } else {
- dot_name[0] = '\0';
- strlcat(dot_name, name, sizeof(dot_name));
- }
- addr = kallsyms_lookup_name(dot_name);
- if (!addr && dot_appended)
- /* Let's try the original non-dot symbol lookup */
- addr = kallsyms_lookup_name(name);
-#elif defined(CONFIG_PPC64_ELF_ABI_V2)
- addr = kallsyms_lookup_name(name);
- if (addr)
- addr = ppc_function_entry((void *)addr);
-#else
- addr = kallsyms_lookup_name(name);
-#endif
- return addr;
-}
+static inline unsigned long __ppc_kallsyms_lookup_name(const char *name)
+{
+ unsigned long addr = kallsyms_lookup_name(name);
+
+ if (IS_ENABLED(CONFIG_PPC64_ELF_ABI_V1) && !addr)
+ addr = kallsyms_lookup_name(name + 1);
+ if (IS_ENABLED(CONFIG_PPC64_ELF_ABI_V2) && addr)
+ addr = ppc_function_entry((void *)addr);
+
+ return addr;
+}
+
+#ifdef CONFIG_PPC64_ELF_ABI_V1
+#define ppc_kallsyms_lookup_name(x) __ppc_kallsyms_lookup_name("." x)
+#else
+#define ppc_kallsyms_lookup_name(x) __ppc_kallsyms_lookup_name(x)
+#endif
/*
* Some instruction encodings commonly used in dynamic ftracing
--
2.53.0
```
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] powerpc/text-patching: Fix possible stringop-overread compilation error
2026-04-30 7:28 ` Xie Yuanbin
@ 2026-04-30 9:41 ` Christophe Leroy (CS GROUP)
0 siblings, 0 replies; 11+ messages in thread
From: Christophe Leroy (CS GROUP) @ 2026-04-30 9:41 UTC (permalink / raw)
To: Xie Yuanbin, andriy.shevchenko, maddy, mpe, npiggin, kees, andy
Cc: linuxppc-dev, linux-kernel, linux-hardening, lilinjie8, liaohua4
Le 30/04/2026 à 09:28, Xie Yuanbin a écrit :
> Hi, Christophe Leroy!
>
> On Mon, 9 Feb 2026 14:41:51 +0100, Christophe Leroy (CS GROUP) wrote:
>> On 09/02/2026 14:25, Xie Yuanbin wrote:
>>> When CONFIG_PPC64_ELF_ABI_V1=y, it seems that the try of lookupinp
>>> the original non-dot symbol is missing.
>>>
>>> What about this (Only the compilation test is performed):
>>> ```c
>>> static inline unsigned long __ppc_kallsyms_lookup_name(const char *name)
>>> {
>>> unsigned long addr = kallsyms_lookup_name(name);
>>>
>>> if (IS_ENABLED(CONFIG_PPC64_ELF_ABI_V2) && addr)
>>> addr = ppc_function_entry((void *)addr);
>>>
>>> return addr;
>>> }
>>>
>>> #define ppc_kallsyms_lookup_name(x) ({ \
>>> unsigned long addr = 0; \
>>> if (IS_ENABLED(CONFIG_PPC64_ELF_ABI_V1)) \
>>> addr = __ppc_kallsyms_lookup_name("." x); \
>>> if (!addr) \
>>> addr = __ppc_kallsyms_lookup_name(x); \
>>> addr; \
>>> })
>>> ```
>>
>> Good point.
>>
>> To avoid duplicating the string I'd suggest:
>>
>> static inline unsigned long __ppc_kallsyms_lookup_name(const char *name)
>> {
>> unsigned long addr = kallsyms_lookup_name(name);
>>
>> if (IS_ENABLED(CONFIG_PPC64_ELF_ABI_V1) && !addr)
>> addr = kallsyms_lookup_name(name + 1);
>> if (IS_ENABLED(CONFIG_PPC64_ELF_ABI_V2) && addr)
>> addr = ppc_function_entry((void *)addr);
>>
>> return addr;
>> }
>>
>> #ifdef CONFIG_PPC64_ELF_ABI_V1
>> #define ppc_kallsyms_lookup_name(x) __ppc_kallsyms_lookup_name("." x);
>> #else
>> #define ppc_kallsyms_lookup_name(x) __ppc_kallsyms_lookup_name(x)
>> #endif
>
> I would like to submit the modification as a new patch, and include you
> as Co-developer. Do you agree?
Add me as Suggested-by: instead.
Thanks
Christophe
>
> Full of the patch:
> ```patch
> From fbf07e5c1a97da7c8572435537f2b92213ede39d Mon Sep 17 00:00:00 2001
> From: Xie Yuanbin <xieyuanbin1@huawei.com>
> Date: Thu, 30 Apr 2026 14:15:26 +0800
> Subject: [PATCH V2] powerpc/text-patching: simplify the implementation of ppc_kallsyms_lookup_name()
>
> ppc_kallsyms_lookup_name() is called only twice in the kernel code, and
> the parameters are all constant strings. strnlen(name, KSYM_NAME_LEN) is
> called inside ppc_kallsyms_lookup_name(), when the compiler detects that
> KSYM_NAME_LEN is larger then the constant strings,
> the following error will be triggered:
> ```log
> CC arch/powerpc/kernel/optprobes.o
> In file included from ./arch/powerpc/include/asm/kprobes.h:24,
> from ./include/linux/kprobes.h:31,
> from arch/powerpc/kernel/optprobes.c:8:
> In function ‘ppc_kallsyms_lookup_name’,
> inlined from ‘arch_prepare_optimized_kprobe’ at arch/powerpc/kernel/optprobes.c:209:21:
> ./arch/powerpc/include/asm/text-patching.h:232:13: error: ‘strnlen’ specified bound 512 exceeds source size 19 [-Werror=stringop-overread]
> 232 | if (strnlen(name, KSYM_NAME_LEN) >= KSYM_NAME_LEN)
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> In function ‘ppc_kallsyms_lookup_name’,
> inlined from ‘arch_prepare_optimized_kprobe’ at arch/powerpc/kernel/optprobes.c:210:22:
> ./arch/powerpc/include/asm/text-patching.h:232:13: error: ‘strnlen’ specified bound 512 exceeds source size 13 [-Werror=stringop-overread]
> 232 | if (strnlen(name, KSYM_NAME_LEN) >= KSYM_NAME_LEN)
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
> ```
>
> The error can be reproduced in the following ways:
> Use lastest linux-next source, change ppc_kallsyms_lookup_name() to
> __always_inline, use default ppc64_defconfig, set CONFIG_EXPERT=y,
> CONFIG_PPC64_BIG_ENDIAN_ELF_ABI_V2=n, CONFIG_CC_OPTIMIZE_FOR_SIZE=y,
> and use gcc-14 or a later version for compilation.
>
> Since ppc_kallsyms_lookup_name() is called only twice in the kernel,
> and the parameters are all constant strins, simplify the implementation
> of ppc_kallsyms_lookup_name() and avoid calling strnlen().
>
> Cc: Andy Shevchenko <andriy.shevchenko@intel.com>
> Cc: Kees Cook <kees@kernel.org>
> Co-developed-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
> Signed-off-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
> Signed-off-by: Xie Yuanbin <xieyuanbin1@huawei.com>
> ---
> v1->v2: https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.kernel.org%2F20260205100517.292858-2-xieyuanbin1%40huawei.com&data=05%7C02%7Cchristophe.leroy%40csgroup.eu%7C525ecaba66ea4e3b15f208dea68a3fa1%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C639131309913493421%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=aaK9PO2mGdxM3vuJBVP0lcl6VKfqs3VKih5VPcG0IxI%3D&reserved=0
> - Not use strlen()
>
> arch/powerpc/include/asm/text-patching.h | 42 ++++++++----------------
> 1 file changed, 17 insertions(+), 33 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/text-patching.h b/arch/powerpc/include/asm/text-patching.h
> index e7f14720f630..2d3f698cb4f1 100644
> --- a/arch/powerpc/include/asm/text-patching.h
> +++ b/arch/powerpc/include/asm/text-patching.h
> @@ -221,39 +221,23 @@ static inline unsigned long ppc_global_function_entry(void *func)
> * - For ABIv1, we lookup the dot variant.
> * - For ABIv2, we return the local entry point.
> */
> -static inline unsigned long ppc_kallsyms_lookup_name(const char *name)
> -{
> - unsigned long addr;
> -#ifdef CONFIG_PPC64_ELF_ABI_V1
> - /* check for dot variant */
> - char dot_name[1 + KSYM_NAME_LEN];
> - bool dot_appended = false;
> -
> - if (strnlen(name, KSYM_NAME_LEN) >= KSYM_NAME_LEN)
> - return 0;
> -
> - if (name[0] != '.') {
> - dot_name[0] = '.';
> - dot_name[1] = '\0';
> - strlcat(dot_name, name, sizeof(dot_name));
> - dot_appended = true;
> - } else {
> - dot_name[0] = '\0';
> - strlcat(dot_name, name, sizeof(dot_name));
> - }
> - addr = kallsyms_lookup_name(dot_name);
> - if (!addr && dot_appended)
> - /* Let's try the original non-dot symbol lookup */
> - addr = kallsyms_lookup_name(name);
> -#elif defined(CONFIG_PPC64_ELF_ABI_V2)
> - addr = kallsyms_lookup_name(name);
> - if (addr)
> - addr = ppc_function_entry((void *)addr);
> -#else
> - addr = kallsyms_lookup_name(name);
> -#endif
> - return addr;
> -}
> +static inline unsigned long __ppc_kallsyms_lookup_name(const char *name)
> +{
> + unsigned long addr = kallsyms_lookup_name(name);
> +
> + if (IS_ENABLED(CONFIG_PPC64_ELF_ABI_V1) && !addr)
> + addr = kallsyms_lookup_name(name + 1);
> + if (IS_ENABLED(CONFIG_PPC64_ELF_ABI_V2) && addr)
> + addr = ppc_function_entry((void *)addr);
> +
> + return addr;
> +}
> +
> +#ifdef CONFIG_PPC64_ELF_ABI_V1
> +#define ppc_kallsyms_lookup_name(x) __ppc_kallsyms_lookup_name("." x)
> +#else
> +#define ppc_kallsyms_lookup_name(x) __ppc_kallsyms_lookup_name(x)
> +#endif
>
> /*
> * Some instruction encodings commonly used in dynamic ftracing
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2026-04-30 9:41 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-05 10:05 [PATCH 1/2] string: move __compiletime_strlen() to string.h Xie Yuanbin
2026-02-05 10:05 ` [PATCH 2/2] powerpc/text-patching: Fix possible stringop-overread compilation error Xie Yuanbin
2026-02-05 16:40 ` Andy Shevchenko
2026-02-06 11:14 ` Xie Yuanbin
2026-02-06 18:26 ` Kees Cook
2026-02-06 19:53 ` Christophe Leroy (CS GROUP)
2026-02-09 13:25 ` Xie Yuanbin
2026-02-09 13:41 ` Christophe Leroy (CS GROUP)
2026-02-09 14:11 ` Xie Yuanbin
2026-04-30 7:28 ` Xie Yuanbin
2026-04-30 9:41 ` Christophe Leroy (CS GROUP)
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.