Re: [PATCH v10 2/7] x86/arch_prctl/64: Rename do_arch_prctl to do_arch_prctl_64

From: Borislav Petkov
Date: Wed Nov 09 2016 - 04:59:42 EST


On Tue, Nov 08, 2016 at 10:39:51AM -0800, Kyle Huey wrote:
> In order to introduce new arch_prctls that are not 64 bit only, rename the
> existing 64 bit implementation to do_arch_prctl_64. Also rename the second

do_arch_prctl_64()

> argument to arch_prctl, which will no longer always be an address.

arch_prctl()

so that we know they're functions.

> Signed-off-by: Kyle Huey <khuey@xxxxxxxxxxxx>
> Reviewed-by: Andy Lutomirski <luto@xxxxxxxxxx>
> ---
> arch/x86/include/asm/proto.h | 4 +++-
> arch/x86/kernel/process_64.c | 32 +++++++++++++++++---------------
> arch/x86/kernel/ptrace.c | 8 ++++----
> arch/x86/um/syscalls_64.c | 4 ++--
> 4 files changed, 26 insertions(+), 22 deletions(-)
>
> diff --git a/arch/x86/include/asm/proto.h b/arch/x86/include/asm/proto.h
> index 9b9b30b..95c3e51 100644
> --- a/arch/x86/include/asm/proto.h
> +++ b/arch/x86/include/asm/proto.h
> @@ -25,11 +25,13 @@ void entry_SYSCALL_compat(void);
> void entry_INT80_compat(void);
> #endif
>
> void x86_configure_nx(void);
> void x86_report_nx(void);
>
> extern int reboot_force;
>
> -long do_arch_prctl(struct task_struct *task, int code, unsigned long addr);
> +#ifdef CONFIG_X86_64
> +long do_arch_prctl_64(struct task_struct *task, int code, unsigned long arg2);
> +#endif

There's already an #ifdef CONFIG_X86_64 in that file, please move this
one there too.

...

> @@ -863,17 +863,17 @@ long arch_ptrace(struct task_struct *child, long request,
> break;
> #endif
>
> #ifdef CONFIG_X86_64
> /* normal 64bit interface to access TLS data.
> Works just like arch_prctl, except that the arguments
> are reversed. */
> case PTRACE_ARCH_PRCTL:
> - ret = do_arch_prctl(child, data, addr);
> + ret = do_arch_prctl_64(child, data, addr);
> break;
> #endif
>
> default:
> ret = ptrace_request(child, request, addr, data);
> break;
> }
>
> diff --git a/arch/x86/um/syscalls_64.c b/arch/x86/um/syscalls_64.c
> index ab3f7f4..3362c4e 100644
> --- a/arch/x86/um/syscalls_64.c
> +++ b/arch/x86/um/syscalls_64.c
> @@ -68,19 +68,19 @@ long arch_prctl(struct task_struct *task, int code, unsigned long __user *addr)
^^^^^
You missed one here.

Actually I see a couple:

$ git grep -E arch_prctl.*addr
arch/um/include/shared/os.h:306:extern int os_arch_prctl(int pid, int code, unsigned long *addr);
arch/x86/kernel/ptrace.c:871: ret = do_arch_prctl_64(child, data, addr);
arch/x86/um/os-Linux/prctl.c:9:int os_arch_prctl(int pid, int code, unsigned long *addr)
arch/x86/um/ptrace_64.c:272: ret = arch_prctl(child, data, (void __user *) addr);
arch/x86/um/syscalls_64.c:14:long arch_prctl(struct task_struct *task, int code, unsigned long __user *addr)

--
Regards/Gruss,
Boris.

SUSE Linux GmbH, GF: Felix ImendÃrffer, Jane Smithard, Graham Norton, HRB 21284 (AG NÃrnberg)
--