From: Brian Gerst <brgerst@gmail.com>
To: linux-kernel@vger.kernel.org, x86@kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>,
Andy Lutomirski <luto@kernel.org>, Borislav Petkov <bp@alien8.de>,
"H . Peter Anvin" <hpa@zytor.com>,
Peter Zijlstra <peterz@infradead.org>,
"Eric W . Biederman" <ebiederm@xmission.com>,
Brian Gerst <brgerst@gmail.com>
Subject: [PATCH 6/8] x86/signal: Add ABI prefixes to frame setup functions
Date: Mon, 6 Jun 2022 16:38:00 -0400 [thread overview]
Message-ID: <20220606203802.158958-7-brgerst@gmail.com> (raw)
In-Reply-To: <20220606203802.158958-1-brgerst@gmail.com>
Add ABI prefixes to the frame setup functions that didn't already have
them. To avoid compiler warnings and prepare for moving these functions
to separate files, make them non-static.
Signed-off-by: Brian Gerst <brgerst@gmail.com>
---
arch/x86/include/asm/fpu/signal.h | 5 -----
arch/x86/include/asm/sighandling.h | 5 +++++
arch/x86/kernel/signal.c | 18 +++++++-----------
3 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/arch/x86/include/asm/fpu/signal.h b/arch/x86/include/asm/fpu/signal.h
index 2f255aca5622..611fa41711af 100644
--- a/arch/x86/include/asm/fpu/signal.h
+++ b/arch/x86/include/asm/fpu/signal.h
@@ -13,14 +13,9 @@
#ifdef CONFIG_X86_64
# include <uapi/asm/sigcontext.h>
# include <asm/user32.h>
-struct ksignal;
-int ia32_setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs);
-int ia32_setup_frame(struct ksignal *ksig, struct pt_regs *regs);
#else
# define user_i387_ia32_struct user_i387_struct
# define user32_fxsr_struct user_fxsr_struct
-# define ia32_setup_frame __setup_frame
-# define ia32_setup_rt_frame __setup_rt_frame
#endif
extern void convert_from_fxsr(struct user_i387_ia32_struct *env,
diff --git a/arch/x86/include/asm/sighandling.h b/arch/x86/include/asm/sighandling.h
index c9e9784efe38..e770c4fc47f4 100644
--- a/arch/x86/include/asm/sighandling.h
+++ b/arch/x86/include/asm/sighandling.h
@@ -19,4 +19,9 @@ void __user *
get_sigframe(struct ksignal *ksig, struct pt_regs *regs, size_t frame_size,
void __user **fpstate);
+int ia32_setup_frame(struct ksignal *ksig, struct pt_regs *regs);
+int ia32_setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs);
+int x64_setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs);
+int x32_setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs);
+
#endif /* _ASM_X86_SIGHANDLING_H */
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
index 890ca0523570..0511e050d24a 100644
--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
@@ -336,8 +336,7 @@ static const struct {
0
};
-static int
-__setup_frame(struct ksignal *ksig, struct pt_regs *regs)
+int ia32_setup_frame(struct ksignal *ksig, struct pt_regs *regs)
{
sigset_t *set = sigmask_to_save();
struct sigframe __user *frame;
@@ -392,7 +391,7 @@ __setup_frame(struct ksignal *ksig, struct pt_regs *regs)
return -EFAULT;
}
-static int __setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs)
+int ia32_setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs)
{
sigset_t *set = sigmask_to_save();
struct rt_sigframe __user *frame;
@@ -471,7 +470,7 @@ static unsigned long frame_uc_flags(struct pt_regs *regs)
return flags;
}
-static int __setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs)
+int x64_setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs)
{
sigset_t *set = sigmask_to_save();
struct rt_sigframe __user *frame;
@@ -571,11 +570,9 @@ int copy_siginfo_to_user32(struct compat_siginfo __user *to,
return x32_copy_siginfo_to_user(to, from);
return __copy_siginfo_to_user32(to, from);
}
-#endif /* CONFIG_X86_X32_ABI */
-static int x32_setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs)
+int x32_setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs)
{
-#ifdef CONFIG_X86_X32_ABI
compat_sigset_t *set = (compat_sigset_t *) sigmask_to_save();
struct rt_sigframe_x32 __user *frame;
unsigned long uc_flags;
@@ -622,15 +619,14 @@ static int x32_setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs)
regs->cs = __USER_CS;
regs->ss = __USER_DS;
-#endif /* CONFIG_X86_X32_ABI */
return 0;
-#ifdef CONFIG_X86_X32_ABI
+
Efault:
user_access_end();
return -EFAULT;
-#endif
}
+#endif /* CONFIG_X86_X32_ABI */
/*
* Do a signal return; undo the signal stack.
@@ -770,7 +766,7 @@ setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs)
} else if (is_x32_frame(ksig)) {
return x32_setup_rt_frame(ksig, regs);
} else {
- return __setup_rt_frame(ksig, regs);
+ return x64_setup_rt_frame(ksig, regs);
}
}
--
2.35.3
next prev parent reply other threads:[~2022-06-06 20:43 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-06 20:37 [PATCH 0/8] x86 signal code cleanups Brian Gerst
2022-06-06 20:37 ` [PATCH 1/8] x86/signal: Remove sig parameter from frame setup functions Brian Gerst
2022-10-19 8:55 ` [tip: x86/misc] " tip-bot2 for Brian Gerst
2022-06-06 20:37 ` [PATCH 2/8] x86/signal: Remove sigset_t " Brian Gerst
2022-10-19 8:55 ` [tip: x86/misc] " tip-bot2 for Brian Gerst
2022-06-06 20:37 ` [PATCH 3/8] signal/compat: Remove compat_sigset_t override Brian Gerst
2022-10-19 8:55 ` [tip: x86/misc] " tip-bot2 for Brian Gerst
2022-06-06 20:37 ` [PATCH 4/8] x86: Remove __USER32_DS Brian Gerst
2022-10-19 8:55 ` [tip: x86/misc] " tip-bot2 for Brian Gerst
2022-06-06 20:37 ` [PATCH 5/8] x86/signal: Merge get_sigframe() Brian Gerst
2022-10-19 8:55 ` [tip: x86/misc] " tip-bot2 for Brian Gerst
2022-06-06 20:38 ` Brian Gerst [this message]
2022-10-19 8:55 ` [tip: x86/misc] x86/signal: Add ABI prefixes to frame setup functions tip-bot2 for Brian Gerst
2022-06-06 20:38 ` [PATCH 7/8] x86/signal/32: Merge native and compat 32-bit signal code Brian Gerst
2022-10-19 8:55 ` [tip: x86/misc] " tip-bot2 for Brian Gerst
2022-06-06 20:38 ` [PATCH 8/8] x86/signal/64: Move 64-bit signal code to its own file Brian Gerst
2022-10-19 8:55 ` [tip: x86/misc] " tip-bot2 for Brian Gerst
2022-06-06 22:17 ` [PATCH 0/8] x86 signal code cleanups Eric W. Biederman
2022-06-28 23:22 ` Andy Lutomirski
2022-06-29 15:21 ` Brian Gerst
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220606203802.158958-7-brgerst@gmail.com \
--to=brgerst@gmail.com \
--cc=bp@alien8.de \
--cc=ebiederm@xmission.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).