Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
kernel_linux
提交
0e65a81b
K
kernel_linux
项目概览
OpenHarmony
/
kernel_linux
上一次同步 3 年多
通知
13
Star
8
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kernel_linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
0e65a81b
编写于
2月 03, 2013
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
get rid of compat_sys_semctl() and friends in case of ARCH_WANT_OLD_COMPAT_IPC
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
56e41d3c
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
73 addition
and
132 deletion
+73
-132
arch/mips/kernel/linux32.c
arch/mips/kernel/linux32.c
+0
-24
arch/mips/kernel/scall64-n32.S
arch/mips/kernel/scall64-n32.S
+3
-3
include/linux/compat.h
include/linux/compat.h
+4
-13
ipc/compat.c
ipc/compat.c
+66
-92
未找到文件。
arch/mips/kernel/linux32.c
浏览文件 @
0e65a81b
...
...
@@ -119,30 +119,6 @@ SYSCALL_DEFINE6(32_pwrite, unsigned int, fd, const char __user *, buf,
return
sys_pwrite64
(
fd
,
buf
,
count
,
merge_64
(
a4
,
a5
));
}
#ifdef CONFIG_MIPS32_N32
SYSCALL_DEFINE4
(
n32_semctl
,
int
,
semid
,
int
,
semnum
,
int
,
cmd
,
u32
,
arg
)
{
/* compat_sys_semctl expects a pointer to union semun */
u32
__user
*
uptr
=
compat_alloc_user_space
(
sizeof
(
u32
));
if
(
put_user
(
arg
,
uptr
))
return
-
EFAULT
;
return
compat_sys_semctl
(
semid
,
semnum
,
cmd
,
uptr
);
}
SYSCALL_DEFINE4
(
n32_msgsnd
,
int
,
msqid
,
u32
,
msgp
,
unsigned
int
,
msgsz
,
int
,
msgflg
)
{
return
compat_sys_msgsnd
(
msqid
,
msgsz
,
msgflg
,
compat_ptr
(
msgp
));
}
SYSCALL_DEFINE5
(
n32_msgrcv
,
int
,
msqid
,
u32
,
msgp
,
size_t
,
msgsz
,
int
,
msgtyp
,
int
,
msgflg
)
{
return
compat_sys_msgrcv
(
msqid
,
msgsz
,
msgtyp
,
msgflg
,
IPC_64
,
compat_ptr
(
msgp
));
}
#endif
SYSCALL_DEFINE1
(
32
_personality
,
unsigned
long
,
personality
)
{
unsigned
int
p
=
personality
&
0xffffffff
;
...
...
arch/mips/kernel/scall64-n32.S
浏览文件 @
0e65a81b
...
...
@@ -168,11 +168,11 @@ EXPORT(sysn32_call_table)
PTR
sys_newuname
PTR
sys_semget
PTR
sys_semop
PTR
sys_n32
_semctl
PTR
compat_sys
_semctl
PTR
sys_shmdt
/*
6065
*/
PTR
sys_msgget
PTR
sys_n32
_msgsnd
PTR
sys_n32
_msgrcv
PTR
compat_sys
_msgsnd
PTR
compat_sys
_msgrcv
PTR
compat_sys_msgctl
PTR
compat_sys_fcntl
/*
6070
*/
PTR
sys_flock
...
...
include/linux/compat.h
浏览文件 @
0e65a81b
...
...
@@ -311,22 +311,13 @@ asmlinkage long
compat_sys_get_robust_list
(
int
pid
,
compat_uptr_t
__user
*
head_ptr
,
compat_size_t
__user
*
len_ptr
);
#ifdef CONFIG_ARCH_WANT_OLD_COMPAT_IPC
long
compat_sys_semctl
(
int
first
,
int
second
,
int
third
,
void
__user
*
uptr
);
long
compat_sys_msgsnd
(
int
first
,
int
second
,
int
third
,
void
__user
*
uptr
);
long
compat_sys_msgrcv
(
int
first
,
int
second
,
int
msgtyp
,
int
third
,
int
version
,
void
__user
*
uptr
);
long
compat_sys_shmat
(
int
first
,
int
second
,
compat_uptr_t
third
,
int
version
,
void
__user
*
uptr
);
asmlinkage
long
compat_sys_ipc
(
u32
,
int
,
int
,
u32
,
compat_uptr_t
,
u32
);
#else
long
compat_sys_semctl
(
int
semid
,
int
semnum
,
int
cmd
,
int
arg
);
long
compat_sys_msgsnd
(
int
msqid
,
struct
compat_msgbuf
__user
*
msgp
,
asmlinkage
long
compat_sys_shmat
(
int
shmid
,
compat_uptr_t
shmaddr
,
int
shmflg
);
asmlinkage
long
compat_sys_semctl
(
int
semid
,
int
semnum
,
int
cmd
,
int
arg
);
asmlinkage
long
compat_sys_msgsnd
(
int
msqid
,
compat_uptr_t
msgp
,
compat_ssize_t
msgsz
,
int
msgflg
);
long
compat_sys_msgrcv
(
int
msqid
,
struct
compat_msgbuf
__user
*
msgp
,
asmlinkage
long
compat_sys_msgrcv
(
int
msqid
,
compat_uptr_t
msgp
,
compat_ssize_t
msgsz
,
long
msgtyp
,
int
msgflg
);
long
compat_sys_shmat
(
int
shmid
,
compat_uptr_t
shmaddr
,
int
shmflg
);
#endif
long
compat_sys_msgctl
(
int
first
,
int
second
,
void
__user
*
uptr
);
long
compat_sys_shmctl
(
int
first
,
int
second
,
void
__user
*
uptr
);
long
compat_sys_semtimedop
(
int
semid
,
struct
sembuf
__user
*
tsems
,
...
...
ipc/compat.c
浏览文件 @
0e65a81b
...
...
@@ -306,7 +306,7 @@ static long do_compat_semctl(int first, int second, int third, u32 pad)
return
err
;
}
long
compat_do_msg_fill
(
void
__user
*
dest
,
struct
msg_msg
*
msg
,
size_t
bufsz
)
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
;
...
...
@@ -320,59 +320,16 @@ long compat_do_msg_fill(void __user *dest, struct msg_msg *msg, size_t bufsz)
return
msgsz
;
}
#ifdef CONFIG_ARCH_WANT_OLD_COMPAT_IPC
long
compat_sys_semctl
(
int
first
,
int
second
,
int
third
,
void
__user
*
uptr
)
{
u32
pad
;
if
(
!
uptr
)
return
-
EINVAL
;
if
(
get_user
(
pad
,
(
u32
__user
*
)
uptr
))
return
-
EFAULT
;
return
do_compat_semctl
(
first
,
second
,
third
,
pad
);
}
long
compat_sys_msgsnd
(
int
first
,
int
second
,
int
third
,
void
__user
*
uptr
)
{
struct
compat_msgbuf
__user
*
up
=
uptr
;
long
type
;
if
(
first
<
0
)
return
-
EINVAL
;
if
(
second
<
0
)
return
-
EINVAL
;
if
(
get_user
(
type
,
&
up
->
mtype
))
return
-
EFAULT
;
return
do_msgsnd
(
first
,
type
,
up
->
mtext
,
second
,
third
);
}
long
compat_sys_msgrcv
(
int
first
,
int
second
,
int
msgtyp
,
int
third
,
int
version
,
void
__user
*
uptr
)
{
if
(
first
<
0
)
return
-
EINVAL
;
if
(
second
<
0
)
return
-
EINVAL
;
if
(
!
version
)
{
struct
compat_ipc_kludge
ipck
;
if
(
!
uptr
)
return
-
EINVAL
;
if
(
copy_from_user
(
&
ipck
,
uptr
,
sizeof
(
ipck
)))
return
-
EFAULT
;
uptr
=
compat_ptr
(
ipck
.
msgp
);
msgtyp
=
ipck
.
msgtyp
;
}
return
do_msgrcv
(
first
,
uptr
,
second
,
msgtyp
,
third
,
compat_do_msg_fill
);
}
#ifndef COMPAT_SHMLBA
#define COMPAT_SHMLBA SHMLBA
#endif
#ifdef CONFIG_ARCH_WANT_OLD_COMPAT_IPC
COMPAT_SYSCALL_DEFINE6
(
ipc
,
u32
,
call
,
int
,
first
,
int
,
second
,
u32
,
third
,
compat_uptr_t
,
ptr
,
u32
,
fifth
)
{
int
version
;
u32
pad
;
version
=
call
>>
16
;
/* hack for backward compatibility */
call
&=
0xffff
;
...
...
@@ -387,21 +344,59 @@ COMPAT_SYSCALL_DEFINE6(ipc, u32, call, int, first, int, second,
case
SEMGET
:
return
sys_semget
(
first
,
second
,
third
);
case
SEMCTL
:
return
compat_sys_semctl
(
first
,
second
,
third
,
compat_ptr
(
ptr
));
if
(
!
ptr
)
return
-
EINVAL
;
if
(
get_user
(
pad
,
(
u32
__user
*
)
compat_ptr
(
ptr
)))
return
-
EFAULT
;
return
do_compat_semctl
(
first
,
second
,
third
,
pad
);
case
MSGSND
:
{
struct
compat_msgbuf
__user
*
up
=
compat_ptr
(
ptr
);
compat_long_t
type
;
if
(
first
<
0
||
second
<
0
)
return
-
EINVAL
;
case
MSGSND
:
return
compat_sys_msgsnd
(
first
,
second
,
third
,
compat_ptr
(
ptr
));
case
MSGRCV
:
return
compat_sys_msgrcv
(
first
,
second
,
fifth
,
third
,
version
,
compat_ptr
(
ptr
));
if
(
get_user
(
type
,
&
up
->
mtype
))
return
-
EFAULT
;
return
do_msgsnd
(
first
,
type
,
up
->
mtext
,
second
,
third
);
}
case
MSGRCV
:
{
void
__user
*
uptr
=
compat_ptr
(
ptr
);
if
(
first
<
0
||
second
<
0
)
return
-
EINVAL
;
if
(
!
version
)
{
struct
compat_ipc_kludge
ipck
;
if
(
!
uptr
)
return
-
EINVAL
;
if
(
copy_from_user
(
&
ipck
,
uptr
,
sizeof
(
ipck
)))
return
-
EFAULT
;
uptr
=
compat_ptr
(
ipck
.
msgp
);
fifth
=
ipck
.
msgtyp
;
}
return
do_msgrcv
(
first
,
uptr
,
second
,
fifth
,
third
,
compat_do_msg_fill
);
}
case
MSGGET
:
return
sys_msgget
(
first
,
second
);
case
MSGCTL
:
return
compat_sys_msgctl
(
first
,
second
,
compat_ptr
(
ptr
));
case
SHMAT
:
return
compat_sys_shmat
(
first
,
second
,
third
,
version
,
compat_ptr
(
ptr
));
case
SHMAT
:
{
int
err
;
unsigned
long
raddr
;
if
(
version
==
1
)
return
-
EINVAL
;
err
=
do_shmat
(
first
,
compat_ptr
(
ptr
),
second
,
&
raddr
,
COMPAT_SHMLBA
);
if
(
err
<
0
)
return
err
;
return
put_user
(
raddr
,
(
compat_ulong_t
*
)
compat_ptr
(
third
));
}
case
SHMDT
:
return
sys_shmdt
(
compat_ptr
(
ptr
));
case
SHMGET
:
...
...
@@ -412,29 +407,30 @@ COMPAT_SYSCALL_DEFINE6(ipc, u32, call, int, first, int, second,
return
-
ENOSYS
;
}
#else
long
compat_sys_semctl
(
int
semid
,
int
semnum
,
int
cmd
,
int
arg
)
#endif
COMPAT_SYSCALL_DEFINE4
(
semctl
,
int
,
semid
,
int
,
semnum
,
int
,
cmd
,
int
,
arg
)
{
return
do_compat_semctl
(
semid
,
semnum
,
cmd
,
arg
);
}
long
compat_sys_msgsnd
(
int
msqid
,
struct
compat_msgbuf
__user
*
msgp
,
compat_ssize_t
msgsz
,
int
msgflg
)
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
,
&
msg
p
->
mtype
))
if
(
get_user
(
mtype
,
&
u
p
->
mtype
))
return
-
EFAULT
;
return
do_msgsnd
(
msqid
,
mtype
,
msg
p
->
mtext
,
(
ssize_t
)
msgsz
,
msgflg
);
return
do_msgsnd
(
msqid
,
mtype
,
u
p
->
mtext
,
(
ssize_t
)
msgsz
,
msgflg
);
}
long
compat_sys_msgrcv
(
int
msqid
,
struct
compat_msgbuf
__user
*
msgp
,
compat_ssize_t
msgsz
,
long
msgtyp
,
int
msgflg
)
COMPAT_SYSCALL_DEFINE5
(
msgrcv
,
int
,
msqid
,
compat_uptr_t
,
msgp
,
compat_ssize_t
,
msgsz
,
long
,
msgtyp
,
int
,
msgflg
)
{
return
do_msgrcv
(
msqid
,
msgp
,
(
ssize_t
)
msgsz
,
msgtyp
,
msgflg
,
compat_do_msg_fill
);
return
do_msgrcv
(
msqid
,
compat_ptr
(
msgp
),
(
ssize_t
)
msgsz
,
msgtyp
,
msgflg
,
compat_do_msg_fill
);
}
#endif
static
inline
int
get_compat_msqid64
(
struct
msqid64_ds
*
m64
,
struct
compat_msqid64_ds
__user
*
up64
)
...
...
@@ -552,28 +548,7 @@ long compat_sys_msgctl(int first, int second, void __user *uptr)
return
err
;
}
#ifndef COMPAT_SHMLBA
#define COMPAT_SHMLBA SHMLBA
#endif
#ifdef CONFIG_ARCH_WANT_OLD_COMPAT_IPC
long
compat_sys_shmat
(
int
first
,
int
second
,
compat_uptr_t
third
,
int
version
,
void
__user
*
uptr
)
{
int
err
;
unsigned
long
raddr
;
compat_ulong_t
__user
*
uaddr
;
if
(
version
==
1
)
return
-
EINVAL
;
err
=
do_shmat
(
first
,
uptr
,
second
,
&
raddr
,
COMPAT_SHMLBA
);
if
(
err
<
0
)
return
err
;
uaddr
=
compat_ptr
(
third
);
return
put_user
(
raddr
,
uaddr
);
}
#else
long
compat_sys_shmat
(
int
shmid
,
compat_uptr_t
shmaddr
,
int
shmflg
)
COMPAT_SYSCALL_DEFINE3
(
shmat
,
int
,
shmid
,
compat_uptr_t
,
shmaddr
,
int
,
shmflg
)
{
unsigned
long
ret
;
long
err
;
...
...
@@ -584,7 +559,6 @@ long compat_sys_shmat(int shmid, compat_uptr_t shmaddr, int shmflg)
force_successful_syscall_return
();
return
(
long
)
ret
;
}
#endif
static
inline
int
get_compat_shmid64_ds
(
struct
shmid64_ds
*
s64
,
struct
compat_shmid64_ds
__user
*
up64
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录