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
nexedi
linux
Commits
7c3f26b7
Commit
7c3f26b7
authored
May 30, 2004
by
Alexander Viro
Committed by
Linus Torvalds
May 30, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] sparse: amd64 annotations - trivial part
Annotation of amd64 code - just adding __user where needed...
parent
67e8b28b
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
113 additions
and
106 deletions
+113
-106
arch/x86_64/ia32/fpu32.c
arch/x86_64/ia32/fpu32.c
+8
-8
arch/x86_64/ia32/ia32_ioctl.c
arch/x86_64/ia32/ia32_ioctl.c
+5
-5
arch/x86_64/ia32/ia32_signal.c
arch/x86_64/ia32/ia32_signal.c
+20
-19
arch/x86_64/ia32/ptrace32.c
arch/x86_64/ia32/ptrace32.c
+16
-14
arch/x86_64/kernel/i387.c
arch/x86_64/kernel/i387.c
+5
-5
arch/x86_64/kernel/ldt.c
arch/x86_64/kernel/ldt.c
+4
-4
arch/x86_64/kernel/process.c
arch/x86_64/kernel/process.c
+5
-4
arch/x86_64/kernel/ptrace.c
arch/x86_64/kernel/ptrace.c
+21
-20
arch/x86_64/kernel/signal.c
arch/x86_64/kernel/signal.c
+13
-12
arch/x86_64/kernel/sys_x86_64.c
arch/x86_64/kernel/sys_x86_64.c
+4
-4
include/asm-x86_64/fpu32.h
include/asm-x86_64/fpu32.h
+2
-2
include/asm-x86_64/i387.h
include/asm-x86_64/i387.h
+5
-5
include/asm-x86_64/ia32.h
include/asm-x86_64/ia32.h
+2
-2
include/asm-x86_64/ptrace.h
include/asm-x86_64/ptrace.h
+1
-1
include/asm-x86_64/sigcontext.h
include/asm-x86_64/sigcontext.h
+2
-1
No files found.
arch/x86_64/ia32/fpu32.c
View file @
7c3f26b7
...
@@ -72,15 +72,15 @@ static inline unsigned long twd_fxsr_to_i387(struct i387_fxsave_struct *fxsave)
...
@@ -72,15 +72,15 @@ static inline unsigned long twd_fxsr_to_i387(struct i387_fxsave_struct *fxsave)
static
inline
int
convert_fxsr_from_user
(
struct
i387_fxsave_struct
*
fxsave
,
static
inline
int
convert_fxsr_from_user
(
struct
i387_fxsave_struct
*
fxsave
,
struct
_fpstate_ia32
*
buf
)
struct
_fpstate_ia32
__user
*
buf
)
{
{
struct
_fpxreg
*
to
;
struct
_fpxreg
*
to
;
struct
_fpreg
*
from
;
struct
_fpreg
__user
*
from
;
int
i
;
int
i
;
u32
v
;
u32
v
;
int
err
=
0
;
int
err
=
0
;
#define G(num,val) err |= __get_user(val, num + (u32 *)buf)
#define G(num,val) err |= __get_user(val, num + (u32
__user
*)buf)
G
(
0
,
fxsave
->
cwd
);
G
(
0
,
fxsave
->
cwd
);
G
(
1
,
fxsave
->
swd
);
G
(
1
,
fxsave
->
swd
);
G
(
2
,
fxsave
->
twd
);
G
(
2
,
fxsave
->
twd
);
...
@@ -104,12 +104,12 @@ static inline int convert_fxsr_from_user(struct i387_fxsave_struct *fxsave,
...
@@ -104,12 +104,12 @@ static inline int convert_fxsr_from_user(struct i387_fxsave_struct *fxsave,
}
}
static
inline
int
convert_fxsr_to_user
(
struct
_fpstate_ia32
*
buf
,
static
inline
int
convert_fxsr_to_user
(
struct
_fpstate_ia32
__user
*
buf
,
struct
i387_fxsave_struct
*
fxsave
,
struct
i387_fxsave_struct
*
fxsave
,
struct
pt_regs
*
regs
,
struct
pt_regs
*
regs
,
struct
task_struct
*
tsk
)
struct
task_struct
*
tsk
)
{
{
struct
_fpreg
*
to
;
struct
_fpreg
__user
*
to
;
struct
_fpxreg
*
from
;
struct
_fpxreg
*
from
;
int
i
;
int
i
;
u16
cs
,
ds
;
u16
cs
,
ds
;
...
@@ -125,7 +125,7 @@ static inline int convert_fxsr_to_user(struct _fpstate_ia32 *buf,
...
@@ -125,7 +125,7 @@ static inline int convert_fxsr_to_user(struct _fpstate_ia32 *buf,
cs
=
regs
->
cs
;
cs
=
regs
->
cs
;
}
}
#define P(num,val) err |= __put_user(val, num + (u32 *)buf)
#define P(num,val) err |= __put_user(val, num + (u32
__user
*)buf)
P
(
0
,
(
u32
)
fxsave
->
cwd
|
0xffff0000
);
P
(
0
,
(
u32
)
fxsave
->
cwd
|
0xffff0000
);
P
(
1
,
(
u32
)
fxsave
->
swd
|
0xffff0000
);
P
(
1
,
(
u32
)
fxsave
->
swd
|
0xffff0000
);
P
(
2
,
twd_fxsr_to_i387
(
fxsave
));
P
(
2
,
twd_fxsr_to_i387
(
fxsave
));
...
@@ -147,7 +147,7 @@ static inline int convert_fxsr_to_user(struct _fpstate_ia32 *buf,
...
@@ -147,7 +147,7 @@ static inline int convert_fxsr_to_user(struct _fpstate_ia32 *buf,
return
0
;
return
0
;
}
}
int
restore_i387_ia32
(
struct
task_struct
*
tsk
,
struct
_fpstate_ia32
*
buf
,
int
fsave
)
int
restore_i387_ia32
(
struct
task_struct
*
tsk
,
struct
_fpstate_ia32
__user
*
buf
,
int
fsave
)
{
{
clear_fpu
(
tsk
);
clear_fpu
(
tsk
);
if
(
!
fsave
)
{
if
(
!
fsave
)
{
...
@@ -162,7 +162,7 @@ int restore_i387_ia32(struct task_struct *tsk, struct _fpstate_ia32 *buf, int fs
...
@@ -162,7 +162,7 @@ int restore_i387_ia32(struct task_struct *tsk, struct _fpstate_ia32 *buf, int fs
}
}
int
save_i387_ia32
(
struct
task_struct
*
tsk
,
int
save_i387_ia32
(
struct
task_struct
*
tsk
,
struct
_fpstate_ia32
*
buf
,
struct
_fpstate_ia32
__user
*
buf
,
struct
pt_regs
*
regs
,
struct
pt_regs
*
regs
,
int
fsave
)
int
fsave
)
{
{
...
...
arch/x86_64/ia32/ia32_ioctl.c
View file @
7c3f26b7
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
#ifndef TIOCGDEV
#ifndef TIOCGDEV
#define TIOCGDEV _IOR('T',0x32, unsigned int)
#define TIOCGDEV _IOR('T',0x32, unsigned int)
#endif
#endif
static
int
tiocgdev
(
unsigned
fd
,
unsigned
cmd
,
unsigned
int
*
ptr
)
static
int
tiocgdev
(
unsigned
fd
,
unsigned
cmd
,
unsigned
int
__user
*
ptr
)
{
{
struct
file
*
file
=
fget
(
fd
);
struct
file
*
file
=
fget
(
fd
);
...
@@ -54,7 +54,7 @@ static int rtc32_ioctl(unsigned fd, unsigned cmd, unsigned long arg)
...
@@ -54,7 +54,7 @@ static int rtc32_ioctl(unsigned fd, unsigned cmd, unsigned long arg)
ret
=
sys_ioctl
(
fd
,
RTC_IRQP_READ
,
(
unsigned
long
)
&
val
);
ret
=
sys_ioctl
(
fd
,
RTC_IRQP_READ
,
(
unsigned
long
)
&
val
);
set_fs
(
oldfs
);
set_fs
(
oldfs
);
if
(
!
ret
)
if
(
!
ret
)
ret
=
put_user
(
val
,
(
unsigned
int
*
)
arg
);
ret
=
put_user
(
val
,
(
unsigned
int
__user
*
)
arg
);
return
ret
;
return
ret
;
case
RTC_IRQP_SET32
:
case
RTC_IRQP_SET32
:
...
@@ -66,7 +66,7 @@ static int rtc32_ioctl(unsigned fd, unsigned cmd, unsigned long arg)
...
@@ -66,7 +66,7 @@ static int rtc32_ioctl(unsigned fd, unsigned cmd, unsigned long arg)
ret
=
sys_ioctl
(
fd
,
RTC_EPOCH_READ
,
(
unsigned
long
)
&
val
);
ret
=
sys_ioctl
(
fd
,
RTC_EPOCH_READ
,
(
unsigned
long
)
&
val
);
set_fs
(
oldfs
);
set_fs
(
oldfs
);
if
(
!
ret
)
if
(
!
ret
)
ret
=
put_user
(
val
,
(
unsigned
int
*
)
arg
);
ret
=
put_user
(
val
,
(
unsigned
int
__user
*
)
arg
);
return
ret
;
return
ret
;
case
RTC_EPOCH_SET32
:
case
RTC_EPOCH_SET32
:
...
@@ -113,7 +113,7 @@ static int mtrr_ioctl32(unsigned int fd, unsigned int cmd, unsigned long arg)
...
@@ -113,7 +113,7 @@ static int mtrr_ioctl32(unsigned int fd, unsigned int cmd, unsigned long arg)
struct
mtrr_gentry
g
;
struct
mtrr_gentry
g
;
struct
mtrr_sentry
s
;
struct
mtrr_sentry
s
;
int
get
=
0
,
err
=
0
;
int
get
=
0
,
err
=
0
;
struct
mtrr_gentry32
*
g32
=
(
struct
mtrr_gentry32
*
)
arg
;
struct
mtrr_gentry32
__user
*
g32
=
(
struct
mtrr_gentry32
__user
*
)
arg
;
mm_segment_t
oldfs
=
get_fs
();
mm_segment_t
oldfs
=
get_fs
();
switch
(
cmd
)
{
switch
(
cmd
)
{
...
@@ -139,7 +139,7 @@ static int mtrr_ioctl32(unsigned int fd, unsigned int cmd, unsigned long arg)
...
@@ -139,7 +139,7 @@ static int mtrr_ioctl32(unsigned int fd, unsigned int cmd, unsigned long arg)
arg
=
(
unsigned
long
)
&
g
;
arg
=
(
unsigned
long
)
&
g
;
}
else
{
}
else
{
struct
mtrr_sentry32
*
s32
=
(
struct
mtrr_sentry32
*
)
arg
;
struct
mtrr_sentry32
__user
*
s32
=
(
struct
mtrr_sentry32
__user
*
)
arg
;
err
=
get_user
(
s
.
base
,
&
s32
->
base
);
err
=
get_user
(
s
.
base
,
&
s32
->
base
);
err
|=
get_user
(
s
.
size
,
&
s32
->
size
);
err
|=
get_user
(
s
.
size
,
&
s32
->
size
);
err
|=
get_user
(
s
.
type
,
&
s32
->
type
);
err
|=
get_user
(
s
.
type
,
&
s32
->
type
);
...
...
arch/x86_64/ia32/ia32_signal.c
View file @
7c3f26b7
...
@@ -42,7 +42,7 @@
...
@@ -42,7 +42,7 @@
#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
asmlinkage
int
do_signal
(
struct
pt_regs
*
regs
,
sigset_t
*
oldset
);
asmlinkage
int
do_signal
(
struct
pt_regs
*
regs
,
sigset_t
*
oldset
);
void
signal_fault
(
struct
pt_regs
*
regs
,
void
*
frame
,
char
*
where
);
void
signal_fault
(
struct
pt_regs
*
regs
,
void
__user
*
frame
,
char
*
where
);
int
ia32_copy_siginfo_to_user
(
siginfo_t32
__user
*
to
,
siginfo_t
*
from
)
int
ia32_copy_siginfo_to_user
(
siginfo_t32
__user
*
to
,
siginfo_t
*
from
)
{
{
...
@@ -136,7 +136,8 @@ sys32_sigsuspend(int history0, int history1, old_sigset_t mask, struct pt_regs r
...
@@ -136,7 +136,8 @@ sys32_sigsuspend(int history0, int history1, old_sigset_t mask, struct pt_regs r
}
}
asmlinkage
long
asmlinkage
long
sys32_sigaltstack
(
const
stack_ia32_t
*
uss_ptr
,
stack_ia32_t
*
uoss_ptr
,
sys32_sigaltstack
(
const
stack_ia32_t
__user
*
uss_ptr
,
stack_ia32_t
__user
*
uoss_ptr
,
struct
pt_regs
regs
)
struct
pt_regs
regs
)
{
{
stack_t
uss
,
uoss
;
stack_t
uss
,
uoss
;
...
@@ -193,7 +194,7 @@ struct rt_sigframe
...
@@ -193,7 +194,7 @@ struct rt_sigframe
};
};
static
int
static
int
ia32_restore_sigcontext
(
struct
pt_regs
*
regs
,
struct
sigcontext_ia32
*
sc
,
unsigned
int
*
peax
)
ia32_restore_sigcontext
(
struct
pt_regs
*
regs
,
struct
sigcontext_ia32
__user
*
sc
,
unsigned
int
*
peax
)
{
{
unsigned
int
err
=
0
;
unsigned
int
err
=
0
;
...
@@ -252,9 +253,9 @@ ia32_restore_sigcontext(struct pt_regs *regs, struct sigcontext_ia32 *sc, unsign
...
@@ -252,9 +253,9 @@ ia32_restore_sigcontext(struct pt_regs *regs, struct sigcontext_ia32 *sc, unsign
{
{
u32
tmp
;
u32
tmp
;
struct
_fpstate_ia32
*
buf
;
struct
_fpstate_ia32
__user
*
buf
;
err
|=
__get_user
(
tmp
,
&
sc
->
fpstate
);
err
|=
__get_user
(
tmp
,
&
sc
->
fpstate
);
buf
=
(
struct
_fpstate_ia32
*
)
(
u64
)
tmp
;
buf
=
compat_ptr
(
tmp
)
;
if
(
buf
)
{
if
(
buf
)
{
if
(
verify_area
(
VERIFY_READ
,
buf
,
sizeof
(
*
buf
)))
if
(
verify_area
(
VERIFY_READ
,
buf
,
sizeof
(
*
buf
)))
goto
badframe
;
goto
badframe
;
...
@@ -275,7 +276,7 @@ ia32_restore_sigcontext(struct pt_regs *regs, struct sigcontext_ia32 *sc, unsign
...
@@ -275,7 +276,7 @@ ia32_restore_sigcontext(struct pt_regs *regs, struct sigcontext_ia32 *sc, unsign
asmlinkage
long
sys32_sigreturn
(
struct
pt_regs
regs
)
asmlinkage
long
sys32_sigreturn
(
struct
pt_regs
regs
)
{
{
struct
sigframe
*
frame
=
(
struct
sigframe
*
)(
regs
.
rsp
-
8
);
struct
sigframe
__user
*
frame
=
(
struct
sigframe
__user
*
)(
regs
.
rsp
-
8
);
sigset_t
set
;
sigset_t
set
;
unsigned
int
eax
;
unsigned
int
eax
;
...
@@ -304,7 +305,7 @@ asmlinkage long sys32_sigreturn(struct pt_regs regs)
...
@@ -304,7 +305,7 @@ asmlinkage long sys32_sigreturn(struct pt_regs regs)
asmlinkage
long
sys32_rt_sigreturn
(
struct
pt_regs
regs
)
asmlinkage
long
sys32_rt_sigreturn
(
struct
pt_regs
regs
)
{
{
struct
rt_sigframe
*
frame
=
(
struct
rt_sigframe
*
)(
regs
.
rsp
-
4
);
struct
rt_sigframe
__user
*
frame
=
(
struct
rt_sigframe
__user
*
)(
regs
.
rsp
-
4
);
sigset_t
set
;
sigset_t
set
;
unsigned
int
eax
;
unsigned
int
eax
;
...
@@ -337,20 +338,20 @@ asmlinkage long sys32_rt_sigreturn(struct pt_regs regs)
...
@@ -337,20 +338,20 @@ asmlinkage long sys32_rt_sigreturn(struct pt_regs regs)
*/
*/
static
int
static
int
ia32_setup_sigcontext
(
struct
sigcontext_ia32
*
sc
,
struct
_fpstate_ia32
*
fpstate
,
ia32_setup_sigcontext
(
struct
sigcontext_ia32
__user
*
sc
,
struct
_fpstate_ia32
__user
*
fpstate
,
struct
pt_regs
*
regs
,
unsigned
int
mask
)
struct
pt_regs
*
regs
,
unsigned
int
mask
)
{
{
int
tmp
,
err
=
0
;
int
tmp
,
err
=
0
;
tmp
=
0
;
tmp
=
0
;
__asm__
(
"movl %%gs,%0"
:
"=r"
(
tmp
)
:
"0"
(
tmp
));
__asm__
(
"movl %%gs,%0"
:
"=r"
(
tmp
)
:
"0"
(
tmp
));
err
|=
__put_user
(
tmp
,
(
unsigned
int
*
)
&
sc
->
gs
);
err
|=
__put_user
(
tmp
,
(
unsigned
int
__user
*
)
&
sc
->
gs
);
__asm__
(
"movl %%fs,%0"
:
"=r"
(
tmp
)
:
"0"
(
tmp
));
__asm__
(
"movl %%fs,%0"
:
"=r"
(
tmp
)
:
"0"
(
tmp
));
err
|=
__put_user
(
tmp
,
(
unsigned
int
*
)
&
sc
->
fs
);
err
|=
__put_user
(
tmp
,
(
unsigned
int
__user
*
)
&
sc
->
fs
);
__asm__
(
"movl %%ds,%0"
:
"=r"
(
tmp
)
:
"0"
(
tmp
));
__asm__
(
"movl %%ds,%0"
:
"=r"
(
tmp
)
:
"0"
(
tmp
));
err
|=
__put_user
(
tmp
,
(
unsigned
int
*
)
&
sc
->
ds
);
err
|=
__put_user
(
tmp
,
(
unsigned
int
__user
*
)
&
sc
->
ds
);
__asm__
(
"movl %%es,%0"
:
"=r"
(
tmp
)
:
"0"
(
tmp
));
__asm__
(
"movl %%es,%0"
:
"=r"
(
tmp
)
:
"0"
(
tmp
));
err
|=
__put_user
(
tmp
,
(
unsigned
int
*
)
&
sc
->
es
);
err
|=
__put_user
(
tmp
,
(
unsigned
int
__user
*
)
&
sc
->
es
);
err
|=
__put_user
((
u32
)
regs
->
rdi
,
&
sc
->
edi
);
err
|=
__put_user
((
u32
)
regs
->
rdi
,
&
sc
->
edi
);
err
|=
__put_user
((
u32
)
regs
->
rsi
,
&
sc
->
esi
);
err
|=
__put_user
((
u32
)
regs
->
rsi
,
&
sc
->
esi
);
...
@@ -387,7 +388,7 @@ ia32_setup_sigcontext(struct sigcontext_ia32 *sc, struct _fpstate_ia32 *fpstate,
...
@@ -387,7 +388,7 @@ ia32_setup_sigcontext(struct sigcontext_ia32 *sc, struct _fpstate_ia32 *fpstate,
/*
/*
* Determine which stack to use..
* Determine which stack to use..
*/
*/
static
void
*
static
void
__user
*
get_sigframe
(
struct
k_sigaction
*
ka
,
struct
pt_regs
*
regs
,
size_t
frame_size
)
get_sigframe
(
struct
k_sigaction
*
ka
,
struct
pt_regs
*
regs
,
size_t
frame_size
)
{
{
unsigned
long
rsp
;
unsigned
long
rsp
;
...
@@ -408,13 +409,13 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size)
...
@@ -408,13 +409,13 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size)
rsp
=
(
unsigned
long
)
ka
->
sa
.
sa_restorer
;
rsp
=
(
unsigned
long
)
ka
->
sa
.
sa_restorer
;
}
}
return
(
void
*
)((
rsp
-
frame_size
)
&
-
8UL
);
return
(
void
__user
*
)((
rsp
-
frame_size
)
&
-
8UL
);
}
}
void
ia32_setup_frame
(
int
sig
,
struct
k_sigaction
*
ka
,
void
ia32_setup_frame
(
int
sig
,
struct
k_sigaction
*
ka
,
compat_sigset_t
*
set
,
struct
pt_regs
*
regs
)
compat_sigset_t
*
set
,
struct
pt_regs
*
regs
)
{
{
struct
sigframe
*
frame
;
struct
sigframe
__user
*
frame
;
int
err
=
0
;
int
err
=
0
;
frame
=
get_sigframe
(
ka
,
regs
,
sizeof
(
*
frame
));
frame
=
get_sigframe
(
ka
,
regs
,
sizeof
(
*
frame
));
...
@@ -501,7 +502,7 @@ void ia32_setup_frame(int sig, struct k_sigaction *ka,
...
@@ -501,7 +502,7 @@ void ia32_setup_frame(int sig, struct k_sigaction *ka,
void
ia32_setup_rt_frame
(
int
sig
,
struct
k_sigaction
*
ka
,
siginfo_t
*
info
,
void
ia32_setup_rt_frame
(
int
sig
,
struct
k_sigaction
*
ka
,
siginfo_t
*
info
,
compat_sigset_t
*
set
,
struct
pt_regs
*
regs
)
compat_sigset_t
*
set
,
struct
pt_regs
*
regs
)
{
{
struct
rt_sigframe
*
frame
;
struct
rt_sigframe
__user
*
frame
;
int
err
=
0
;
int
err
=
0
;
frame
=
get_sigframe
(
ka
,
regs
,
sizeof
(
*
frame
));
frame
=
get_sigframe
(
ka
,
regs
,
sizeof
(
*
frame
));
...
...
arch/x86_64/ia32/ptrace32.c
View file @
7c3f26b7
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
#include <linux/mm.h>
#include <linux/mm.h>
#include <linux/ptrace.h>
#include <linux/ptrace.h>
#include <asm/ptrace.h>
#include <asm/ptrace.h>
#include <asm/compat.h>
#include <asm/uaccess.h>
#include <asm/uaccess.h>
#include <asm/user32.h>
#include <asm/user32.h>
#include <asm/user.h>
#include <asm/user.h>
...
@@ -228,6 +229,7 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
...
@@ -228,6 +229,7 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
{
{
struct
task_struct
*
child
;
struct
task_struct
*
child
;
struct
pt_regs
*
childregs
;
struct
pt_regs
*
childregs
;
void
__user
*
datap
=
compat_ptr
(
data
);
int
ret
;
int
ret
;
__u32
val
;
__u32
val
;
...
@@ -264,7 +266,7 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
...
@@ -264,7 +266,7 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
if
(
access_process_vm
(
child
,
addr
,
&
val
,
sizeof
(
u32
),
0
)
!=
sizeof
(
u32
))
if
(
access_process_vm
(
child
,
addr
,
&
val
,
sizeof
(
u32
),
0
)
!=
sizeof
(
u32
))
ret
=
-
EIO
;
ret
=
-
EIO
;
else
else
ret
=
put_user
(
val
,
(
unsigned
int
*
)(
u64
)
data
);
ret
=
put_user
(
val
,
(
unsigned
int
__user
*
)
datap
);
break
;
break
;
case
PTRACE_POKEDATA
:
case
PTRACE_POKEDATA
:
...
@@ -277,7 +279,7 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
...
@@ -277,7 +279,7 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
case
PTRACE_PEEKUSR
:
case
PTRACE_PEEKUSR
:
ret
=
getreg32
(
child
,
addr
,
&
val
);
ret
=
getreg32
(
child
,
addr
,
&
val
);
if
(
ret
==
0
)
if
(
ret
==
0
)
ret
=
put_user
(
val
,
(
__u32
*
)(
unsigned
long
)
data
);
ret
=
put_user
(
val
,
(
__u32
__user
*
)
datap
);
break
;
break
;
case
PTRACE_POKEUSR
:
case
PTRACE_POKEUSR
:
...
@@ -286,15 +288,15 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
...
@@ -286,15 +288,15 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
case
PTRACE_GETREGS
:
{
/* Get all gp regs from the child. */
case
PTRACE_GETREGS
:
{
/* Get all gp regs from the child. */
int
i
;
int
i
;
if
(
!
access_ok
(
VERIFY_WRITE
,
(
unsigned
*
)(
unsigned
long
)
data
,
16
*
4
))
{
if
(
!
access_ok
(
VERIFY_WRITE
,
datap
,
16
*
4
))
{
ret
=
-
EIO
;
ret
=
-
EIO
;
break
;
break
;
}
}
ret
=
0
;
ret
=
0
;
for
(
i
=
0
;
i
<=
16
*
4
;
i
+=
sizeof
(
__u32
)
)
{
for
(
i
=
0
;
i
<=
16
*
4
;
i
+=
sizeof
(
__u32
)
)
{
getreg32
(
child
,
i
,
&
val
);
getreg32
(
child
,
i
,
&
val
);
ret
|=
__put_user
(
val
,(
u32
*
)
(
unsigned
long
)
data
);
ret
|=
__put_user
(
val
,(
u32
__user
*
)
datap
);
data
+=
sizeof
(
u32
);
data
p
+=
sizeof
(
u32
);
}
}
break
;
break
;
}
}
...
@@ -302,40 +304,40 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
...
@@ -302,40 +304,40 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
case
PTRACE_SETREGS
:
{
/* Set all gp regs in the child. */
case
PTRACE_SETREGS
:
{
/* Set all gp regs in the child. */
unsigned
long
tmp
;
unsigned
long
tmp
;
int
i
;
int
i
;
if
(
!
access_ok
(
VERIFY_READ
,
(
unsigned
*
)(
unsigned
long
)
data
,
16
*
4
))
{
if
(
!
access_ok
(
VERIFY_READ
,
datap
,
16
*
4
))
{
ret
=
-
EIO
;
ret
=
-
EIO
;
break
;
break
;
}
}
ret
=
0
;
ret
=
0
;
for
(
i
=
0
;
i
<=
16
*
4
;
i
+=
sizeof
(
u32
)
)
{
for
(
i
=
0
;
i
<=
16
*
4
;
i
+=
sizeof
(
u32
)
)
{
ret
|=
__get_user
(
tmp
,
(
u32
*
)
(
unsigned
long
)
data
);
ret
|=
__get_user
(
tmp
,
(
u32
__user
*
)
datap
);
putreg32
(
child
,
i
,
tmp
);
putreg32
(
child
,
i
,
tmp
);
data
+=
sizeof
(
u32
);
data
p
+=
sizeof
(
u32
);
}
}
break
;
break
;
}
}
case
PTRACE_GETFPREGS
:
case
PTRACE_GETFPREGS
:
ret
=
-
EIO
;
ret
=
-
EIO
;
if
(
!
access_ok
(
VERIFY_READ
,
(
void
*
)(
u64
)
data
,
if
(
!
access_ok
(
VERIFY_READ
,
compat_ptr
(
data
)
,
sizeof
(
struct
user_i387_struct
)))
sizeof
(
struct
user_i387_struct
)))
break
;
break
;
save_i387_ia32
(
child
,
(
void
*
)(
u64
)
data
,
childregs
,
1
);
save_i387_ia32
(
child
,
datap
,
childregs
,
1
);
ret
=
0
;
ret
=
0
;
break
;
break
;
case
PTRACE_SETFPREGS
:
case
PTRACE_SETFPREGS
:
ret
=
-
EIO
;
ret
=
-
EIO
;
if
(
!
access_ok
(
VERIFY_WRITE
,
(
void
*
)(
u64
)
data
,
if
(
!
access_ok
(
VERIFY_WRITE
,
datap
,
sizeof
(
struct
user_i387_struct
)))
sizeof
(
struct
user_i387_struct
)))
break
;
break
;
ret
=
0
;
ret
=
0
;
/* don't check EFAULT to be bug-to-bug compatible to i386 */
/* don't check EFAULT to be bug-to-bug compatible to i386 */
restore_i387_ia32
(
child
,
(
void
*
)(
u64
)
data
,
1
);
restore_i387_ia32
(
child
,
datap
,
1
);
break
;
break
;
case
PTRACE_GETFPXREGS
:
{
case
PTRACE_GETFPXREGS
:
{
struct
user32_fxsr_struct
*
u
=
(
void
*
)(
u64
)
data
;
struct
user32_fxsr_struct
__user
*
u
=
datap
;
init_fpu
(
child
);
init_fpu
(
child
);
ret
=
-
EIO
;
ret
=
-
EIO
;
if
(
!
access_ok
(
VERIFY_WRITE
,
u
,
sizeof
(
*
u
)))
if
(
!
access_ok
(
VERIFY_WRITE
,
u
,
sizeof
(
*
u
)))
...
@@ -348,7 +350,7 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
...
@@ -348,7 +350,7 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
break
;
break
;
}
}
case
PTRACE_SETFPXREGS
:
{
case
PTRACE_SETFPXREGS
:
{
struct
user32_fxsr_struct
*
u
=
(
void
*
)(
u64
)
data
;
struct
user32_fxsr_struct
__user
*
u
=
datap
;
unlazy_fpu
(
child
);
unlazy_fpu
(
child
);
ret
=
-
EIO
;
ret
=
-
EIO
;
if
(
!
access_ok
(
VERIFY_READ
,
u
,
sizeof
(
*
u
)))
if
(
!
access_ok
(
VERIFY_READ
,
u
,
sizeof
(
*
u
)))
...
...
arch/x86_64/kernel/i387.c
View file @
7c3f26b7
...
@@ -77,7 +77,7 @@ void init_fpu(struct task_struct *child)
...
@@ -77,7 +77,7 @@ void init_fpu(struct task_struct *child)
* Signal frame handlers.
* Signal frame handlers.
*/
*/
int
save_i387
(
struct
_fpstate
*
buf
)
int
save_i387
(
struct
_fpstate
__user
*
buf
)
{
{
struct
task_struct
*
tsk
=
current
;
struct
task_struct
*
tsk
=
current
;
int
err
=
0
;
int
err
=
0
;
...
@@ -95,7 +95,7 @@ int save_i387(struct _fpstate *buf)
...
@@ -95,7 +95,7 @@ int save_i387(struct _fpstate *buf)
return
0
;
return
0
;
tsk
->
used_math
=
0
;
/* trigger finit */
tsk
->
used_math
=
0
;
/* trigger finit */
if
(
tsk
->
thread_info
->
status
&
TS_USEDFPU
)
{
if
(
tsk
->
thread_info
->
status
&
TS_USEDFPU
)
{
err
=
save_i387_checking
((
struct
i387_fxsave_struct
*
)
buf
);
err
=
save_i387_checking
((
struct
i387_fxsave_struct
__user
*
)
buf
);
if
(
err
)
return
err
;
if
(
err
)
return
err
;
stts
();
stts
();
}
else
{
}
else
{
...
@@ -110,14 +110,14 @@ int save_i387(struct _fpstate *buf)
...
@@ -110,14 +110,14 @@ int save_i387(struct _fpstate *buf)
* ptrace request handlers.
* ptrace request handlers.
*/
*/
int
get_fpregs
(
struct
user_i387_struct
*
buf
,
struct
task_struct
*
tsk
)
int
get_fpregs
(
struct
user_i387_struct
__user
*
buf
,
struct
task_struct
*
tsk
)
{
{
init_fpu
(
tsk
);
init_fpu
(
tsk
);
return
__copy_to_user
(
(
void
*
)
buf
,
&
tsk
->
thread
.
i387
.
fxsave
,
return
__copy_to_user
(
buf
,
&
tsk
->
thread
.
i387
.
fxsave
,
sizeof
(
struct
user_i387_struct
))
?
-
EFAULT
:
0
;
sizeof
(
struct
user_i387_struct
))
?
-
EFAULT
:
0
;
}
}
int
set_fpregs
(
struct
task_struct
*
tsk
,
struct
user_i387_struct
*
buf
)
int
set_fpregs
(
struct
task_struct
*
tsk
,
struct
user_i387_struct
__user
*
buf
)
{
{
if
(
__copy_from_user
(
&
tsk
->
thread
.
i387
.
fxsave
,
buf
,
if
(
__copy_from_user
(
&
tsk
->
thread
.
i387
.
fxsave
,
buf
,
sizeof
(
struct
user_i387_struct
)))
sizeof
(
struct
user_i387_struct
)))
...
...
arch/x86_64/kernel/ldt.c
View file @
7c3f26b7
...
@@ -125,7 +125,7 @@ void destroy_context(struct mm_struct *mm)
...
@@ -125,7 +125,7 @@ void destroy_context(struct mm_struct *mm)
}
}
}
}
static
int
read_ldt
(
void
*
ptr
,
unsigned
long
bytecount
)
static
int
read_ldt
(
void
__user
*
ptr
,
unsigned
long
bytecount
)
{
{
int
err
;
int
err
;
unsigned
long
size
;
unsigned
long
size
;
...
@@ -153,7 +153,7 @@ static int read_ldt(void * ptr, unsigned long bytecount)
...
@@ -153,7 +153,7 @@ static int read_ldt(void * ptr, unsigned long bytecount)
return
bytecount
;
return
bytecount
;
}
}
static
int
read_default_ldt
(
void
*
ptr
,
unsigned
long
bytecount
)
static
int
read_default_ldt
(
void
__user
*
ptr
,
unsigned
long
bytecount
)
{
{
/* Arbitrary number */
/* Arbitrary number */
/* x86-64 default LDT is all zeros */
/* x86-64 default LDT is all zeros */
...
@@ -164,7 +164,7 @@ static int read_default_ldt(void * ptr, unsigned long bytecount)
...
@@ -164,7 +164,7 @@ static int read_default_ldt(void * ptr, unsigned long bytecount)
return
bytecount
;
return
bytecount
;
}
}
static
int
write_ldt
(
void
*
ptr
,
unsigned
long
bytecount
,
int
oldmode
)
static
int
write_ldt
(
void
__user
*
ptr
,
unsigned
long
bytecount
,
int
oldmode
)
{
{
struct
task_struct
*
me
=
current
;
struct
task_struct
*
me
=
current
;
struct
mm_struct
*
mm
=
me
->
mm
;
struct
mm_struct
*
mm
=
me
->
mm
;
...
@@ -225,7 +225,7 @@ static int write_ldt(void * ptr, unsigned long bytecount, int oldmode)
...
@@ -225,7 +225,7 @@ static int write_ldt(void * ptr, unsigned long bytecount, int oldmode)
return
error
;
return
error
;
}
}
asmlinkage
int
sys_modify_ldt
(
int
func
,
void
*
ptr
,
unsigned
long
bytecount
)
asmlinkage
int
sys_modify_ldt
(
int
func
,
void
__user
*
ptr
,
unsigned
long
bytecount
)
{
{
int
ret
=
-
ENOSYS
;
int
ret
=
-
ENOSYS
;
...
...
arch/x86_64/kernel/process.c
View file @
7c3f26b7
...
@@ -521,7 +521,8 @@ struct task_struct *__switch_to(struct task_struct *prev_p, struct task_struct *
...
@@ -521,7 +521,8 @@ struct task_struct *__switch_to(struct task_struct *prev_p, struct task_struct *
* sys_execve() executes a new program.
* sys_execve() executes a new program.
*/
*/
asmlinkage
asmlinkage
long
sys_execve
(
char
*
name
,
char
**
argv
,
char
**
envp
,
struct
pt_regs
regs
)
long
sys_execve
(
char
__user
*
name
,
char
__user
*
__user
*
argv
,
char
__user
*
__user
*
envp
,
struct
pt_regs
regs
)
{
{
long
error
;
long
error
;
char
*
filename
;
char
*
filename
;
...
@@ -550,7 +551,7 @@ asmlinkage long sys_fork(struct pt_regs regs)
...
@@ -550,7 +551,7 @@ asmlinkage long sys_fork(struct pt_regs regs)
return
do_fork
(
SIGCHLD
,
regs
.
rsp
,
&
regs
,
0
,
NULL
,
NULL
);
return
do_fork
(
SIGCHLD
,
regs
.
rsp
,
&
regs
,
0
,
NULL
,
NULL
);
}
}
asmlinkage
long
sys_clone
(
unsigned
long
clone_flags
,
unsigned
long
newsp
,
void
*
parent_tid
,
void
*
child_tid
,
struct
pt_regs
regs
)
asmlinkage
long
sys_clone
(
unsigned
long
clone_flags
,
unsigned
long
newsp
,
void
__user
*
parent_tid
,
void
__user
*
child_tid
,
struct
pt_regs
regs
)
{
{
if
(
!
newsp
)
if
(
!
newsp
)
newsp
=
regs
.
rsp
;
newsp
=
regs
.
rsp
;
...
@@ -664,7 +665,7 @@ long do_arch_prctl(struct task_struct *task, int code, unsigned long addr)
...
@@ -664,7 +665,7 @@ long do_arch_prctl(struct task_struct *task, int code, unsigned long addr)
rdmsrl
(
MSR_FS_BASE
,
base
);
rdmsrl
(
MSR_FS_BASE
,
base
);
}
else
}
else
base
=
task
->
thread
.
fs
;
base
=
task
->
thread
.
fs
;
ret
=
put_user
(
base
,
(
unsigned
long
*
)
addr
);
ret
=
put_user
(
base
,
(
unsigned
long
__user
*
)
addr
);
break
;
break
;
}
}
case
ARCH_GET_GS
:
{
case
ARCH_GET_GS
:
{
...
@@ -675,7 +676,7 @@ long do_arch_prctl(struct task_struct *task, int code, unsigned long addr)
...
@@ -675,7 +676,7 @@ long do_arch_prctl(struct task_struct *task, int code, unsigned long addr)
rdmsrl
(
MSR_KERNEL_GS_BASE
,
base
);
rdmsrl
(
MSR_KERNEL_GS_BASE
,
base
);
}
else
}
else
base
=
task
->
thread
.
gs
;
base
=
task
->
thread
.
gs
;
ret
=
put_user
(
base
,
(
unsigned
long
*
)
addr
);
ret
=
put_user
(
base
,
(
unsigned
long
__user
*
)
addr
);
break
;
break
;
}
}
...
...
arch/x86_64/kernel/ptrace.c
View file @
7c3f26b7
...
@@ -232,7 +232,7 @@ asmlinkage long sys_ptrace(long request, long pid, unsigned long addr, long data
...
@@ -232,7 +232,7 @@ asmlinkage long sys_ptrace(long request, long pid, unsigned long addr, long data
ret
=
-
EIO
;
ret
=
-
EIO
;
if
(
copied
!=
sizeof
(
tmp
))
if
(
copied
!=
sizeof
(
tmp
))
break
;
break
;
ret
=
put_user
(
tmp
,(
unsigned
long
*
)
data
);
ret
=
put_user
(
tmp
,(
unsigned
long
__user
*
)
data
);
break
;
break
;
}
}
...
@@ -271,7 +271,7 @@ asmlinkage long sys_ptrace(long request, long pid, unsigned long addr, long data
...
@@ -271,7 +271,7 @@ asmlinkage long sys_ptrace(long request, long pid, unsigned long addr, long data
tmp
=
0
;
tmp
=
0
;
break
;
break
;
}
}
ret
=
put_user
(
tmp
,(
unsigned
long
*
)
data
);
ret
=
put_user
(
tmp
,(
unsigned
long
__user
*
)
data
);
break
;
break
;
}
}
...
@@ -360,19 +360,20 @@ asmlinkage long sys_ptrace(long request, long pid, unsigned long addr, long data
...
@@ -360,19 +360,20 @@ asmlinkage long sys_ptrace(long request, long pid, unsigned long addr, long data
don't use it against 64bit processes, use
don't use it against 64bit processes, use
PTRACE_ARCH_PRCTL instead. */
PTRACE_ARCH_PRCTL instead. */
case
PTRACE_SET_THREAD_AREA
:
{
case
PTRACE_SET_THREAD_AREA
:
{
struct
user_desc
__user
*
p
;
int
old
;
int
old
;
get_user
(
old
,
&
((
struct
user_desc
*
)
data
)
->
entry_number
);
p
=
(
struct
user_desc
__user
*
)
data
;
put_user
(
addr
,
&
((
struct
user_desc
*
)
data
)
->
entry_number
);
get_user
(
old
,
&
p
->
entry_number
);
ret
=
do_set_thread_area
(
&
child
->
thread
,
put_user
(
addr
,
&
p
->
entry_number
);
(
struct
user_desc
*
)
data
);
ret
=
do_set_thread_area
(
&
child
->
thread
,
p
);
put_user
(
old
,
&
((
struct
user_desc
*
)
data
)
->
entry_number
);
put_user
(
old
,
&
p
->
entry_number
);
break
;
break
;
case
PTRACE_GET_THREAD_AREA
:
case
PTRACE_GET_THREAD_AREA
:
get_user
(
old
,
&
((
struct
user_desc
*
)
data
)
->
entry_number
);
p
=
(
struct
user_desc
__user
*
)
data
;
put_user
(
addr
,
&
((
struct
user_desc
*
)
data
)
->
entry_number
);
get_user
(
old
,
&
p
->
entry_number
);
ret
=
do_get_thread_area
(
&
child
->
thread
,
put_user
(
addr
,
&
p
->
entry_number
);
(
struct
user_desc
*
)
data
);
ret
=
do_get_thread_area
(
&
child
->
thread
,
p
);
put_user
(
old
,
&
((
struct
user_desc
*
)
data
)
->
entry_number
);
put_user
(
old
,
&
p
->
entry_number
);
break
;
break
;
}
}
#endif
#endif
...
@@ -428,12 +429,12 @@ asmlinkage long sys_ptrace(long request, long pid, unsigned long addr, long data
...
@@ -428,12 +429,12 @@ asmlinkage long sys_ptrace(long request, long pid, unsigned long addr, long data
break
;
break
;
case
PTRACE_GETREGS
:
{
/* Get all gp regs from the child. */
case
PTRACE_GETREGS
:
{
/* Get all gp regs from the child. */
if
(
!
access_ok
(
VERIFY_WRITE
,
(
unsigned
*
)
data
,
FRAME_SIZE
))
{
if
(
!
access_ok
(
VERIFY_WRITE
,
(
unsigned
__user
*
)
data
,
FRAME_SIZE
))
{
ret
=
-
EIO
;
ret
=
-
EIO
;
break
;
break
;
}
}
for
(
ui
=
0
;
ui
<
sizeof
(
struct
user_regs_struct
);
ui
+=
sizeof
(
long
))
{
for
(
ui
=
0
;
ui
<
sizeof
(
struct
user_regs_struct
);
ui
+=
sizeof
(
long
))
{
__put_user
(
getreg
(
child
,
ui
),(
unsigned
long
*
)
data
);
__put_user
(
getreg
(
child
,
ui
),(
unsigned
long
__user
*
)
data
);
data
+=
sizeof
(
long
);
data
+=
sizeof
(
long
);
}
}
ret
=
0
;
ret
=
0
;
...
@@ -442,12 +443,12 @@ asmlinkage long sys_ptrace(long request, long pid, unsigned long addr, long data
...
@@ -442,12 +443,12 @@ asmlinkage long sys_ptrace(long request, long pid, unsigned long addr, long data
case
PTRACE_SETREGS
:
{
/* Set all gp regs in the child. */
case
PTRACE_SETREGS
:
{
/* Set all gp regs in the child. */
unsigned
long
tmp
;
unsigned
long
tmp
;
if
(
!
access_ok
(
VERIFY_READ
,
(
unsigned
*
)
data
,
FRAME_SIZE
))
{
if
(
!
access_ok
(
VERIFY_READ
,
(
unsigned
__user
*
)
data
,
FRAME_SIZE
))
{
ret
=
-
EIO
;
ret
=
-
EIO
;
break
;
break
;
}
}
for
(
ui
=
0
;
ui
<
sizeof
(
struct
user_regs_struct
);
ui
+=
sizeof
(
long
))
{
for
(
ui
=
0
;
ui
<
sizeof
(
struct
user_regs_struct
);
ui
+=
sizeof
(
long
))
{
__get_user
(
tmp
,
(
unsigned
long
*
)
data
);
__get_user
(
tmp
,
(
unsigned
long
__user
*
)
data
);
putreg
(
child
,
ui
,
tmp
);
putreg
(
child
,
ui
,
tmp
);
data
+=
sizeof
(
long
);
data
+=
sizeof
(
long
);
}
}
...
@@ -456,23 +457,23 @@ asmlinkage long sys_ptrace(long request, long pid, unsigned long addr, long data
...
@@ -456,23 +457,23 @@ asmlinkage long sys_ptrace(long request, long pid, unsigned long addr, long data
}
}
case
PTRACE_GETFPREGS
:
{
/* Get the child extended FPU state. */
case
PTRACE_GETFPREGS
:
{
/* Get the child extended FPU state. */
if
(
!
access_ok
(
VERIFY_WRITE
,
(
unsigned
*
)
data
,
if
(
!
access_ok
(
VERIFY_WRITE
,
(
unsigned
__user
*
)
data
,
sizeof
(
struct
user_i387_struct
)))
{
sizeof
(
struct
user_i387_struct
)))
{
ret
=
-
EIO
;
ret
=
-
EIO
;
break
;
break
;
}
}
ret
=
get_fpregs
((
struct
user_i387_struct
*
)
data
,
child
);
ret
=
get_fpregs
((
struct
user_i387_struct
__user
*
)
data
,
child
);
break
;
break
;
}
}
case
PTRACE_SETFPREGS
:
{
/* Set the child extended FPU state. */
case
PTRACE_SETFPREGS
:
{
/* Set the child extended FPU state. */
if
(
!
access_ok
(
VERIFY_READ
,
(
unsigned
*
)
data
,
if
(
!
access_ok
(
VERIFY_READ
,
(
unsigned
__user
*
)
data
,
sizeof
(
struct
user_i387_struct
)))
{
sizeof
(
struct
user_i387_struct
)))
{
ret
=
-
EIO
;
ret
=
-
EIO
;
break
;
break
;
}
}
child
->
used_math
=
1
;
child
->
used_math
=
1
;
ret
=
set_fpregs
(
child
,
(
struct
user_i387_struct
*
)
data
);
ret
=
set_fpregs
(
child
,
(
struct
user_i387_struct
__user
*
)
data
);
break
;
break
;
}
}
...
...
arch/x86_64/kernel/signal.c
View file @
7c3f26b7
...
@@ -40,7 +40,7 @@ void ia32_setup_frame(int sig, struct k_sigaction *ka,
...
@@ -40,7 +40,7 @@ void ia32_setup_frame(int sig, struct k_sigaction *ka,
sigset_t
*
set
,
struct
pt_regs
*
regs
);
sigset_t
*
set
,
struct
pt_regs
*
regs
);
asmlinkage
long
asmlinkage
long
sys_rt_sigsuspend
(
sigset_t
*
unewset
,
size_t
sigsetsize
,
struct
pt_regs
regs
)
sys_rt_sigsuspend
(
sigset_t
__user
*
unewset
,
size_t
sigsetsize
,
struct
pt_regs
regs
)
{
{
sigset_t
saveset
,
newset
;
sigset_t
saveset
,
newset
;
...
@@ -71,7 +71,7 @@ sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize, struct pt_regs regs)
...
@@ -71,7 +71,7 @@ sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize, struct pt_regs regs)
}
}
asmlinkage
long
asmlinkage
long
sys_sigaltstack
(
const
stack_t
*
uss
,
stack_t
*
uoss
,
struct
pt_regs
regs
)
sys_sigaltstack
(
const
stack_t
__user
*
uss
,
stack_t
__user
*
uoss
,
struct
pt_regs
regs
)
{
{
return
do_sigaltstack
(
uss
,
uoss
,
regs
.
rsp
);
return
do_sigaltstack
(
uss
,
uoss
,
regs
.
rsp
);
}
}
...
@@ -89,7 +89,7 @@ struct rt_sigframe
...
@@ -89,7 +89,7 @@ struct rt_sigframe
};
};
static
int
static
int
restore_sigcontext
(
struct
pt_regs
*
regs
,
struct
sigcontext
*
sc
,
unsigned
long
*
prax
)
restore_sigcontext
(
struct
pt_regs
*
regs
,
struct
sigcontext
__user
*
sc
,
unsigned
long
*
prax
)
{
{
unsigned
int
err
=
0
;
unsigned
int
err
=
0
;
...
@@ -117,7 +117,7 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext *sc, unsigned long *p
...
@@ -117,7 +117,7 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext *sc, unsigned long *p
}
}
{
{
struct
_fpstate
*
buf
;
struct
_fpstate
__user
*
buf
;
err
|=
__get_user
(
buf
,
&
sc
->
fpstate
);
err
|=
__get_user
(
buf
,
&
sc
->
fpstate
);
if
(
buf
)
{
if
(
buf
)
{
...
@@ -136,10 +136,11 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext *sc, unsigned long *p
...
@@ -136,10 +136,11 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext *sc, unsigned long *p
asmlinkage
long
sys_rt_sigreturn
(
struct
pt_regs
regs
)
asmlinkage
long
sys_rt_sigreturn
(
struct
pt_regs
regs
)
{
{
struct
rt_sigframe
*
frame
=
(
struct
rt_sigframe
*
)(
regs
.
rsp
-
8
)
;
struct
rt_sigframe
__user
*
frame
;
sigset_t
set
;
sigset_t
set
;
long
eax
;
long
eax
;
frame
=
(
struct
rt_sigframe
__user
*
)(
regs
.
rsp
-
8
);
if
(
verify_area
(
VERIFY_READ
,
frame
,
sizeof
(
*
frame
)))
{
if
(
verify_area
(
VERIFY_READ
,
frame
,
sizeof
(
*
frame
)))
{
goto
badframe
;
goto
badframe
;
}
}
...
@@ -176,7 +177,7 @@ asmlinkage long sys_rt_sigreturn(struct pt_regs regs)
...
@@ -176,7 +177,7 @@ asmlinkage long sys_rt_sigreturn(struct pt_regs regs)
*/
*/
static
inline
int
static
inline
int
setup_sigcontext
(
struct
sigcontext
*
sc
,
struct
pt_regs
*
regs
,
unsigned
long
mask
,
struct
task_struct
*
me
)
setup_sigcontext
(
struct
sigcontext
__user
*
sc
,
struct
pt_regs
*
regs
,
unsigned
long
mask
,
struct
task_struct
*
me
)
{
{
int
err
=
0
;
int
err
=
0
;
...
@@ -213,7 +214,7 @@ setup_sigcontext(struct sigcontext *sc, struct pt_regs *regs, unsigned long mask
...
@@ -213,7 +214,7 @@ setup_sigcontext(struct sigcontext *sc, struct pt_regs *regs, unsigned long mask
* Determine which stack to use..
* Determine which stack to use..
*/
*/
static
void
*
static
void
__user
*
get_stack
(
struct
k_sigaction
*
ka
,
struct
pt_regs
*
regs
,
unsigned
long
size
)
get_stack
(
struct
k_sigaction
*
ka
,
struct
pt_regs
*
regs
,
unsigned
long
size
)
{
{
unsigned
long
rsp
;
unsigned
long
rsp
;
...
@@ -228,20 +229,20 @@ get_stack(struct k_sigaction *ka, struct pt_regs *regs, unsigned long size)
...
@@ -228,20 +229,20 @@ get_stack(struct k_sigaction *ka, struct pt_regs *regs, unsigned long size)
rsp
=
current
->
sas_ss_sp
+
current
->
sas_ss_size
;
rsp
=
current
->
sas_ss_sp
+
current
->
sas_ss_size
;
}
}
return
(
void
*
)
round_down
(
rsp
-
size
,
16
);
return
(
void
__user
*
)
round_down
(
rsp
-
size
,
16
);
}
}
static
void
setup_rt_frame
(
int
sig
,
struct
k_sigaction
*
ka
,
siginfo_t
*
info
,
static
void
setup_rt_frame
(
int
sig
,
struct
k_sigaction
*
ka
,
siginfo_t
*
info
,
sigset_t
*
set
,
struct
pt_regs
*
regs
)
sigset_t
*
set
,
struct
pt_regs
*
regs
)
{
{
struct
rt_sigframe
*
frame
;
struct
rt_sigframe
__user
*
frame
;
struct
_fpstate
*
fp
=
NULL
;
struct
_fpstate
__user
*
fp
=
NULL
;
int
err
=
0
;
int
err
=
0
;
struct
task_struct
*
me
=
current
;
struct
task_struct
*
me
=
current
;
if
(
me
->
used_math
)
{
if
(
me
->
used_math
)
{
fp
=
get_stack
(
ka
,
regs
,
sizeof
(
struct
_fpstate
));
fp
=
get_stack
(
ka
,
regs
,
sizeof
(
struct
_fpstate
));
frame
=
(
void
*
)
round_down
((
u64
)
fp
-
sizeof
(
struct
rt_sigframe
),
16
)
-
8
;
frame
=
(
void
__user
*
)
round_down
((
u64
)
fp
-
sizeof
(
struct
rt_sigframe
),
16
)
-
8
;
if
(
!
access_ok
(
VERIFY_WRITE
,
fp
,
sizeof
(
struct
_fpstate
)))
{
if
(
!
access_ok
(
VERIFY_WRITE
,
fp
,
sizeof
(
struct
_fpstate
)))
{
goto
give_sigsegv
;
goto
give_sigsegv
;
...
@@ -470,7 +471,7 @@ void do_notify_resume(struct pt_regs *regs, sigset_t *oldset, __u32 thread_info_
...
@@ -470,7 +471,7 @@ void do_notify_resume(struct pt_regs *regs, sigset_t *oldset, __u32 thread_info_
do_signal
(
regs
,
oldset
);
do_signal
(
regs
,
oldset
);
}
}
void
signal_fault
(
struct
pt_regs
*
regs
,
void
*
frame
,
char
*
where
)
void
signal_fault
(
struct
pt_regs
*
regs
,
void
__user
*
frame
,
char
*
where
)
{
{
struct
task_struct
*
me
=
current
;
struct
task_struct
*
me
=
current
;
if
(
exception_trace
)
if
(
exception_trace
)
...
...
arch/x86_64/kernel/sys_x86_64.c
View file @
7c3f26b7
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
* sys_pipe() is the normal C calling standard for creating
* sys_pipe() is the normal C calling standard for creating
* a pipe. It's not the way Unix traditionally does this, though.
* a pipe. It's not the way Unix traditionally does this, though.
*/
*/
asmlinkage
long
sys_pipe
(
int
*
fildes
)
asmlinkage
long
sys_pipe
(
int
__user
*
fildes
)
{
{
int
fd
[
2
];
int
fd
[
2
];
int
error
;
int
error
;
...
@@ -142,7 +142,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
...
@@ -142,7 +142,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
}
}
}
}
asmlinkage
long
sys_uname
(
struct
new_utsname
*
name
)
asmlinkage
long
sys_uname
(
struct
new_utsname
__user
*
name
)
{
{
int
err
;
int
err
;
down_read
(
&
uts_sem
);
down_read
(
&
uts_sem
);
...
@@ -153,13 +153,13 @@ asmlinkage long sys_uname(struct new_utsname * name)
...
@@ -153,13 +153,13 @@ asmlinkage long sys_uname(struct new_utsname * name)
return
err
?
-
EFAULT
:
0
;
return
err
?
-
EFAULT
:
0
;
}
}
asmlinkage
long
wrap_sys_shmat
(
int
shmid
,
char
*
shmaddr
,
int
shmflg
)
asmlinkage
long
wrap_sys_shmat
(
int
shmid
,
char
__user
*
shmaddr
,
int
shmflg
)
{
{
unsigned
long
raddr
;
unsigned
long
raddr
;
return
do_shmat
(
shmid
,
shmaddr
,
shmflg
,
&
raddr
)
?:
(
long
)
raddr
;
return
do_shmat
(
shmid
,
shmaddr
,
shmflg
,
&
raddr
)
?:
(
long
)
raddr
;
}
}
asmlinkage
long
sys_time64
(
long
*
tloc
)
asmlinkage
long
sys_time64
(
long
__user
*
tloc
)
{
{
struct
timeval
now
;
struct
timeval
now
;
int
i
;
int
i
;
...
...
include/asm-x86_64/fpu32.h
View file @
7c3f26b7
...
@@ -3,8 +3,8 @@
...
@@ -3,8 +3,8 @@
struct
_fpstate_ia32
;
struct
_fpstate_ia32
;
int
restore_i387_ia32
(
struct
task_struct
*
tsk
,
struct
_fpstate_ia32
*
buf
,
int
fsave
);
int
restore_i387_ia32
(
struct
task_struct
*
tsk
,
struct
_fpstate_ia32
__user
*
buf
,
int
fsave
);
int
save_i387_ia32
(
struct
task_struct
*
tsk
,
struct
_fpstate_ia32
*
buf
,
int
save_i387_ia32
(
struct
task_struct
*
tsk
,
struct
_fpstate_ia32
__user
*
buf
,
struct
pt_regs
*
regs
,
int
fsave
);
struct
pt_regs
*
regs
,
int
fsave
);
#endif
#endif
include/asm-x86_64/i387.h
View file @
7c3f26b7
...
@@ -23,7 +23,7 @@ extern void fpu_init(void);
...
@@ -23,7 +23,7 @@ extern void fpu_init(void);
extern
unsigned
int
mxcsr_feature_mask
;
extern
unsigned
int
mxcsr_feature_mask
;
extern
void
mxcsr_feature_mask_init
(
void
);
extern
void
mxcsr_feature_mask_init
(
void
);
extern
void
init_fpu
(
struct
task_struct
*
child
);
extern
void
init_fpu
(
struct
task_struct
*
child
);
extern
int
save_i387
(
struct
_fpstate
*
buf
);
extern
int
save_i387
(
struct
_fpstate
__user
*
buf
);
static
inline
int
need_signal_i387
(
struct
task_struct
*
me
)
static
inline
int
need_signal_i387
(
struct
task_struct
*
me
)
{
{
...
@@ -57,10 +57,10 @@ static inline int need_signal_i387(struct task_struct *me)
...
@@ -57,10 +57,10 @@ static inline int need_signal_i387(struct task_struct *me)
/*
/*
* ptrace request handers...
* ptrace request handers...
*/
*/
extern
int
get_fpregs
(
struct
user_i387_struct
*
buf
,
extern
int
get_fpregs
(
struct
user_i387_struct
__user
*
buf
,
struct
task_struct
*
tsk
);
struct
task_struct
*
tsk
);
extern
int
set_fpregs
(
struct
task_struct
*
tsk
,
extern
int
set_fpregs
(
struct
task_struct
*
tsk
,
struct
user_i387_struct
*
buf
);
struct
user_i387_struct
__user
*
buf
);
/*
/*
* i387 state interaction
* i387 state interaction
...
@@ -93,7 +93,7 @@ static inline int restore_fpu_checking(struct i387_fxsave_struct *fx)
...
@@ -93,7 +93,7 @@ static inline int restore_fpu_checking(struct i387_fxsave_struct *fx)
return
err
;
return
err
;
}
}
static
inline
int
save_i387_checking
(
struct
i387_fxsave_struct
*
fx
)
static
inline
int
save_i387_checking
(
struct
i387_fxsave_struct
__user
*
fx
)
{
{
int
err
;
int
err
;
asm
volatile
(
"1: rex64 ; fxsave (%[fx])
\n\t
"
asm
volatile
(
"1: rex64 ; fxsave (%[fx])
\n\t
"
...
@@ -136,7 +136,7 @@ static inline void save_init_fpu( struct task_struct *tsk )
...
@@ -136,7 +136,7 @@ static inline void save_init_fpu( struct task_struct *tsk )
/*
/*
* This restores directly out of user space. Exceptions are handled.
* This restores directly out of user space. Exceptions are handled.
*/
*/
static
inline
int
restore_i387
(
struct
_fpstate
*
buf
)
static
inline
int
restore_i387
(
struct
_fpstate
__user
*
buf
)
{
{
return
restore_fpu_checking
((
struct
i387_fxsave_struct
*
)
buf
);
return
restore_fpu_checking
((
struct
i387_fxsave_struct
*
)
buf
);
}
}
...
...
include/asm-x86_64/ia32.h
View file @
7c3f26b7
...
@@ -168,8 +168,8 @@ struct ustat32 {
...
@@ -168,8 +168,8 @@ struct ustat32 {
#ifdef __KERNEL__
#ifdef __KERNEL__
struct
user_desc
;
struct
user_desc
;
struct
siginfo_t
;
struct
siginfo_t
;
int
do_get_thread_area
(
struct
thread_struct
*
t
,
struct
user_desc
*
u_
info
);
int
do_get_thread_area
(
struct
thread_struct
*
t
,
struct
user_desc
__user
*
info
);
int
do_set_thread_area
(
struct
thread_struct
*
t
,
struct
user_desc
*
u_
info
);
int
do_set_thread_area
(
struct
thread_struct
*
t
,
struct
user_desc
__user
*
info
);
int
ia32_child_tls
(
struct
task_struct
*
p
,
struct
pt_regs
*
childregs
);
int
ia32_child_tls
(
struct
task_struct
*
p
,
struct
pt_regs
*
childregs
);
int
ia32_copy_siginfo_from_user
(
siginfo_t
*
to
,
siginfo_t32
__user
*
from
);
int
ia32_copy_siginfo_from_user
(
siginfo_t
*
to
,
siginfo_t32
__user
*
from
);
int
ia32_copy_siginfo_to_user
(
siginfo_t32
__user
*
to
,
siginfo_t
*
from
);
int
ia32_copy_siginfo_to_user
(
siginfo_t32
__user
*
to
,
siginfo_t
*
from
);
...
...
include/asm-x86_64/ptrace.h
View file @
7c3f26b7
...
@@ -83,7 +83,7 @@ struct pt_regs {
...
@@ -83,7 +83,7 @@ struct pt_regs {
#if defined(__KERNEL__) && !defined(__ASSEMBLY__)
#if defined(__KERNEL__) && !defined(__ASSEMBLY__)
#define user_mode(regs) (!!((regs)->cs & 3))
#define user_mode(regs) (!!((regs)->cs & 3))
#define instruction_pointer(regs) ((regs)->rip)
#define instruction_pointer(regs) ((regs)->rip)
void
signal_fault
(
struct
pt_regs
*
regs
,
void
*
frame
,
char
*
where
);
void
signal_fault
(
struct
pt_regs
*
regs
,
void
__user
*
frame
,
char
*
where
);
enum
{
enum
{
EF_CF
=
0x00000001
,
EF_CF
=
0x00000001
,
...
...
include/asm-x86_64/sigcontext.h
View file @
7c3f26b7
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
#define _ASM_X86_64_SIGCONTEXT_H
#define _ASM_X86_64_SIGCONTEXT_H
#include <asm/types.h>
#include <asm/types.h>
#include <linux/compiler.h>
/* FXSAVE frame */
/* FXSAVE frame */
/* Note: reserved1/2 may someday contain valuable data. Always save/restore
/* Note: reserved1/2 may someday contain valuable data. Always save/restore
...
@@ -47,7 +48,7 @@ struct sigcontext {
...
@@ -47,7 +48,7 @@ struct sigcontext {
unsigned
long
trapno
;
unsigned
long
trapno
;
unsigned
long
oldmask
;
unsigned
long
oldmask
;
unsigned
long
cr2
;
unsigned
long
cr2
;
struct
_fpstate
*
fpstate
;
/* zero when no FPU context */
struct
_fpstate
__user
*
fpstate
;
/* zero when no FPU context */
unsigned
long
reserved1
[
8
];
unsigned
long
reserved1
[
8
];
};
};
...
...
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