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
9b1404c2
Commit
9b1404c2
authored
Jul 09, 2017
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msgrcv(2), msgsnd(2): move compat to native
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
20bc2a3a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
47 deletions
+43
-47
include/linux/msg.h
include/linux/msg.h
+0
-8
ipc/compat.c
ipc/compat.c
+0
-37
ipc/msg.c
ipc/msg.c
+43
-2
No files found.
include/linux/msg.h
View file @
9b1404c2
...
...
@@ -31,12 +31,4 @@ struct msg_queue {
struct
list_head
q_senders
;
};
/* Helper routines for sys_msgsnd and sys_msgrcv */
extern
long
do_msgsnd
(
int
msqid
,
long
mtype
,
void
__user
*
mtext
,
size_t
msgsz
,
int
msgflg
);
extern
long
do_msgrcv
(
int
msqid
,
void
__user
*
buf
,
size_t
bufsz
,
long
msgtyp
,
int
msgflg
,
long
(
*
msg_fill
)(
void
__user
*
,
struct
msg_msg
*
,
size_t
));
#endif
/* _LINUX_MSG_H */
ipc/compat.c
View file @
9b1404c2
...
...
@@ -34,11 +34,6 @@
#include "util.h"
struct
compat_msgbuf
{
compat_long_t
mtype
;
char
mtext
[
1
];
};
int
get_compat_ipc64_perm
(
struct
ipc64_perm
*
to
,
struct
compat_ipc64_perm
__user
*
from
)
{
...
...
@@ -85,38 +80,6 @@ void to_compat_ipc_perm(struct compat_ipc_perm *to, struct ipc64_perm *from)
to
->
seq
=
from
->
seq
;
}
static
long
compat_do_msg_fill
(
void
__user
*
dest
,
struct
msg_msg
*
msg
,
size_t
bufsz
)
{
struct
compat_msgbuf
__user
*
msgp
=
dest
;
size_t
msgsz
;
if
(
put_user
(
msg
->
m_type
,
&
msgp
->
mtype
))
return
-
EFAULT
;
msgsz
=
(
bufsz
>
msg
->
m_ts
)
?
msg
->
m_ts
:
bufsz
;
if
(
store_msg
(
msgp
->
mtext
,
msg
,
msgsz
))
return
-
EFAULT
;
return
msgsz
;
}
COMPAT_SYSCALL_DEFINE4
(
msgsnd
,
int
,
msqid
,
compat_uptr_t
,
msgp
,
compat_ssize_t
,
msgsz
,
int
,
msgflg
)
{
struct
compat_msgbuf
__user
*
up
=
compat_ptr
(
msgp
);
compat_long_t
mtype
;
if
(
get_user
(
mtype
,
&
up
->
mtype
))
return
-
EFAULT
;
return
do_msgsnd
(
msqid
,
mtype
,
up
->
mtext
,
(
ssize_t
)
msgsz
,
msgflg
);
}
COMPAT_SYSCALL_DEFINE5
(
msgrcv
,
int
,
msqid
,
compat_uptr_t
,
msgp
,
compat_ssize_t
,
msgsz
,
compat_long_t
,
msgtyp
,
int
,
msgflg
)
{
return
do_msgrcv
(
msqid
,
compat_ptr
(
msgp
),
(
ssize_t
)
msgsz
,
(
long
)
msgtyp
,
msgflg
,
compat_do_msg_fill
);
}
#ifndef COMPAT_SHMLBA
#define COMPAT_SHMLBA SHMLBA
#endif
...
...
ipc/msg.c
View file @
9b1404c2
...
...
@@ -730,7 +730,7 @@ static inline int pipelined_send(struct msg_queue *msq, struct msg_msg *msg,
return
0
;
}
long
do_msgsnd
(
int
msqid
,
long
mtype
,
void
__user
*
mtext
,
static
long
do_msgsnd
(
int
msqid
,
long
mtype
,
void
__user
*
mtext
,
size_t
msgsz
,
int
msgflg
)
{
struct
msg_queue
*
msq
;
...
...
@@ -853,6 +853,25 @@ SYSCALL_DEFINE4(msgsnd, int, msqid, struct msgbuf __user *, msgp, size_t, msgsz,
return
do_msgsnd
(
msqid
,
mtype
,
msgp
->
mtext
,
msgsz
,
msgflg
);
}
#ifdef CONFIG_COMPAT
struct
compat_msgbuf
{
compat_long_t
mtype
;
char
mtext
[
1
];
};
COMPAT_SYSCALL_DEFINE4
(
msgsnd
,
int
,
msqid
,
compat_uptr_t
,
msgp
,
compat_ssize_t
,
msgsz
,
int
,
msgflg
)
{
struct
compat_msgbuf
__user
*
up
=
compat_ptr
(
msgp
);
compat_long_t
mtype
;
if
(
get_user
(
mtype
,
&
up
->
mtype
))
return
-
EFAULT
;
return
do_msgsnd
(
msqid
,
mtype
,
up
->
mtext
,
(
ssize_t
)
msgsz
,
msgflg
);
}
#endif
static
inline
int
convert_mode
(
long
*
msgtyp
,
int
msgflg
)
{
if
(
msgflg
&
MSG_COPY
)
...
...
@@ -949,7 +968,7 @@ static struct msg_msg *find_msg(struct msg_queue *msq, long *msgtyp, int mode)
return
found
?:
ERR_PTR
(
-
EAGAIN
);
}
long
do_msgrcv
(
int
msqid
,
void
__user
*
buf
,
size_t
bufsz
,
long
msgtyp
,
int
msgflg
,
static
long
do_msgrcv
(
int
msqid
,
void
__user
*
buf
,
size_t
bufsz
,
long
msgtyp
,
int
msgflg
,
long
(
*
msg_handler
)(
void
__user
*
,
struct
msg_msg
*
,
size_t
))
{
int
mode
;
...
...
@@ -1113,6 +1132,28 @@ SYSCALL_DEFINE5(msgrcv, int, msqid, struct msgbuf __user *, msgp, size_t, msgsz,
return
do_msgrcv
(
msqid
,
msgp
,
msgsz
,
msgtyp
,
msgflg
,
do_msg_fill
);
}
#ifdef CONFIG_COMPAT
static
long
compat_do_msg_fill
(
void
__user
*
dest
,
struct
msg_msg
*
msg
,
size_t
bufsz
)
{
struct
compat_msgbuf
__user
*
msgp
=
dest
;
size_t
msgsz
;
if
(
put_user
(
msg
->
m_type
,
&
msgp
->
mtype
))
return
-
EFAULT
;
msgsz
=
(
bufsz
>
msg
->
m_ts
)
?
msg
->
m_ts
:
bufsz
;
if
(
store_msg
(
msgp
->
mtext
,
msg
,
msgsz
))
return
-
EFAULT
;
return
msgsz
;
}
COMPAT_SYSCALL_DEFINE5
(
msgrcv
,
int
,
msqid
,
compat_uptr_t
,
msgp
,
compat_ssize_t
,
msgsz
,
compat_long_t
,
msgtyp
,
int
,
msgflg
)
{
return
do_msgrcv
(
msqid
,
compat_ptr
(
msgp
),
(
ssize_t
)
msgsz
,
(
long
)
msgtyp
,
msgflg
,
compat_do_msg_fill
);
}
#endif
void
msg_init_ns
(
struct
ipc_namespace
*
ns
)
{
...
...
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