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
16f6d167
Commit
16f6d167
authored
May 09, 2003
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Annotate x86 system calls with user pointer annotations.
parent
2e8d11e9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
25 deletions
+26
-25
arch/i386/kernel/sys_i386.c
arch/i386/kernel/sys_i386.c
+23
-22
arch/i386/kernel/vm86.c
arch/i386/kernel/vm86.c
+3
-3
No files found.
arch/i386/kernel/sys_i386.c
View file @
16f6d167
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,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
int
sys_pipe
(
unsigned
long
*
fildes
)
asmlinkage
int
sys_pipe
(
unsigned
long
__user
*
fildes
)
{
{
int
fd
[
2
];
int
fd
[
2
];
int
error
;
int
error
;
...
@@ -88,7 +88,7 @@ struct mmap_arg_struct {
...
@@ -88,7 +88,7 @@ struct mmap_arg_struct {
unsigned
long
offset
;
unsigned
long
offset
;
};
};
asmlinkage
int
old_mmap
(
struct
mmap_arg_struct
*
arg
)
asmlinkage
int
old_mmap
(
struct
mmap_arg_struct
__user
*
arg
)
{
{
struct
mmap_arg_struct
a
;
struct
mmap_arg_struct
a
;
int
err
=
-
EFAULT
;
int
err
=
-
EFAULT
;
...
@@ -106,15 +106,15 @@ asmlinkage int old_mmap(struct mmap_arg_struct *arg)
...
@@ -106,15 +106,15 @@ asmlinkage int old_mmap(struct mmap_arg_struct *arg)
}
}
extern
asmlinkage
int
sys_select
(
int
,
fd_set
*
,
fd_set
*
,
fd_set
*
,
struct
timeval
*
);
extern
asmlinkage
int
sys_select
(
int
,
fd_set
__user
*
,
fd_set
__user
*
,
fd_set
__user
*
,
struct
timeval
__user
*
);
struct
sel_arg_struct
{
struct
sel_arg_struct
{
unsigned
long
n
;
unsigned
long
n
;
fd_set
*
inp
,
*
outp
,
*
exp
;
fd_set
__user
*
inp
,
*
outp
,
*
exp
;
struct
timeval
*
tvp
;
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
;
struct
sel_arg_struct
a
;
...
@@ -130,7 +130,7 @@ asmlinkage int old_select(struct sel_arg_struct *arg)
...
@@ -130,7 +130,7 @@ asmlinkage int old_select(struct sel_arg_struct *arg)
* This is really horribly ugly.
* This is really horribly ugly.
*/
*/
asmlinkage
int
sys_ipc
(
uint
call
,
int
first
,
int
second
,
asmlinkage
int
sys_ipc
(
uint
call
,
int
first
,
int
second
,
int
third
,
void
*
ptr
,
long
fifth
)
int
third
,
void
__user
*
ptr
,
long
fifth
)
{
{
int
version
,
ret
;
int
version
,
ret
;
...
@@ -139,10 +139,10 @@ asmlinkage int sys_ipc (uint call, int first, int second,
...
@@ -139,10 +139,10 @@ asmlinkage int sys_ipc (uint call, int first, int second,
switch
(
call
)
{
switch
(
call
)
{
case
SEMOP
:
case
SEMOP
:
return
sys_semtimedop
(
first
,
(
struct
sembuf
*
)
ptr
,
second
,
NULL
);
return
sys_semtimedop
(
first
,
(
struct
sembuf
__user
*
)
ptr
,
second
,
NULL
);
case
SEMTIMEDOP
:
case
SEMTIMEDOP
:
return
sys_semtimedop
(
first
,
(
struct
sembuf
*
)
ptr
,
second
,
return
sys_semtimedop
(
first
,
(
struct
sembuf
__user
*
)
ptr
,
second
,
(
const
struct
timespec
*
)
fifth
);
(
const
struct
timespec
__user
*
)
fifth
);
case
SEMGET
:
case
SEMGET
:
return
sys_semget
(
first
,
second
,
third
);
return
sys_semget
(
first
,
second
,
third
);
...
@@ -150,13 +150,13 @@ asmlinkage int sys_ipc (uint call, int first, int second,
...
@@ -150,13 +150,13 @@ asmlinkage int sys_ipc (uint call, int first, int second,
union
semun
fourth
;
union
semun
fourth
;
if
(
!
ptr
)
if
(
!
ptr
)
return
-
EINVAL
;
return
-
EINVAL
;
if
(
get_user
(
fourth
.
__pad
,
(
void
**
)
ptr
))
if
(
get_user
(
fourth
.
__pad
,
(
void
*
__user
*
)
ptr
))
return
-
EFAULT
;
return
-
EFAULT
;
return
sys_semctl
(
first
,
second
,
third
,
fourth
);
return
sys_semctl
(
first
,
second
,
third
,
fourth
);
}
}
case
MSGSND
:
case
MSGSND
:
return
sys_msgsnd
(
first
,
(
struct
msgbuf
*
)
ptr
,
return
sys_msgsnd
(
first
,
(
struct
msgbuf
__user
*
)
ptr
,
second
,
third
);
second
,
third
);
case
MSGRCV
:
case
MSGRCV
:
switch
(
version
)
{
switch
(
version
)
{
...
@@ -166,7 +166,7 @@ asmlinkage int sys_ipc (uint call, int first, int second,
...
@@ -166,7 +166,7 @@ asmlinkage int sys_ipc (uint call, int first, int second,
return
-
EINVAL
;
return
-
EINVAL
;
if
(
copy_from_user
(
&
tmp
,
if
(
copy_from_user
(
&
tmp
,
(
struct
ipc_kludge
*
)
ptr
,
(
struct
ipc_kludge
__user
*
)
ptr
,
sizeof
(
tmp
)))
sizeof
(
tmp
)))
return
-
EFAULT
;
return
-
EFAULT
;
return
sys_msgrcv
(
first
,
tmp
.
msgp
,
second
,
return
sys_msgrcv
(
first
,
tmp
.
msgp
,
second
,
...
@@ -174,35 +174,36 @@ asmlinkage int sys_ipc (uint call, int first, int second,
...
@@ -174,35 +174,36 @@ asmlinkage int sys_ipc (uint call, int first, int second,
}
}
default:
default:
return
sys_msgrcv
(
first
,
return
sys_msgrcv
(
first
,
(
struct
msgbuf
*
)
ptr
,
(
struct
msgbuf
__user
*
)
ptr
,
second
,
fifth
,
third
);
second
,
fifth
,
third
);
}
}
case
MSGGET
:
case
MSGGET
:
return
sys_msgget
((
key_t
)
first
,
second
);
return
sys_msgget
((
key_t
)
first
,
second
);
case
MSGCTL
:
case
MSGCTL
:
return
sys_msgctl
(
first
,
second
,
(
struct
msqid_ds
*
)
ptr
);
return
sys_msgctl
(
first
,
second
,
(
struct
msqid_ds
__user
*
)
ptr
);
case
SHMAT
:
case
SHMAT
:
switch
(
version
)
{
switch
(
version
)
{
default:
{
default:
{
ulong
raddr
;
ulong
raddr
;
ret
=
sys_shmat
(
first
,
(
char
*
)
ptr
,
second
,
&
raddr
);
ret
=
sys_shmat
(
first
,
(
char
__user
*
)
ptr
,
second
,
&
raddr
);
if
(
ret
)
if
(
ret
)
return
ret
;
return
ret
;
return
put_user
(
raddr
,
(
ulong
*
)
third
);
return
put_user
(
raddr
,
(
ulong
__user
*
)
third
);
}
}
case
1
:
/* iBCS2 emulator entry point */
case
1
:
/* iBCS2 emulator entry point */
if
(
!
segment_eq
(
get_fs
(),
get_ds
()))
if
(
!
segment_eq
(
get_fs
(),
get_ds
()))
return
-
EINVAL
;
return
-
EINVAL
;
return
sys_shmat
(
first
,
(
char
*
)
ptr
,
second
,
(
ulong
*
)
third
);
/* The "(ulong *) third" is valid _only_ because of the kernel segment thing */
return
sys_shmat
(
first
,
(
char
__user
*
)
ptr
,
second
,
(
ulong
*
)
third
);
}
}
case
SHMDT
:
case
SHMDT
:
return
sys_shmdt
((
char
*
)
ptr
);
return
sys_shmdt
((
char
__user
*
)
ptr
);
case
SHMGET
:
case
SHMGET
:
return
sys_shmget
(
first
,
second
,
third
);
return
sys_shmget
(
first
,
second
,
third
);
case
SHMCTL
:
case
SHMCTL
:
return
sys_shmctl
(
first
,
second
,
return
sys_shmctl
(
first
,
second
,
(
struct
shmid_ds
*
)
ptr
);
(
struct
shmid_ds
__user
*
)
ptr
);
default:
default:
return
-
ENOSYS
;
return
-
ENOSYS
;
}
}
...
@@ -211,7 +212,7 @@ asmlinkage int sys_ipc (uint call, int first, int second,
...
@@ -211,7 +212,7 @@ asmlinkage int sys_ipc (uint call, int first, int second,
/*
/*
* Old cruft
* Old cruft
*/
*/
asmlinkage
int
sys_uname
(
struct
old_utsname
*
name
)
asmlinkage
int
sys_uname
(
struct
old_utsname
__user
*
name
)
{
{
int
err
;
int
err
;
if
(
!
name
)
if
(
!
name
)
...
@@ -222,7 +223,7 @@ asmlinkage int sys_uname(struct old_utsname * name)
...
@@ -222,7 +223,7 @@ asmlinkage int sys_uname(struct old_utsname * name)
return
err
?-
EFAULT
:
0
;
return
err
?-
EFAULT
:
0
;
}
}
asmlinkage
int
sys_olduname
(
struct
oldold_utsname
*
name
)
asmlinkage
int
sys_olduname
(
struct
oldold_utsname
__user
*
name
)
{
{
int
error
;
int
error
;
...
...
arch/i386/kernel/vm86.c
View file @
16f6d167
...
@@ -170,7 +170,7 @@ static void mark_screen_rdonly(struct task_struct * tsk)
...
@@ -170,7 +170,7 @@ static void mark_screen_rdonly(struct task_struct * tsk)
static
int
do_vm86_irq_handling
(
int
subfunction
,
int
irqnumber
);
static
int
do_vm86_irq_handling
(
int
subfunction
,
int
irqnumber
);
static
void
do_sys_vm86
(
struct
kernel_vm86_struct
*
info
,
struct
task_struct
*
tsk
);
static
void
do_sys_vm86
(
struct
kernel_vm86_struct
*
info
,
struct
task_struct
*
tsk
);
asmlinkage
int
sys_vm86old
(
struct
vm86_struct
*
v86
)
asmlinkage
int
sys_vm86old
(
struct
vm86_struct
__user
*
v86
)
{
{
struct
kernel_vm86_struct
info
;
/* declare this _on top_,
struct
kernel_vm86_struct
info
;
/* declare this _on top_,
* this avoids wasting of stack space.
* this avoids wasting of stack space.
...
@@ -199,7 +199,7 @@ asmlinkage int sys_vm86old(struct vm86_struct * v86)
...
@@ -199,7 +199,7 @@ asmlinkage int sys_vm86old(struct vm86_struct * v86)
}
}
asmlinkage
int
sys_vm86
(
unsigned
long
subfunction
,
struct
vm86plus_struct
*
v86
)
asmlinkage
int
sys_vm86
(
unsigned
long
subfunction
,
struct
vm86plus_struct
__user
*
v86
)
{
{
struct
kernel_vm86_struct
info
;
/* declare this _on top_,
struct
kernel_vm86_struct
info
;
/* declare this _on top_,
* this avoids wasting of stack space.
* this avoids wasting of stack space.
...
@@ -239,7 +239,7 @@ asmlinkage int sys_vm86(unsigned long subfunction, struct vm86plus_struct * v86)
...
@@ -239,7 +239,7 @@ asmlinkage int sys_vm86(unsigned long subfunction, struct vm86plus_struct * v86)
goto
out
;
goto
out
;
info
.
regs32
=
(
struct
pt_regs
*
)
&
subfunction
;
info
.
regs32
=
(
struct
pt_regs
*
)
&
subfunction
;
info
.
vm86plus
.
is_vm86pus
=
1
;
info
.
vm86plus
.
is_vm86pus
=
1
;
tsk
->
thread
.
vm86_info
=
(
struct
vm86_struct
*
)
v86
;
tsk
->
thread
.
vm86_info
=
(
struct
vm86_struct
__user
*
)
v86
;
do_sys_vm86
(
&
info
,
tsk
);
do_sys_vm86
(
&
info
,
tsk
);
ret
=
0
;
/* we never return here */
ret
=
0
;
/* we never return here */
out:
out:
...
...
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