# Re: \[PATCH v8 14/19\] arm64: exec: Adjust affinity for compat tasks with mismatched 32-bit EL0

- From: Daniel Bristot de Oliveira \<hidden\>
- Date: 2021-06-03 09:45:18 
- List: linux-arch
- Page: https://ratatoskr.run/linux-arch/2021/06/1400941
- Thread: https://ratatoskr.run/linux-arm-kernel/2021/06/1400201/t.md

```text
On 6/2/21 6:47 PM, Will Deacon wrote:
> When exec'ing a 32-bit task on a system with mismatched support for
> 32-bit EL0, try to ensure that it starts life on a CPU that can actually
> run it.
> 
> Similarly, when exec'ing a 64-bit task on such a system, try to restore
> the old affinity mask if it was previously restricted.
> 
> Reviewed-by: Quentin Perret <redacted>
> Signed-off-by: Will Deacon <will@kernel.org>
> ---

[...]

>  
> +#ifdef CONFIG_COMPAT
> +int compat_elf_check_arch(const struct elf32_hdr *hdr)
> +{
> +	if (!system_supports_32bit_el0())
> +		return false;
> +
> +	if ((hdr)->e_machine != EM_ARM)
> +		return false;
> +
> +	if (!((hdr)->e_flags & EF_ARM_EABI_MASK))
> +		return false;
> +
> +	/*
> +	 * Prevent execve() of a 32-bit program from a deadline task
> +	 * if the restricted affinity mask would be inadmissible on an
> +	 * asymmetric system.
> +	 */
> +	return !static_branch_unlikely(&arm64_mismatched_32bit_el0) ||
> +	       task_cpus_dl_admissible(current, system_32bit_el0_cpumask());
> +}
> +#endif

From the DL perspective:

Reviewed-by: Daniel Bristot de Oliveira <redacted>

Thanks!
-- Daniel

```
