[PATCH 03/24] ARM64: Change some CONFIG_COMPAT over to use CONFIG_AARCH32_EL0 instead.

Catalin Marinas catalin.marinas at arm.com
Tue Jun 17 08:15:28 PDT 2014


On Sat, May 24, 2014 at 12:01:58AM -0700, Andrew Pinski wrote:
> This patch changes CONFIG_COMPAT checks inside the arm64 which are AARCH32 specific.

Please state what it is changed to. I guess CONFIG_AARCH32_EL0. Longer
commit log is always better.

> --- a/arch/arm64/include/asm/signal32.h
> +++ b/arch/arm64/include/asm/signal32.h
> @@ -20,6 +20,7 @@
>  #ifdef CONFIG_COMPAT
>  #include <linux/compat.h>
>  
> +#ifdef CONFIG_AARCH32_EL0
>  #define AARCH32_KERN_SIGRET_CODE_OFFSET	0x500

Do we still need the top CONFIG_COMPAT for signal32.h? We don't use the
signal32 infrastructure for ILP32.

> diff --git a/arch/arm64/include/asm/stat.h b/arch/arm64/include/asm/stat.h
> index 15e3559..af04276 100644
> --- a/arch/arm64/include/asm/stat.h
> +++ b/arch/arm64/include/asm/stat.h
> @@ -22,6 +22,7 @@
>  
>  #include <asm/compat.h>
>  
> +#ifdef CONFIG_AARCH32_EL0

Same here, we have another #ifdef CONFIG_COMPAT above the #include.

> --- a/arch/arm64/kernel/ptrace.c
> +++ b/arch/arm64/kernel/ptrace.c

[...]

> @@ -1041,11 +1041,28 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
>  
>  	return ret;
>  }
> -#endif /* CONFIG_COMPAT */
> +#else /* !CONFIG_AARCH32_EL0 */
> +long compat_a32_arch_ptrace(struct task_struct *child, compat_long_t request,
> +			    compat_ulong_t caddr, compat_ulong_t cdata)
> +{
> +	return -1;
> +}
> +#endif /* !CONFIG_AARCH32_EL0 */

Can you return an appropriate error code here?

> +
> +#ifdef CONFIG_COMPAT
> +long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
> +			compat_ulong_t caddr, compat_ulong_t cdata)
> +{
> +	if (is_compat_task())
> +		return compat_a32_arch_ptrace(child, request, caddr, cdata);
> +	return compat_ptrace_request(child, request, caddr, cdata);
> +}
> +#endif

So for ILP32, will we route ptrace calls via compat_arch_ptrace? Some
explanation for this code would help as it doesn't look like a simple
CONFIG_COMPAT conversion.

> --- a/arch/arm64/kernel/signal.c
> +++ b/arch/arm64/kernel/signal.c
> @@ -417,3 +417,16 @@ asmlinkage void do_notify_resume(struct pt_regs *regs,
>  		tracehook_notify_resume(regs);
>  	}
>  }
> +
> +/* Some functions are needed for compat ptrace but we don't define
> +   them if we don't have AARCH32 support compiled in */

As per the kernel coding style, the multi-line comment should be:

/*
 * Some functions are needed for compat ptrace but we don't define
 * them if we don't have AARCH32 support compiled in.
 */

> +#if defined CONFIG_COMPAT && !defined CONFIG_AARCH32_EL0
> +int copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from)
> +{
> +	return -EFAULT;
> +}
> +int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from)
> +{
> +	return -EFAULT;
> +}
> +#endif

Maybe it gets clearer in subsequent patches on how this interacts with
ptrace. But at this stage in the series, COMPAT cannot be defined
without CONFIG_AARCH32_EL0, so the above could be removed.

-- 
Catalin



More information about the linux-arm-kernel mailing list