Re: [PATCH v4 05/20] powerpc: Remove direct call to personality syscall handler

2022-09-12 Thread Nicholas Piggin
On Wed Aug 24, 2022 at 12:05 PM AEST, Rohan McLure wrote:
> Syscall handlers should not be invoked internally by their symbol names,
> as these symbols defined by the architecture-defined SYSCALL_DEFINE
> macro. Fortunately, in the case of ppc64_personality, its call to
> sys_personality can be replaced with an invocation to the
> equivalent ksys_personality inline helper in .

Huh. I wonder why sys_personality doesn't just call ksys_personality
too. Anyway this looks good.

Reviewed-by: Nicholas Piggin 

Several of your steps like this one look like they apply to other archs
as well. You might consider ccing linux-arch for some of these.

>
> Signed-off-by: Rohan McLure 
> ---
> V1 -> V2: Use inline helper to deduplicate bodies in compat/regular
> implementations.
> V3 -> V4: Move to be applied before syscall wrapper.
> ---
>  arch/powerpc/kernel/syscalls.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/kernel/syscalls.c b/arch/powerpc/kernel/syscalls.c
> index 9f29e451e2de..b8461128c8f7 100644
> --- a/arch/powerpc/kernel/syscalls.c
> +++ b/arch/powerpc/kernel/syscalls.c
> @@ -71,7 +71,7 @@ static inline long do_ppc64_personality(unsigned long 
> personality)
>   if (personality(current->personality) == PER_LINUX32
>   && personality(personality) == PER_LINUX)
>   personality = (personality & ~PER_MASK) | PER_LINUX32;
> - ret = sys_personality(personality);
> + ret = ksys_personality(personality);
>   if (personality(ret) == PER_LINUX32)
>   ret = (ret & ~PER_MASK) | PER_LINUX;
>   return ret;
> -- 
> 2.34.1



[PATCH v4 05/20] powerpc: Remove direct call to personality syscall handler

2022-08-23 Thread Rohan McLure
Syscall handlers should not be invoked internally by their symbol names,
as these symbols defined by the architecture-defined SYSCALL_DEFINE
macro. Fortunately, in the case of ppc64_personality, its call to
sys_personality can be replaced with an invocation to the
equivalent ksys_personality inline helper in .

Signed-off-by: Rohan McLure 
---
V1 -> V2: Use inline helper to deduplicate bodies in compat/regular
implementations.
V3 -> V4: Move to be applied before syscall wrapper.
---
 arch/powerpc/kernel/syscalls.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/syscalls.c b/arch/powerpc/kernel/syscalls.c
index 9f29e451e2de..b8461128c8f7 100644
--- a/arch/powerpc/kernel/syscalls.c
+++ b/arch/powerpc/kernel/syscalls.c
@@ -71,7 +71,7 @@ static inline long do_ppc64_personality(unsigned long 
personality)
if (personality(current->personality) == PER_LINUX32
&& personality(personality) == PER_LINUX)
personality = (personality & ~PER_MASK) | PER_LINUX32;
-   ret = sys_personality(personality);
+   ret = ksys_personality(personality);
if (personality(ret) == PER_LINUX32)
ret = (ret & ~PER_MASK) | PER_LINUX;
return ret;
-- 
2.34.1