[patch 14/17] x86/init: Initialize signal frame size late

From: Thomas Gleixner
Date: Tue Jun 13 2023 - 19:41:18 EST


No point in doing this during really early boot. Move it to an early
initcall so that it is set up before possible user mode helpers are started
during device initialization.

Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
---
arch/x86/include/asm/sigframe.h | 2 --
arch/x86/kernel/cpu/common.c | 3 ---
arch/x86/kernel/signal.c | 4 +++-
3 files changed, 3 insertions(+), 6 deletions(-)

--- a/arch/x86/include/asm/sigframe.h
+++ b/arch/x86/include/asm/sigframe.h
@@ -85,6 +85,4 @@ struct rt_sigframe_x32 {

#endif /* CONFIG_X86_64 */

-void __init init_sigframe_size(void);
-
#endif /* _ASM_X86_SIGFRAME_H */
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -64,7 +64,6 @@
#include <asm/cpu_device_id.h>
#include <asm/uv/uv.h>
#include <asm/set_memory.h>
-#include <asm/sigframe.h>
#include <asm/traps.h>
#include <asm/sev.h>

@@ -1607,8 +1606,6 @@ static void __init early_identify_cpu(st

fpu__init_system(c);

- init_sigframe_size();
-
#ifdef CONFIG_X86_32
/*
* Regardless of whether PCID is enumerated, the SDM says
--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
@@ -182,7 +182,7 @@ get_sigframe(struct ksignal *ksig, struc
static unsigned long __ro_after_init max_frame_size;
static unsigned int __ro_after_init fpu_default_state_size;

-void __init init_sigframe_size(void)
+static int __init init_sigframe_size(void)
{
fpu_default_state_size = fpu__get_fpstate_size();

@@ -194,7 +194,9 @@ void __init init_sigframe_size(void)
max_frame_size = round_up(max_frame_size, FRAME_ALIGNMENT);

pr_info("max sigframe size: %lu\n", max_frame_size);
+ return 0;
}
+early_initcall(init_sigframe_size);

unsigned long get_sigframe_size(void)
{