Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
9f855c08
Commit
9f855c08
authored
Feb 15, 2020
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x86: switch setup_sigcontext() to unsafe_put_user()
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
a37d01ea
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
46 deletions
+45
-46
arch/x86/include/asm/sighandling.h
arch/x86/include/asm/sighandling.h
+0
-3
arch/x86/kernel/signal.c
arch/x86/kernel/signal.c
+45
-43
No files found.
arch/x86/include/asm/sighandling.h
View file @
9f855c08
...
...
@@ -14,9 +14,6 @@
X86_EFLAGS_CF | X86_EFLAGS_RF)
void
signal_fault
(
struct
pt_regs
*
regs
,
void
__user
*
frame
,
char
*
where
);
int
setup_sigcontext
(
struct
sigcontext
__user
*
sc
,
void
__user
*
fpstate
,
struct
pt_regs
*
regs
,
unsigned
long
mask
);
#ifdef CONFIG_X86_X32_ABI
asmlinkage
long
sys32_x32_rt_sigreturn
(
void
);
...
...
arch/x86/kernel/signal.c
View file @
9f855c08
...
...
@@ -140,63 +140,65 @@ static int restore_sigcontext(struct pt_regs *regs,
IS_ENABLED
(
CONFIG_X86_32
));
}
int
setup_sigcontext
(
struct
sigcontext
__user
*
sc
,
void
__user
*
fpstate
,
static
int
setup_sigcontext
(
struct
sigcontext
__user
*
sc
,
void
__user
*
fpstate
,
struct
pt_regs
*
regs
,
unsigned
long
mask
)
{
int
err
=
0
;
put_user_try
{
if
(
!
user_access_begin
(
sc
,
sizeof
(
struct
sigcontext
)))
return
-
EFAULT
;
#ifdef CONFIG_X86_32
put_user_ex
(
get_user_gs
(
regs
),
(
unsigned
int
__user
*
)
&
sc
->
gs
);
put_user_ex
(
regs
->
fs
,
(
unsigned
int
__user
*
)
&
sc
->
fs
);
put_user_ex
(
regs
->
es
,
(
unsigned
int
__user
*
)
&
sc
->
es
);
put_user_ex
(
regs
->
ds
,
(
unsigned
int
__user
*
)
&
sc
->
ds
);
unsafe_put_user
(
get_user_gs
(
regs
),
(
unsigned
int
__user
*
)
&
sc
->
gs
,
Efault
);
unsafe_put_user
(
regs
->
fs
,
(
unsigned
int
__user
*
)
&
sc
->
fs
,
Efault
);
unsafe_put_user
(
regs
->
es
,
(
unsigned
int
__user
*
)
&
sc
->
es
,
Efault
);
unsafe_put_user
(
regs
->
ds
,
(
unsigned
int
__user
*
)
&
sc
->
ds
,
Efault
);
#endif
/* CONFIG_X86_32 */
put_user_ex
(
regs
->
di
,
&
sc
->
di
);
put_user_ex
(
regs
->
si
,
&
sc
->
si
);
put_user_ex
(
regs
->
bp
,
&
sc
->
bp
);
put_user_ex
(
regs
->
sp
,
&
sc
->
sp
);
put_user_ex
(
regs
->
bx
,
&
sc
->
bx
);
put_user_ex
(
regs
->
dx
,
&
sc
->
dx
);
put_user_ex
(
regs
->
cx
,
&
sc
->
cx
);
put_user_ex
(
regs
->
ax
,
&
sc
->
ax
);
unsafe_put_user
(
regs
->
di
,
&
sc
->
di
,
Efault
);
unsafe_put_user
(
regs
->
si
,
&
sc
->
si
,
Efault
);
unsafe_put_user
(
regs
->
bp
,
&
sc
->
bp
,
Efault
);
unsafe_put_user
(
regs
->
sp
,
&
sc
->
sp
,
Efault
);
unsafe_put_user
(
regs
->
bx
,
&
sc
->
bx
,
Efault
);
unsafe_put_user
(
regs
->
dx
,
&
sc
->
dx
,
Efault
);
unsafe_put_user
(
regs
->
cx
,
&
sc
->
cx
,
Efault
);
unsafe_put_user
(
regs
->
ax
,
&
sc
->
ax
,
Efault
);
#ifdef CONFIG_X86_64
put_user_ex
(
regs
->
r8
,
&
sc
->
r8
);
put_user_ex
(
regs
->
r9
,
&
sc
->
r9
);
put_user_ex
(
regs
->
r10
,
&
sc
->
r10
);
put_user_ex
(
regs
->
r11
,
&
sc
->
r11
);
put_user_ex
(
regs
->
r12
,
&
sc
->
r12
);
put_user_ex
(
regs
->
r13
,
&
sc
->
r13
);
put_user_ex
(
regs
->
r14
,
&
sc
->
r14
);
put_user_ex
(
regs
->
r15
,
&
sc
->
r15
);
unsafe_put_user
(
regs
->
r8
,
&
sc
->
r8
,
Efault
);
unsafe_put_user
(
regs
->
r9
,
&
sc
->
r9
,
Efault
);
unsafe_put_user
(
regs
->
r10
,
&
sc
->
r10
,
Efault
);
unsafe_put_user
(
regs
->
r11
,
&
sc
->
r11
,
Efault
);
unsafe_put_user
(
regs
->
r12
,
&
sc
->
r12
,
Efault
);
unsafe_put_user
(
regs
->
r13
,
&
sc
->
r13
,
Efault
);
unsafe_put_user
(
regs
->
r14
,
&
sc
->
r14
,
Efault
);
unsafe_put_user
(
regs
->
r15
,
&
sc
->
r15
,
Efault
);
#endif
/* CONFIG_X86_64 */
put_user_ex
(
current
->
thread
.
trap_nr
,
&
sc
->
trapno
);
put_user_ex
(
current
->
thread
.
error_code
,
&
sc
->
err
);
put_user_ex
(
regs
->
ip
,
&
sc
->
ip
);
unsafe_put_user
(
current
->
thread
.
trap_nr
,
&
sc
->
trapno
,
Efault
);
unsafe_put_user
(
current
->
thread
.
error_code
,
&
sc
->
err
,
Efault
);
unsafe_put_user
(
regs
->
ip
,
&
sc
->
ip
,
Efault
);
#ifdef CONFIG_X86_32
put_user_ex
(
regs
->
cs
,
(
unsigned
int
__user
*
)
&
sc
->
cs
);
put_user_ex
(
regs
->
flags
,
&
sc
->
flags
);
put_user_ex
(
regs
->
sp
,
&
sc
->
sp_at_signal
);
put_user_ex
(
regs
->
ss
,
(
unsigned
int
__user
*
)
&
sc
->
ss
);
unsafe_put_user
(
regs
->
cs
,
(
unsigned
int
__user
*
)
&
sc
->
cs
,
Efault
);
unsafe_put_user
(
regs
->
flags
,
&
sc
->
flags
,
Efault
);
unsafe_put_user
(
regs
->
sp
,
&
sc
->
sp_at_signal
,
Efault
);
unsafe_put_user
(
regs
->
ss
,
(
unsigned
int
__user
*
)
&
sc
->
ss
,
Efault
);
#else
/* !CONFIG_X86_32 */
put_user_ex
(
regs
->
flags
,
&
sc
->
flags
);
put_user_ex
(
regs
->
cs
,
&
sc
->
cs
);
put_user_ex
(
0
,
&
sc
->
gs
);
put_user_ex
(
0
,
&
sc
->
fs
);
put_user_ex
(
regs
->
ss
,
&
sc
->
ss
);
unsafe_put_user
(
regs
->
flags
,
&
sc
->
flags
,
Efault
);
unsafe_put_user
(
regs
->
cs
,
&
sc
->
cs
,
Efault
);
unsafe_put_user
(
0
,
&
sc
->
gs
,
Efault
);
unsafe_put_user
(
0
,
&
sc
->
fs
,
Efault
);
unsafe_put_user
(
regs
->
ss
,
&
sc
->
ss
,
Efault
);
#endif
/* CONFIG_X86_32 */
put_user_ex
(
fpstate
,
(
unsigned
long
__user
*
)
&
sc
->
fpstate
);
unsafe_put_user
(
fpstate
,
(
unsigned
long
__user
*
)
&
sc
->
fpstate
,
Efault
);
/* non-iBCS2 extensions.. */
put_user_ex
(
mask
,
&
sc
->
oldmask
);
put_user_ex
(
current
->
thread
.
cr2
,
&
sc
->
cr2
);
}
put_user_catch
(
err
);
return
err
;
/* non-iBCS2 extensions.. */
unsafe_put_user
(
mask
,
&
sc
->
oldmask
,
Efault
);
unsafe_put_user
(
current
->
thread
.
cr2
,
&
sc
->
cr2
,
Efault
);
user_access_end
();
return
0
;
Efault:
user_access_end
();
return
-
EFAULT
;
}
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment