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
a37d01ea
Commit
a37d01ea
authored
Feb 15, 2020
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x86: switch save_v86_state() to unsafe_put_user()
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
77f3c616
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
31 deletions
+30
-31
arch/x86/kernel/vm86_32.c
arch/x86/kernel/vm86_32.c
+30
-31
No files found.
arch/x86/kernel/vm86_32.c
View file @
a37d01ea
...
...
@@ -98,7 +98,6 @@ void save_v86_state(struct kernel_vm86_regs *regs, int retval)
struct
task_struct
*
tsk
=
current
;
struct
vm86plus_struct
__user
*
user
;
struct
vm86
*
vm86
=
current
->
thread
.
vm86
;
long
err
=
0
;
/*
* This gets called from entry.S with interrupts disabled, but
...
...
@@ -114,37 +113,30 @@ void save_v86_state(struct kernel_vm86_regs *regs, int retval)
set_flags
(
regs
->
pt
.
flags
,
VEFLAGS
,
X86_EFLAGS_VIF
|
vm86
->
veflags_mask
);
user
=
vm86
->
user_vm86
;
if
(
!
access_ok
(
user
,
vm86
->
vm86plus
.
is_vm86pus
?
if
(
!
user_access_begin
(
user
,
vm86
->
vm86plus
.
is_vm86pus
?
sizeof
(
struct
vm86plus_struct
)
:
sizeof
(
struct
vm86_struct
)))
{
pr_alert
(
"could not access userspace vm86 info
\n
"
);
do_exit
(
SIGSEGV
);
}
put_user_try
{
put_user_ex
(
regs
->
pt
.
bx
,
&
user
->
regs
.
ebx
);
put_user_ex
(
regs
->
pt
.
cx
,
&
user
->
regs
.
ecx
);
put_user_ex
(
regs
->
pt
.
dx
,
&
user
->
regs
.
edx
);
put_user_ex
(
regs
->
pt
.
si
,
&
user
->
regs
.
esi
);
put_user_ex
(
regs
->
pt
.
di
,
&
user
->
regs
.
edi
);
put_user_ex
(
regs
->
pt
.
bp
,
&
user
->
regs
.
ebp
);
put_user_ex
(
regs
->
pt
.
ax
,
&
user
->
regs
.
eax
);
put_user_ex
(
regs
->
pt
.
ip
,
&
user
->
regs
.
eip
);
put_user_ex
(
regs
->
pt
.
cs
,
&
user
->
regs
.
cs
);
put_user_ex
(
regs
->
pt
.
flags
,
&
user
->
regs
.
eflags
);
put_user_ex
(
regs
->
pt
.
sp
,
&
user
->
regs
.
esp
);
put_user_ex
(
regs
->
pt
.
ss
,
&
user
->
regs
.
ss
);
put_user_ex
(
regs
->
es
,
&
user
->
regs
.
es
);
put_user_ex
(
regs
->
ds
,
&
user
->
regs
.
ds
);
put_user_ex
(
regs
->
fs
,
&
user
->
regs
.
fs
);
put_user_ex
(
regs
->
gs
,
&
user
->
regs
.
gs
);
put_user_ex
(
vm86
->
screen_bitmap
,
&
user
->
screen_bitmap
);
}
put_user_catch
(
err
);
if
(
err
)
{
pr_alert
(
"could not access userspace vm86 info
\n
"
);
do_exit
(
SIGSEGV
);
}
sizeof
(
struct
vm86_struct
)))
goto
Efault
;
unsafe_put_user
(
regs
->
pt
.
bx
,
&
user
->
regs
.
ebx
,
Efault_end
);
unsafe_put_user
(
regs
->
pt
.
cx
,
&
user
->
regs
.
ecx
,
Efault_end
);
unsafe_put_user
(
regs
->
pt
.
dx
,
&
user
->
regs
.
edx
,
Efault_end
);
unsafe_put_user
(
regs
->
pt
.
si
,
&
user
->
regs
.
esi
,
Efault_end
);
unsafe_put_user
(
regs
->
pt
.
di
,
&
user
->
regs
.
edi
,
Efault_end
);
unsafe_put_user
(
regs
->
pt
.
bp
,
&
user
->
regs
.
ebp
,
Efault_end
);
unsafe_put_user
(
regs
->
pt
.
ax
,
&
user
->
regs
.
eax
,
Efault_end
);
unsafe_put_user
(
regs
->
pt
.
ip
,
&
user
->
regs
.
eip
,
Efault_end
);
unsafe_put_user
(
regs
->
pt
.
cs
,
&
user
->
regs
.
cs
,
Efault_end
);
unsafe_put_user
(
regs
->
pt
.
flags
,
&
user
->
regs
.
eflags
,
Efault_end
);
unsafe_put_user
(
regs
->
pt
.
sp
,
&
user
->
regs
.
esp
,
Efault_end
);
unsafe_put_user
(
regs
->
pt
.
ss
,
&
user
->
regs
.
ss
,
Efault_end
);
unsafe_put_user
(
regs
->
es
,
&
user
->
regs
.
es
,
Efault_end
);
unsafe_put_user
(
regs
->
ds
,
&
user
->
regs
.
ds
,
Efault_end
);
unsafe_put_user
(
regs
->
fs
,
&
user
->
regs
.
fs
,
Efault_end
);
unsafe_put_user
(
regs
->
gs
,
&
user
->
regs
.
gs
,
Efault_end
);
unsafe_put_user
(
vm86
->
screen_bitmap
,
&
user
->
screen_bitmap
,
Efault_end
);
user_access_end
();
preempt_disable
();
tsk
->
thread
.
sp0
=
vm86
->
saved_sp0
;
...
...
@@ -159,6 +151,13 @@ void save_v86_state(struct kernel_vm86_regs *regs, int retval)
lazy_load_gs
(
vm86
->
regs32
.
gs
);
regs
->
pt
.
ax
=
retval
;
return
;
Efault_end:
user_access_end
();
Efault:
pr_alert
(
"could not access userspace vm86 info
\n
"
);
do_exit
(
SIGSEGV
);
}
static
void
mark_screen_rdonly
(
struct
mm_struct
*
mm
)
...
...
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