lkml.org 
[lkml]   [2022]   [Jun]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/8] x86/signal: Remove sigset_t parameter from frame setup functions
Date
Push down the call to sigmask_to_save() into the frame setup functions.
This removes the use of compat_sigset_t outside of the compat code.

Signed-off-by: Brian Gerst <brgerst@gmail.com>
---
arch/x86/ia32/ia32_signal.c | 8 ++++----
arch/x86/include/asm/fpu/signal.h | 6 ++----
arch/x86/include/asm/signal.h | 5 -----
arch/x86/kernel/signal.c | 28 ++++++++++++----------------
4 files changed, 18 insertions(+), 29 deletions(-)

diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index 390347ab92de..b67e27685d46 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
@@ -230,9 +230,9 @@ static void __user *get_sigframe(struct ksignal *ksig, struct pt_regs *regs,
return (void __user *) sp;
}

-int ia32_setup_frame(struct ksignal *ksig,
- compat_sigset_t *set, struct pt_regs *regs)
+int ia32_setup_frame(struct ksignal *ksig, struct pt_regs *regs)
{
+ compat_sigset_t *set = (compat_sigset_t *) sigmask_to_save();
struct sigframe_ia32 __user *frame;
void __user *restorer;
void __user *fp = NULL;
@@ -296,9 +296,9 @@ int ia32_setup_frame(struct ksignal *ksig,
return -EFAULT;
}

-int ia32_setup_rt_frame(struct ksignal *ksig,
- compat_sigset_t *set, struct pt_regs *regs)
+int ia32_setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs)
{
+ compat_sigset_t *set = (compat_sigset_t *) sigmask_to_save();
struct rt_sigframe_ia32 __user *frame;
void __user *restorer;
void __user *fp = NULL;
diff --git a/arch/x86/include/asm/fpu/signal.h b/arch/x86/include/asm/fpu/signal.h
index 08826ad0254d..2f255aca5622 100644
--- a/arch/x86/include/asm/fpu/signal.h
+++ b/arch/x86/include/asm/fpu/signal.h
@@ -14,10 +14,8 @@
# include <uapi/asm/sigcontext.h>
# include <asm/user32.h>
struct ksignal;
-int ia32_setup_rt_frame(struct ksignal *ksig,
- compat_sigset_t *set, struct pt_regs *regs);
-int ia32_setup_frame(struct ksignal *ksig,
- compat_sigset_t *set, struct pt_regs *regs);
+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
diff --git a/arch/x86/include/asm/signal.h b/arch/x86/include/asm/signal.h
index 2dfb5fea13af..4a4043ca6493 100644
--- a/arch/x86/include/asm/signal.h
+++ b/arch/x86/include/asm/signal.h
@@ -28,11 +28,6 @@ typedef struct {
#define SA_IA32_ABI 0x02000000u
#define SA_X32_ABI 0x01000000u

-#ifndef CONFIG_COMPAT
-#define compat_sigset_t compat_sigset_t
-typedef sigset_t compat_sigset_t;
-#endif
-
#endif /* __ASSEMBLY__ */
#include <uapi/asm/signal.h>
#ifndef __ASSEMBLY__
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
index 40b1373bb70b..489a0859afd2 100644
--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
@@ -324,9 +324,9 @@ static const struct {
};

static int
-__setup_frame(struct ksignal *ksig, sigset_t *set,
- struct pt_regs *regs)
+__setup_frame(struct ksignal *ksig, struct pt_regs *regs)
{
+ sigset_t *set = sigmask_to_save();
struct sigframe __user *frame;
void __user *restorer;
void __user *fp = NULL;
@@ -379,9 +379,9 @@ __setup_frame(struct ksignal *ksig, sigset_t *set,
return -EFAULT;
}

-static int __setup_rt_frame(struct ksignal *ksig,
- sigset_t *set, struct pt_regs *regs)
+static int __setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs)
{
+ sigset_t *set = sigmask_to_save();
struct rt_sigframe __user *frame;
void __user *restorer;
void __user *fp = NULL;
@@ -458,9 +458,9 @@ static unsigned long frame_uc_flags(struct pt_regs *regs)
return flags;
}

-static int __setup_rt_frame(struct ksignal *ksig,
- sigset_t *set, struct pt_regs *regs)
+static int __setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs)
{
+ sigset_t *set = sigmask_to_save();
struct rt_sigframe __user *frame;
void __user *fp = NULL;
unsigned long uc_flags;
@@ -560,11 +560,10 @@ int copy_siginfo_to_user32(struct compat_siginfo __user *to,
}
#endif /* CONFIG_X86_X32_ABI */

-static int x32_setup_rt_frame(struct ksignal *ksig,
- compat_sigset_t *set,
- struct pt_regs *regs)
+static 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;
void __user *restorer;
@@ -763,22 +762,19 @@ static inline int is_x32_frame(struct ksignal *ksig)
static int
setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs)
{
- sigset_t *set = sigmask_to_save();
- compat_sigset_t *cset = (compat_sigset_t *) set;
-
/* Perform fixup for the pre-signal frame. */
rseq_signal_deliver(ksig, regs);

/* Set up the stack frame */
if (is_ia32_frame(ksig)) {
if (ksig->ka.sa.sa_flags & SA_SIGINFO)
- return ia32_setup_rt_frame(ksig, cset, regs);
+ return ia32_setup_rt_frame(ksig, regs);
else
- return ia32_setup_frame(ksig, cset, regs);
+ return ia32_setup_frame(ksig, regs);
} else if (is_x32_frame(ksig)) {
- return x32_setup_rt_frame(ksig, cset, regs);
+ return x32_setup_rt_frame(ksig, regs);
} else {
- return __setup_rt_frame(ksig, set, regs);
+ return __setup_rt_frame(ksig, regs);
}
}

--
2.35.3
\
 
 \ /
  Last update: 2022-06-06 22:44    [W:0.105 / U:18.464 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site