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

From: Daniel Bristot de Oliveira
Date: Thu Jun 03 2021 - 05:45:18 EST


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 <qperret@xxxxxxxxxx>
> Signed-off-by: Will Deacon <will@xxxxxxxxxx>
> ---

[...]

>
> +#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 <bristot@xxxxxxxxxx>

Thanks!
-- Daniel