[PATCH v4 09/20] powerpc: Enable compile-time check for syscall handlers

Michael Ellerman mpe at ellerman.id.au
Tue Sep 13 12:29:38 AEST 2022


"Nicholas Piggin" <npiggin at gmail.com> writes:
> On Wed Aug 24, 2022 at 12:05 PM AEST, Rohan McLure wrote:
...
>> diff --git a/arch/powerpc/kernel/systbl.S b/arch/powerpc/kernel/systbl.c
>> similarity index 59%
>> rename from arch/powerpc/kernel/systbl.S
>> rename to arch/powerpc/kernel/systbl.c
>> index cb3358886203..99ffdfef6b9c 100644
>> --- a/arch/powerpc/kernel/systbl.S
>> +++ b/arch/powerpc/kernel/systbl.c
>> @@ -10,31 +10,32 @@
>>   * PPC64 updates by Dave Engebretsen (engebret at us.ibm.com) 
>>   */
>>  
>> -#include <asm/ppc_asm.h>
>> +#include <linux/syscalls.h>
>> +#include <linux/compat.h>
>> +#include <asm/unistd.h>
>> +#include <asm/syscalls.h>
>>  
>> -.section .rodata,"a"
>> +#define __SYSCALL_WITH_COMPAT(nr, entry, compat) __SYSCALL(nr, entry)
>>  
>> -#ifdef CONFIG_PPC64
>> -	.p2align	3
>> -#define __SYSCALL(nr, entry)	.8byte entry
>> +#ifdef CONFIG_ARCH_HAS_SYSCALL_WRAPPER
>> +#define __SYSCALL(nr, entry) [nr] = __powerpc_##entry,
>> +#define __powerpc_sys_ni_syscall	sys_ni_syscall
>>  #else
>> -#define __SYSCALL(nr, entry)	.long entry
>> +#define __SYSCALL(nr, entry) [nr] = entry,
>>  #endif
>>  
>> -#define __SYSCALL_WITH_COMPAT(nr, native, compat)	__SYSCALL(nr, native)
>> -.globl sys_call_table
>> -sys_call_table:
>> +void *sys_call_table[] = {
>
> Humour me, the asm version had this in rodata, does this change that or
> does it somehow get put back in there? Should this be const?

Even with const I still see it not landing in rodata for some reason.

$ grep -e start_rodata -e end_rodata -e sys_call_table .build/System.map
c000000000f90000 D __start_rodata
c0000000012b0000 R __end_rodata
c0000000027d51b0 D sys_call_table

vs before the series:

c000000000f80000 D __start_rodata
c000000000f805f0 D sys_call_table
c0000000012a0000 R __end_rodata


cheers


More information about the Linuxppc-dev mailing list