Re: [PATCH 05/30] selftests/rseq: Use ELF auxiliary vector for extensible rseq

From: Florian Weimer
Date: Wed Jan 04 2023 - 14:20:37 EST


* Mathieu Desnoyers:

> +static
> +unsigned int get_rseq_feature_size(void)
> +{
> + unsigned long auxv_rseq_feature_size, auxv_rseq_align;
> +
> + auxv_rseq_align = getauxval(AT_RSEQ_ALIGN);
> + assert(!auxv_rseq_align || auxv_rseq_align <= RSEQ_THREAD_AREA_ALLOC_SIZE);
> +
> + auxv_rseq_feature_size = getauxval(AT_RSEQ_FEATURE_SIZE);
> + assert(!auxv_rseq_feature_size || auxv_rseq_feature_size <= RSEQ_THREAD_AREA_ALLOC_SIZE);
> + if (auxv_rseq_feature_size)
> + return auxv_rseq_feature_size;
> + else
> + return ORIG_RSEQ_FEATURE_SIZE;
> +}

Do you intend to use the auxiliary vector as the userspace handshake
for glibc-managed rseq, too? I don't think it works if the kernel
overtakes glibc. Or is there some other approach shown in the series
that I missed?

Maybe we should just skip the existing padding and use it only for
some vaguely kernel-internal purpose (say through a vDSO helper), so
that it is less of an issue how to communicate the presence of these
fields to userspace.