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
28327fae
Commit
28327fae
authored
Jul 09, 2017
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ipc: make use of compat ipc_perm helpers
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
c0ebccb6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
50 deletions
+8
-50
ipc/msg.c
ipc/msg.c
+4
-24
ipc/shm.c
ipc/shm.c
+4
-26
No files found.
ipc/msg.c
View file @
28327fae
...
@@ -591,22 +591,14 @@ static int copy_compat_msqid_from_user(struct msqid64_ds *out, void __user *buf,
...
@@ -591,22 +591,14 @@ static int copy_compat_msqid_from_user(struct msqid64_ds *out, void __user *buf,
memset
(
out
,
0
,
sizeof
(
*
out
));
memset
(
out
,
0
,
sizeof
(
*
out
));
if
(
version
==
IPC_64
)
{
if
(
version
==
IPC_64
)
{
struct
compat_msqid64_ds
*
p
=
buf
;
struct
compat_msqid64_ds
*
p
=
buf
;
struct
compat_ipc64_perm
v
;
if
(
get_compat_ipc64_perm
(
&
out
->
msg_perm
,
&
p
->
msg_perm
))
if
(
copy_from_user
(
&
v
,
&
p
->
msg_perm
,
sizeof
(
v
)))
return
-
EFAULT
;
return
-
EFAULT
;
out
->
msg_perm
.
uid
=
v
.
uid
;
out
->
msg_perm
.
gid
=
v
.
gid
;
out
->
msg_perm
.
mode
=
v
.
mode
;
if
(
get_user
(
out
->
msg_qbytes
,
&
p
->
msg_qbytes
))
if
(
get_user
(
out
->
msg_qbytes
,
&
p
->
msg_qbytes
))
return
-
EFAULT
;
return
-
EFAULT
;
}
else
{
}
else
{
struct
compat_msqid_ds
*
p
=
buf
;
struct
compat_msqid_ds
*
p
=
buf
;
struct
compat_ipc_perm
v
;
if
(
get_compat_ipc_perm
(
&
out
->
msg_perm
,
&
p
->
msg_perm
))
if
(
copy_from_user
(
&
v
,
&
p
->
msg_perm
,
sizeof
(
v
)))
return
-
EFAULT
;
return
-
EFAULT
;
out
->
msg_perm
.
uid
=
v
.
uid
;
out
->
msg_perm
.
gid
=
v
.
gid
;
out
->
msg_perm
.
mode
=
v
.
mode
;
if
(
get_user
(
out
->
msg_qbytes
,
&
p
->
msg_qbytes
))
if
(
get_user
(
out
->
msg_qbytes
,
&
p
->
msg_qbytes
))
return
-
EFAULT
;
return
-
EFAULT
;
}
}
...
@@ -619,13 +611,7 @@ static int copy_compat_msqid_to_user(void __user *buf, struct msqid64_ds *in,
...
@@ -619,13 +611,7 @@ static int copy_compat_msqid_to_user(void __user *buf, struct msqid64_ds *in,
if
(
version
==
IPC_64
)
{
if
(
version
==
IPC_64
)
{
struct
compat_msqid64_ds
v
;
struct
compat_msqid64_ds
v
;
memset
(
&
v
,
0
,
sizeof
(
v
));
memset
(
&
v
,
0
,
sizeof
(
v
));
v
.
msg_perm
.
key
=
in
->
msg_perm
.
key
;
to_compat_ipc64_perm
(
&
v
.
msg_perm
,
&
in
->
msg_perm
);
v
.
msg_perm
.
uid
=
in
->
msg_perm
.
uid
;
v
.
msg_perm
.
gid
=
in
->
msg_perm
.
gid
;
v
.
msg_perm
.
cuid
=
in
->
msg_perm
.
cuid
;
v
.
msg_perm
.
cgid
=
in
->
msg_perm
.
cgid
;
v
.
msg_perm
.
mode
=
in
->
msg_perm
.
mode
;
v
.
msg_perm
.
seq
=
in
->
msg_perm
.
seq
;
v
.
msg_stime
=
in
->
msg_stime
;
v
.
msg_stime
=
in
->
msg_stime
;
v
.
msg_rtime
=
in
->
msg_rtime
;
v
.
msg_rtime
=
in
->
msg_rtime
;
v
.
msg_ctime
=
in
->
msg_ctime
;
v
.
msg_ctime
=
in
->
msg_ctime
;
...
@@ -638,13 +624,7 @@ static int copy_compat_msqid_to_user(void __user *buf, struct msqid64_ds *in,
...
@@ -638,13 +624,7 @@ static int copy_compat_msqid_to_user(void __user *buf, struct msqid64_ds *in,
}
else
{
}
else
{
struct
compat_msqid_ds
v
;
struct
compat_msqid_ds
v
;
memset
(
&
v
,
0
,
sizeof
(
v
));
memset
(
&
v
,
0
,
sizeof
(
v
));
v
.
msg_perm
.
key
=
in
->
msg_perm
.
key
;
to_compat_ipc_perm
(
&
v
.
msg_perm
,
&
in
->
msg_perm
);
SET_UID
(
v
.
msg_perm
.
uid
,
in
->
msg_perm
.
uid
);
SET_GID
(
v
.
msg_perm
.
gid
,
in
->
msg_perm
.
gid
);
SET_UID
(
v
.
msg_perm
.
cuid
,
in
->
msg_perm
.
cuid
);
SET_GID
(
v
.
msg_perm
.
cgid
,
in
->
msg_perm
.
cgid
);
v
.
msg_perm
.
mode
=
in
->
msg_perm
.
mode
;
v
.
msg_perm
.
seq
=
in
->
msg_perm
.
seq
;
v
.
msg_stime
=
in
->
msg_stime
;
v
.
msg_stime
=
in
->
msg_stime
;
v
.
msg_rtime
=
in
->
msg_rtime
;
v
.
msg_rtime
=
in
->
msg_rtime
;
v
.
msg_ctime
=
in
->
msg_ctime
;
v
.
msg_ctime
=
in
->
msg_ctime
;
...
...
ipc/shm.c
View file @
28327fae
...
@@ -1161,13 +1161,7 @@ static int copy_compat_shmid_to_user(void __user *buf, struct shmid64_ds *in,
...
@@ -1161,13 +1161,7 @@ static int copy_compat_shmid_to_user(void __user *buf, struct shmid64_ds *in,
if
(
version
==
IPC_64
)
{
if
(
version
==
IPC_64
)
{
struct
compat_shmid64_ds
v
;
struct
compat_shmid64_ds
v
;
memset
(
&
v
,
0
,
sizeof
(
v
));
memset
(
&
v
,
0
,
sizeof
(
v
));
v
.
shm_perm
.
key
=
in
->
shm_perm
.
key
;
to_compat_ipc64_perm
(
&
v
.
shm_perm
,
&
in
->
shm_perm
);
v
.
shm_perm
.
uid
=
in
->
shm_perm
.
uid
;
v
.
shm_perm
.
gid
=
in
->
shm_perm
.
gid
;
v
.
shm_perm
.
cuid
=
in
->
shm_perm
.
cuid
;
v
.
shm_perm
.
cgid
=
in
->
shm_perm
.
cgid
;
v
.
shm_perm
.
mode
=
in
->
shm_perm
.
mode
;
v
.
shm_perm
.
seq
=
in
->
shm_perm
.
seq
;
v
.
shm_atime
=
in
->
shm_atime
;
v
.
shm_atime
=
in
->
shm_atime
;
v
.
shm_dtime
=
in
->
shm_dtime
;
v
.
shm_dtime
=
in
->
shm_dtime
;
v
.
shm_ctime
=
in
->
shm_ctime
;
v
.
shm_ctime
=
in
->
shm_ctime
;
...
@@ -1179,13 +1173,8 @@ static int copy_compat_shmid_to_user(void __user *buf, struct shmid64_ds *in,
...
@@ -1179,13 +1173,8 @@ static int copy_compat_shmid_to_user(void __user *buf, struct shmid64_ds *in,
}
else
{
}
else
{
struct
compat_shmid_ds
v
;
struct
compat_shmid_ds
v
;
memset
(
&
v
,
0
,
sizeof
(
v
));
memset
(
&
v
,
0
,
sizeof
(
v
));
to_compat_ipc_perm
(
&
v
.
shm_perm
,
&
in
->
shm_perm
);
v
.
shm_perm
.
key
=
in
->
shm_perm
.
key
;
v
.
shm_perm
.
key
=
in
->
shm_perm
.
key
;
SET_UID
(
v
.
shm_perm
.
uid
,
in
->
shm_perm
.
uid
);
SET_GID
(
v
.
shm_perm
.
gid
,
in
->
shm_perm
.
gid
);
SET_UID
(
v
.
shm_perm
.
cuid
,
in
->
shm_perm
.
cuid
);
SET_GID
(
v
.
shm_perm
.
cgid
,
in
->
shm_perm
.
cgid
);
v
.
shm_perm
.
mode
=
in
->
shm_perm
.
mode
;
v
.
shm_perm
.
seq
=
in
->
shm_perm
.
seq
;
v
.
shm_atime
=
in
->
shm_atime
;
v
.
shm_atime
=
in
->
shm_atime
;
v
.
shm_dtime
=
in
->
shm_dtime
;
v
.
shm_dtime
=
in
->
shm_dtime
;
v
.
shm_ctime
=
in
->
shm_ctime
;
v
.
shm_ctime
=
in
->
shm_ctime
;
...
@@ -1203,22 +1192,11 @@ static int copy_compat_shmid_from_user(struct shmid64_ds *out, void __user *buf,
...
@@ -1203,22 +1192,11 @@ static int copy_compat_shmid_from_user(struct shmid64_ds *out, void __user *buf,
memset
(
out
,
0
,
sizeof
(
*
out
));
memset
(
out
,
0
,
sizeof
(
*
out
));
if
(
version
==
IPC_64
)
{
if
(
version
==
IPC_64
)
{
struct
compat_shmid64_ds
*
p
=
buf
;
struct
compat_shmid64_ds
*
p
=
buf
;
struct
compat_ipc64_perm
v
;
return
get_compat_ipc64_perm
(
&
out
->
shm_perm
,
&
p
->
shm_perm
);
if
(
copy_from_user
(
&
v
,
&
p
->
shm_perm
,
sizeof
(
v
)))
return
-
EFAULT
;
out
->
shm_perm
.
uid
=
v
.
uid
;
out
->
shm_perm
.
gid
=
v
.
gid
;
out
->
shm_perm
.
mode
=
v
.
mode
;
}
else
{
}
else
{
struct
compat_shmid_ds
*
p
=
buf
;
struct
compat_shmid_ds
*
p
=
buf
;
struct
compat_ipc_perm
v
;
return
get_compat_ipc_perm
(
&
out
->
shm_perm
,
&
p
->
shm_perm
);
if
(
copy_from_user
(
&
v
,
&
p
->
shm_perm
,
sizeof
(
v
)))
return
-
EFAULT
;
out
->
shm_perm
.
uid
=
v
.
uid
;
out
->
shm_perm
.
gid
=
v
.
gid
;
out
->
shm_perm
.
mode
=
v
.
mode
;
}
}
return
0
;
}
}
COMPAT_SYSCALL_DEFINE3
(
shmctl
,
int
,
shmid
,
int
,
cmd
,
void
__user
*
,
uptr
)
COMPAT_SYSCALL_DEFINE3
(
shmctl
,
int
,
shmid
,
int
,
cmd
,
void
__user
*
,
uptr
)
...
...
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