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
6819f2cb
Commit
6819f2cb
authored
Apr 17, 2004
by
Russell King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ARM] Add __user address space identifiers for sparse.
parent
859f08ee
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
65 additions
and
63 deletions
+65
-63
arch/arm/kernel/ptrace.c
arch/arm/kernel/ptrace.c
+10
-10
arch/arm/kernel/signal.c
arch/arm/kernel/signal.c
+16
-16
arch/arm/kernel/sys_arm.c
arch/arm/kernel/sys_arm.c
+22
-20
arch/arm/mm/alignment.c
arch/arm/mm/alignment.c
+2
-2
include/asm-arm/uaccess.h
include/asm-arm/uaccess.h
+15
-15
No files found.
arch/arm/kernel/ptrace.c
View file @
6819f2cb
...
...
@@ -526,7 +526,7 @@ core_initcall(ptrace_break_init);
* actually access the pt_regs stored on the kernel stack.
*/
static
int
ptrace_read_user
(
struct
task_struct
*
tsk
,
unsigned
long
off
,
unsigned
long
*
ret
)
unsigned
long
__user
*
ret
)
{
unsigned
long
tmp
;
...
...
@@ -559,7 +559,7 @@ static int ptrace_write_user(struct task_struct *tsk, unsigned long off,
/*
* Get all user integer registers.
*/
static
int
ptrace_getregs
(
struct
task_struct
*
tsk
,
void
*
uregs
)
static
int
ptrace_getregs
(
struct
task_struct
*
tsk
,
void
__user
*
uregs
)
{
struct
pt_regs
*
regs
=
get_user_regs
(
tsk
);
...
...
@@ -569,7 +569,7 @@ static int ptrace_getregs(struct task_struct *tsk, void *uregs)
/*
* Set all user integer registers.
*/
static
int
ptrace_setregs
(
struct
task_struct
*
tsk
,
void
*
uregs
)
static
int
ptrace_setregs
(
struct
task_struct
*
tsk
,
void
__user
*
uregs
)
{
struct
pt_regs
newregs
;
int
ret
;
...
...
@@ -591,7 +591,7 @@ static int ptrace_setregs(struct task_struct *tsk, void *uregs)
/*
* Get the child FPU state.
*/
static
int
ptrace_getfpregs
(
struct
task_struct
*
tsk
,
void
*
ufp
)
static
int
ptrace_getfpregs
(
struct
task_struct
*
tsk
,
void
__user
*
ufp
)
{
return
copy_to_user
(
ufp
,
&
tsk
->
thread_info
->
fpstate
,
sizeof
(
struct
user_fp
))
?
-
EFAULT
:
0
;
...
...
@@ -600,7 +600,7 @@ static int ptrace_getfpregs(struct task_struct *tsk, void *ufp)
/*
* Set the child FPU state.
*/
static
int
ptrace_setfpregs
(
struct
task_struct
*
tsk
,
void
*
ufp
)
static
int
ptrace_setfpregs
(
struct
task_struct
*
tsk
,
void
__user
*
ufp
)
{
struct
thread_info
*
thread
=
tsk
->
thread_info
;
thread
->
used_cp
[
1
]
=
thread
->
used_cp
[
2
]
=
1
;
...
...
@@ -628,7 +628,7 @@ static int do_ptrace(int request, struct task_struct *child, long addr, long dat
break
;
case
PTRACE_PEEKUSR
:
ret
=
ptrace_read_user
(
child
,
addr
,
(
unsigned
long
*
)
data
);
ret
=
ptrace_read_user
(
child
,
addr
,
(
unsigned
long
__user
*
)
data
);
break
;
/*
...
...
@@ -704,19 +704,19 @@ static int do_ptrace(int request, struct task_struct *child, long addr, long dat
break
;
case
PTRACE_GETREGS
:
ret
=
ptrace_getregs
(
child
,
(
void
*
)
data
);
ret
=
ptrace_getregs
(
child
,
(
void
__user
*
)
data
);
break
;
case
PTRACE_SETREGS
:
ret
=
ptrace_setregs
(
child
,
(
void
*
)
data
);
ret
=
ptrace_setregs
(
child
,
(
void
__user
*
)
data
);
break
;
case
PTRACE_GETFPREGS
:
ret
=
ptrace_getfpregs
(
child
,
(
void
*
)
data
);
ret
=
ptrace_getfpregs
(
child
,
(
void
__user
*
)
data
);
break
;
case
PTRACE_SETFPREGS
:
ret
=
ptrace_setfpregs
(
child
,
(
void
*
)
data
);
ret
=
ptrace_setfpregs
(
child
,
(
void
__user
*
)
data
);
break
;
default:
...
...
arch/arm/kernel/signal.c
View file @
6819f2cb
...
...
@@ -76,7 +76,7 @@ asmlinkage int sys_sigsuspend(int restart, unsigned long oldmask, old_sigset_t m
}
asmlinkage
int
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
;
...
...
@@ -104,8 +104,8 @@ sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize, struct pt_regs *regs)
}
asmlinkage
int
sys_sigaction
(
int
sig
,
const
struct
old_sigaction
*
act
,
struct
old_sigaction
*
oact
)
sys_sigaction
(
int
sig
,
const
struct
old_sigaction
__user
*
act
,
struct
old_sigaction
__user
*
oact
)
{
struct
k_sigaction
new_ka
,
old_ka
;
int
ret
;
...
...
@@ -147,15 +147,15 @@ struct sigframe
struct
rt_sigframe
{
struct
siginfo
*
pinfo
;
void
*
puc
;
struct
siginfo
__user
*
pinfo
;
void
__user
*
puc
;
struct
siginfo
info
;
struct
ucontext
uc
;
unsigned
long
retcode
;
};
static
int
restore_sigcontext
(
struct
pt_regs
*
regs
,
struct
sigcontext
*
sc
)
restore_sigcontext
(
struct
pt_regs
*
regs
,
struct
sigcontext
__user
*
sc
)
{
int
err
=
0
;
...
...
@@ -184,7 +184,7 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext *sc)
asmlinkage
int
sys_sigreturn
(
struct
pt_regs
*
regs
)
{
struct
sigframe
*
frame
;
struct
sigframe
__user
*
frame
;
sigset_t
set
;
/* Always make any pending restarted system calls return -EINTR */
...
...
@@ -198,7 +198,7 @@ asmlinkage int sys_sigreturn(struct pt_regs *regs)
if
(
regs
->
ARM_sp
&
7
)
goto
badframe
;
frame
=
(
struct
sigframe
*
)
regs
->
ARM_sp
;
frame
=
(
struct
sigframe
__user
*
)
regs
->
ARM_sp
;
if
(
verify_area
(
VERIFY_READ
,
frame
,
sizeof
(
*
frame
)))
goto
badframe
;
...
...
@@ -232,7 +232,7 @@ asmlinkage int sys_sigreturn(struct pt_regs *regs)
asmlinkage
int
sys_rt_sigreturn
(
struct
pt_regs
*
regs
)
{
struct
rt_sigframe
*
frame
;
struct
rt_sigframe
__user
*
frame
;
sigset_t
set
;
/* Always make any pending restarted system calls return -EINTR */
...
...
@@ -246,7 +246,7 @@ asmlinkage int sys_rt_sigreturn(struct pt_regs *regs)
if
(
regs
->
ARM_sp
&
7
)
goto
badframe
;
frame
=
(
struct
rt_sigframe
*
)
regs
->
ARM_sp
;
frame
=
(
struct
rt_sigframe
__user
*
)
regs
->
ARM_sp
;
if
(
verify_area
(
VERIFY_READ
,
frame
,
sizeof
(
*
frame
)))
goto
badframe
;
...
...
@@ -276,7 +276,7 @@ asmlinkage int sys_rt_sigreturn(struct pt_regs *regs)
}
static
int
setup_sigcontext
(
struct
sigcontext
*
sc
,
/*struct _fpstate *fpstate,*/
setup_sigcontext
(
struct
sigcontext
__user
*
sc
,
/*struct _fpstate *fpstate,*/
struct
pt_regs
*
regs
,
unsigned
long
mask
)
{
int
err
=
0
;
...
...
@@ -307,7 +307,7 @@ setup_sigcontext(struct sigcontext *sc, /*struct _fpstate *fpstate,*/
return
err
;
}
static
inline
void
*
static
inline
void
__user
*
get_sigframe
(
struct
k_sigaction
*
ka
,
struct
pt_regs
*
regs
,
int
framesize
)
{
unsigned
long
sp
=
regs
->
ARM_sp
;
...
...
@@ -321,12 +321,12 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, int framesize)
/*
* ATPCS B01 mandates 8-byte alignment
*/
return
(
void
*
)((
sp
-
framesize
)
&
~
7
);
return
(
void
__user
*
)((
sp
-
framesize
)
&
~
7
);
}
static
int
setup_return
(
struct
pt_regs
*
regs
,
struct
k_sigaction
*
ka
,
unsigned
long
*
rc
,
void
*
frame
,
int
usig
)
unsigned
long
__user
*
rc
,
void
__user
*
frame
,
int
usig
)
{
unsigned
long
handler
=
(
unsigned
long
)
ka
->
sa
.
sa_handler
;
unsigned
long
retcode
;
...
...
@@ -387,7 +387,7 @@ setup_return(struct pt_regs *regs, struct k_sigaction *ka,
static
int
setup_frame
(
int
usig
,
struct
k_sigaction
*
ka
,
sigset_t
*
set
,
struct
pt_regs
*
regs
)
{
struct
sigframe
*
frame
=
get_sigframe
(
ka
,
regs
,
sizeof
(
*
frame
));
struct
sigframe
__user
*
frame
=
get_sigframe
(
ka
,
regs
,
sizeof
(
*
frame
));
int
err
=
0
;
if
(
!
access_ok
(
VERIFY_WRITE
,
frame
,
sizeof
(
*
frame
)))
...
...
@@ -410,7 +410,7 @@ static int
setup_rt_frame
(
int
usig
,
struct
k_sigaction
*
ka
,
siginfo_t
*
info
,
sigset_t
*
set
,
struct
pt_regs
*
regs
)
{
struct
rt_sigframe
*
frame
=
get_sigframe
(
ka
,
regs
,
sizeof
(
*
frame
));
struct
rt_sigframe
__user
*
frame
=
get_sigframe
(
ka
,
regs
,
sizeof
(
*
frame
));
int
err
=
0
;
if
(
!
access_ok
(
VERIFY_WRITE
,
frame
,
sizeof
(
*
frame
)))
...
...
arch/arm/kernel/sys_arm.c
View file @
6819f2cb
...
...
@@ -37,7 +37,7 @@ extern unsigned long do_mremap(unsigned long addr, unsigned long old_len,
* sys_pipe() is the normal C calling standard for creating
* a pipe. It's not the way unix traditionally does this, though.
*/
asmlinkage
int
sys_pipe
(
unsigned
long
*
fildes
)
asmlinkage
int
sys_pipe
(
unsigned
long
__user
*
fildes
)
{
int
fd
[
2
];
int
error
;
...
...
@@ -94,7 +94,7 @@ struct mmap_arg_struct {
unsigned
long
offset
;
};
asmlinkage
int
old_mmap
(
struct
mmap_arg_struct
*
arg
)
asmlinkage
int
old_mmap
(
struct
mmap_arg_struct
__user
*
arg
)
{
int
error
=
-
EFAULT
;
struct
mmap_arg_struct
a
;
...
...
@@ -141,11 +141,11 @@ sys_arm_mremap(unsigned long addr, unsigned long old_len,
struct
sel_arg_struct
{
unsigned
long
n
;
fd_set
*
inp
,
*
outp
,
*
exp
;
struct
timeval
*
tvp
;
fd_set
__user
*
inp
,
*
outp
,
*
exp
;
struct
timeval
__user
*
tvp
;
};
asmlinkage
int
old_select
(
struct
sel_arg_struct
*
arg
)
asmlinkage
int
old_select
(
struct
sel_arg_struct
__user
*
arg
)
{
struct
sel_arg_struct
a
;
...
...
@@ -160,7 +160,8 @@ asmlinkage int old_select(struct sel_arg_struct *arg)
*
* This is really horribly ugly.
*/
asmlinkage
int
sys_ipc
(
uint
call
,
int
first
,
int
second
,
int
third
,
void
*
ptr
,
long
fifth
)
asmlinkage
int
sys_ipc
(
uint
call
,
int
first
,
int
second
,
int
third
,
void
__user
*
ptr
,
long
fifth
)
{
int
version
,
ret
;
...
...
@@ -169,28 +170,28 @@ asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr,
switch
(
call
)
{
case
SEMOP
:
return
sys_semop
(
first
,
(
struct
sembuf
*
)
ptr
,
second
);
return
sys_semop
(
first
,
(
struct
sembuf
__user
*
)
ptr
,
second
);
case
SEMGET
:
return
sys_semget
(
first
,
second
,
third
);
case
SEMCTL
:
{
union
semun
fourth
;
if
(
!
ptr
)
return
-
EINVAL
;
if
(
get_user
(
fourth
.
__pad
,
(
void
**
)
ptr
))
if
(
get_user
(
fourth
.
__pad
,
(
void
__user
**
)
ptr
))
return
-
EFAULT
;
return
sys_semctl
(
first
,
second
,
third
,
fourth
);
}
case
MSGSND
:
return
sys_msgsnd
(
first
,
(
struct
msgbuf
*
)
ptr
,
second
,
third
);
return
sys_msgsnd
(
first
,
(
struct
msgbuf
__user
*
)
ptr
,
second
,
third
);
case
MSGRCV
:
switch
(
version
)
{
case
0
:
{
struct
ipc_kludge
tmp
;
if
(
!
ptr
)
return
-
EINVAL
;
if
(
copy_from_user
(
&
tmp
,(
struct
ipc_kludge
*
)
ptr
,
if
(
copy_from_user
(
&
tmp
,(
struct
ipc_kludge
__user
*
)
ptr
,
sizeof
(
tmp
)))
return
-
EFAULT
;
return
sys_msgrcv
(
first
,
tmp
.
msgp
,
second
,
...
...
@@ -198,36 +199,36 @@ asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr,
}
default:
return
sys_msgrcv
(
first
,
(
struct
msgbuf
*
)
ptr
,
(
struct
msgbuf
__user
*
)
ptr
,
second
,
fifth
,
third
);
}
case
MSGGET
:
return
sys_msgget
((
key_t
)
first
,
second
);
case
MSGCTL
:
return
sys_msgctl
(
first
,
second
,
(
struct
msqid_ds
*
)
ptr
);
return
sys_msgctl
(
first
,
second
,
(
struct
msqid_ds
__user
*
)
ptr
);
case
SHMAT
:
switch
(
version
)
{
default:
{
ulong
raddr
;
ret
=
do_shmat
(
first
,
(
char
*
)
ptr
,
second
,
&
raddr
);
ret
=
do_shmat
(
first
,
(
char
__user
*
)
ptr
,
second
,
&
raddr
);
if
(
ret
)
return
ret
;
return
put_user
(
raddr
,
(
ulong
*
)
third
);
return
put_user
(
raddr
,
(
ulong
__user
*
)
third
);
}
case
1
:
/* iBCS2 emulator entry point */
if
(
!
segment_eq
(
get_fs
(),
get_ds
()))
return
-
EINVAL
;
return
do_shmat
(
first
,
(
cha
r
*
)
ptr
,
second
,
(
ulong
*
)
third
);
return
do_shmat
(
first
,
(
char
__use
r
*
)
ptr
,
second
,
(
ulong
__user
*
)
third
);
}
case
SHMDT
:
return
sys_shmdt
((
char
*
)
ptr
);
return
sys_shmdt
((
char
__user
*
)
ptr
);
case
SHMGET
:
return
sys_shmget
(
first
,
second
,
third
);
case
SHMCTL
:
return
sys_shmctl
(
first
,
second
,
(
struct
shmid_ds
*
)
ptr
);
(
struct
shmid_ds
__user
*
)
ptr
);
default:
return
-
ENOSYS
;
}
...
...
@@ -266,7 +267,8 @@ asmlinkage int sys_vfork(struct pt_regs *regs)
/* sys_execve() executes a new program.
* This is called indirectly via a small wrapper
*/
asmlinkage
int
sys_execve
(
char
*
filenamei
,
char
**
argv
,
char
**
envp
,
struct
pt_regs
*
regs
)
asmlinkage
int
sys_execve
(
char
__user
*
filenamei
,
char
__user
*
__user
*
argv
,
char
__user
*
__user
*
envp
,
struct
pt_regs
*
regs
)
{
int
error
;
char
*
filename
;
...
...
arch/arm/mm/alignment.c
View file @
6819f2cb
...
...
@@ -112,10 +112,10 @@ proc_alignment_read(char *page, char **start, off_t off, int count, int *eof,
return
len
;
}
static
int
proc_alignment_write
(
struct
file
*
file
,
const
char
*
buffer
,
static
int
proc_alignment_write
(
struct
file
*
file
,
const
char
__user
*
buffer
,
unsigned
long
count
,
void
*
data
)
{
int
mode
;
char
mode
;
if
(
count
>
0
)
{
if
(
get_user
(
mode
,
buffer
))
...
...
include/asm-arm/uaccess.h
View file @
6819f2cb
...
...
@@ -75,7 +75,7 @@ static inline void set_fs (mm_segment_t fs)
#define access_ok(type,addr,size) (__range_ok(addr,size) == 0)
static
inline
int
verify_area
(
int
type
,
const
void
*
addr
,
unsigned
long
size
)
static
inline
int
verify_area
(
int
type
,
const
void
__user
*
addr
,
unsigned
long
size
)
{
return
access_ok
(
type
,
addr
,
size
)
?
0
:
-
EFAULT
;
}
...
...
@@ -354,13 +354,13 @@ do { \
: "r" (x), "i" (-EFAULT) \
: "cc")
extern
unsigned
long
__arch_copy_from_user
(
void
*
to
,
const
void
*
from
,
unsigned
long
n
);
extern
unsigned
long
__arch_copy_to_user
(
void
*
to
,
const
void
*
from
,
unsigned
long
n
);
extern
unsigned
long
__arch_clear_user
(
void
*
addr
,
unsigned
long
n
);
extern
unsigned
long
__arch_strncpy_from_user
(
char
*
to
,
const
char
*
from
,
unsigned
long
count
);
extern
unsigned
long
__arch_strnlen_user
(
const
char
*
s
,
long
n
);
extern
unsigned
long
__arch_copy_from_user
(
void
*
to
,
const
void
__user
*
from
,
unsigned
long
n
);
extern
unsigned
long
__arch_copy_to_user
(
void
__user
*
to
,
const
void
*
from
,
unsigned
long
n
);
extern
unsigned
long
__arch_clear_user
(
void
__user
*
addr
,
unsigned
long
n
);
extern
unsigned
long
__arch_strncpy_from_user
(
char
*
to
,
const
char
__user
*
from
,
unsigned
long
count
);
extern
unsigned
long
__arch_strnlen_user
(
const
char
__user
*
s
,
long
n
);
static
__inline__
unsigned
long
copy_from_user
(
void
*
to
,
const
void
*
from
,
unsigned
long
n
)
static
inline
unsigned
long
copy_from_user
(
void
*
to
,
const
void
__user
*
from
,
unsigned
long
n
)
{
if
(
access_ok
(
VERIFY_READ
,
from
,
n
))
n
=
__arch_copy_from_user
(
to
,
from
,
n
);
...
...
@@ -369,36 +369,36 @@ static __inline__ unsigned long copy_from_user(void *to, const void *from, unsig
return
n
;
}
static
__inline__
unsigned
long
__copy_from_user
(
void
*
to
,
const
void
*
from
,
unsigned
long
n
)
static
inline
unsigned
long
__copy_from_user
(
void
*
to
,
const
void
__user
*
from
,
unsigned
long
n
)
{
return
__arch_copy_from_user
(
to
,
from
,
n
);
}
static
__inline__
unsigned
long
copy_to_user
(
void
*
to
,
const
void
*
from
,
unsigned
long
n
)
static
inline
unsigned
long
copy_to_user
(
void
__user
*
to
,
const
void
*
from
,
unsigned
long
n
)
{
if
(
access_ok
(
VERIFY_WRITE
,
to
,
n
))
n
=
__arch_copy_to_user
(
to
,
from
,
n
);
return
n
;
}
static
__inline__
unsigned
long
__copy_to_user
(
void
*
to
,
const
void
*
from
,
unsigned
long
n
)
static
inline
unsigned
long
__copy_to_user
(
void
__user
*
to
,
const
void
*
from
,
unsigned
long
n
)
{
return
__arch_copy_to_user
(
to
,
from
,
n
);
}
static
__inline__
unsigned
long
clear_user
(
void
*
to
,
unsigned
long
n
)
static
inline
unsigned
long
clear_user
(
void
__user
*
to
,
unsigned
long
n
)
{
if
(
access_ok
(
VERIFY_WRITE
,
to
,
n
))
n
=
__arch_clear_user
(
to
,
n
);
return
n
;
}
static
__inline__
unsigned
long
__clear_user
(
void
*
to
,
unsigned
long
n
)
static
inline
unsigned
long
__clear_user
(
void
__user
*
to
,
unsigned
long
n
)
{
return
__arch_clear_user
(
to
,
n
);
}
static
__inline__
long
strncpy_from_user
(
char
*
dst
,
const
cha
r
*
src
,
long
count
)
static
inline
long
strncpy_from_user
(
char
*
dst
,
const
char
__use
r
*
src
,
long
count
)
{
long
res
=
-
EFAULT
;
if
(
access_ok
(
VERIFY_READ
,
src
,
1
))
...
...
@@ -406,14 +406,14 @@ static __inline__ long strncpy_from_user (char *dst, const char *src, long count
return
res
;
}
static
__inline__
long
__strncpy_from_user
(
char
*
dst
,
const
cha
r
*
src
,
long
count
)
static
inline
long
__strncpy_from_user
(
char
*
dst
,
const
char
__use
r
*
src
,
long
count
)
{
return
__arch_strncpy_from_user
(
dst
,
src
,
count
);
}
#define strlen_user(s) strnlen_user(s, ~0UL >> 1)
static
inline
long
strnlen_user
(
const
char
*
s
,
long
n
)
static
inline
long
strnlen_user
(
const
char
__user
*
s
,
long
n
)
{
unsigned
long
res
=
0
;
...
...
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