Skip to contentSkip to conversation

arm64: Ensure the instruction emulation is ready for userspace

PATCH In review Suzuki K Poulose 2 participants 3 messages Oct 6, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 arm64: Ensure the instruction emulation is ready for userspace

We trap and emulate some instructions (e.g, mrs, deprecated instructions) for the userspace. However the handlers for these are registered as late_initcalls and the userspace could be up and running from the initramfs by that time (with populate_rootfs, which is a rootfs_initcall()). This could cause problems for the early applications ending up in failure like :

[   11.152061] modprobe[93]: undefined instruction: pc=0000ffff8ca48ff4

This patch promotes the specific calls to core_initcalls, which are guaranteed to be completed before we hit userspace.

Cc stable at vger.kernel.org
Cc Catalin Marinas <[email protected]>
Cc Dave Martin <[email protected]>
Cc Matthias Brugger <[email protected]>
Cc James Morse <[email protected]>
---
 arch/arm64/kernel/armv8_deprecated.c | 2 +-
 arch/arm64/kernel/cpufeature.c       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm64/kernel/armv8_deprecated.c +1 -1
index f0e6d717885b..d06fbe4cd38d 100644
@@ -649,4 +649,4 @@ static int __init armv8_deprecated_init(void)
 	return 0;
 }
 
-late_initcall(armv8_deprecated_init);
+core_initcall(armv8_deprecated_init);
arch/arm64/kernel/cpufeature.c +1 -1
index cd52d365d1f0..21e2c95d24e7 100644
@@ -1307,4 +1307,4 @@ static int __init enable_mrs_emulation(void)
 	return 0;
 }
 
-late_initcall(enable_mrs_emulation);
+core_initcall(enable_mrs_emulation);
Signature · 1 line
2.13.6
#1 lore raw

PATCH 2/2 arm64: Ensure fpsimd support is ready before userspace is active

We register the pm/hotplug callbacks for FPSIMD as late_initcall, which happens after the userspace is active (from initramfs via populate_rootfs, a rootfs_initcall). Make sure we are ready even before the userspace could potentially use it, by promoting to a core_initcall.

Cc Catalin Marinas <[email protected]>
Cc Will Deacon <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Dave Martin <[email protected]>
---
 arch/arm64/kernel/fpsimd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/fpsimd.c +1 -1
index f444f374bd7b..5d547deb6996 100644
@@ -444,4 +444,4 @@ static int __init fpsimd_init(void)
 
 	return 0;
 }
-late_initcall(fpsimd_init);
+core_initcall(fpsimd_init);
Signature · 1 line
2.13.6
maintainer
#2 lore raw
In reply to Suzuki K Poulose
Quoted 12 lines · Suzuki K. Poulose

We trap and emulate some instructions (e.g, mrs, deprecated instructions) for the userspace. However the handlers for these are registered as late_initcalls and the userspace could be up and running from the initramfs by that time (with populate_rootfs, which is a rootfs_initcall()). This could cause problems for the early applications ending up in failure like :

[   11.152061] modprobe[93]: undefined instruction: pc=0000ffff8ca48ff4

This patch promotes the specific calls to core_initcalls, which are guaranteed to be completed before we hit userspace.

Quoted 7 lines
Cc stable at vger.kernel.org
Cc Catalin Marinas <[email protected]>
Cc Dave Martin <[email protected]>
Cc Matthias Brugger <[email protected]>
Cc James Morse <[email protected]>

Both patches queued for 4.14. Thanks.

Signature · 1 line
Catalin