FROMLIST: [PATCH 4/6] arm64: compat: Add a 32-bit vDSO
authorKevin Brodsky <kevin.brodsky@arm.com>
Wed, 11 May 2016 10:42:22 +0000 (11:42 +0100)
committerBruno Martins <bgcngm@gmail.com>
Fri, 20 Oct 2023 17:09:54 +0000 (18:09 +0100)
commit06ba01a8b5fef4f0159361a546f1308c4664c5cd
tree44f6f71e1a9868ee39efc42397591e57aa88cc11
parent62a2f00d140b300a2608fe7322f087c4268c45ec
FROMLIST: [PATCH 4/6] arm64: compat: Add a 32-bit vDSO

(cherry pick from url https://patchwork.kernel.org/patch/10060445/)

Provide the files necessary for building a compat (AArch32) vDSO in
kernel/vdso32.

This is mostly an adaptation of the arm vDSO. The most significant
change in vgettimeofday.c is the use of the arm64 vdso_data struct,
allowing the vDSO data page to be shared between the 32 and 64-bit
vDSOs. Additionally, a different set of barrier macros is used (see
aarch32-barrier.h), as we want to support old 32-bit compilers that
may not support ARMv8 and its new barrier arguments (*ld).

In addition to the time functions, sigreturn trampolines are also
provided, aiming at replacing those in the sigreturn page as the
latter don't provide any unwinding information (and it's easier to
have just one "user code" page). arm-specific unwinding directives are
used, based on glibc's implementation. Symbol offsets are made
available to the kernel using the same method as the 64-bit vDSO.

There is unfortunately an important caveat: we cannot get away with
hand-coding 32-bit instructions like in kernel/kuser32.S, this time we
really need a 32-bit compiler. The compat vDSO Makefile relies on
CROSS_COMPILE_ARM32 to provide a 32-bit compiler, appropriate logic
will be added to the arm64 Makefile later on to ensure that an attempt
to build the compat vDSO is made only if this variable has been set
properly.

Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
Take an effort to recode the arm64 vdso code from assembler to C
previously submitted by Andrew Pinski <apinski@cavium.com>, rework
it for use in both arm and arm64, overlapping any optimizations
for each architecture.

Signed-off-by: Mark Salyzyn <salyzyn@android.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Dave Martin <Dave.Martin@arm.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Bug: 63737556
Bug: 20045882
Change-Id: I3fb9d21b29bd9fec1408f2274d090e6def546b0d
arch/arm64/kernel/vdso32/.gitignore [new file with mode: 0644]
arch/arm64/kernel/vdso32/Makefile [new file with mode: 0644]
arch/arm64/kernel/vdso32/compiler.h [new file with mode: 0644]
arch/arm64/kernel/vdso32/datapage.h [new file with mode: 0644]
arch/arm64/kernel/vdso32/sigreturn.S [new file with mode: 0644]
arch/arm64/kernel/vdso32/vdso.S [new file with mode: 0644]
arch/arm64/kernel/vdso32/vdso.lds.S [new file with mode: 0644]
arch/arm64/kernel/vdso32/vgettimeofday.c [new file with mode: 0644]