Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
3968cf62
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
3968cf62
编写于
9月 03, 2017
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
get_compat_sigset()
similar to put_compat_sigset() Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
b8e8e1aa
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
28 addition
and
51 deletion
+28
-51
arch/sparc/kernel/sys_sparc32.c
arch/sparc/kernel/sys_sparc32.c
+1
-3
fs/eventpoll.c
fs/eventpoll.c
+1
-3
fs/select.c
fs/select.c
+2
-6
fs/signalfd.c
fs/signalfd.c
+1
-3
include/linux/compat.h
include/linux/compat.h
+1
-1
kernel/compat.c
kernel/compat.c
+16
-7
kernel/signal.c
kernel/signal.c
+4
-23
virt/kvm/kvm_main.c
virt/kvm/kvm_main.c
+2
-5
未找到文件。
arch/sparc/kernel/sys_sparc32.c
浏览文件 @
3968cf62
...
...
@@ -166,13 +166,11 @@ COMPAT_SYSCALL_DEFINE5(rt_sigaction, int, sig,
if
(
act
)
{
u32
u_handler
,
u_restorer
;
compat_sigset_t
set32
;
new_ka
.
ka_restorer
=
restorer
;
ret
=
get_user
(
u_handler
,
&
act
->
sa_handler
);
new_ka
.
sa
.
sa_handler
=
compat_ptr
(
u_handler
);
ret
|=
copy_from_user
(
&
set32
,
&
act
->
sa_mask
,
sizeof
(
compat_sigset_t
));
sigset_from_compat
(
&
new_ka
.
sa
.
sa_mask
,
&
set32
);
ret
|=
get_compat_sigset
(
&
new_ka
.
sa
.
sa_mask
,
&
act
->
sa_mask
);
ret
|=
get_user
(
new_ka
.
sa
.
sa_flags
,
&
act
->
sa_flags
);
ret
|=
get_user
(
u_restorer
,
&
act
->
sa_restorer
);
new_ka
.
sa
.
sa_restorer
=
compat_ptr
(
u_restorer
);
...
...
fs/eventpoll.c
浏览文件 @
3968cf62
...
...
@@ -2259,7 +2259,6 @@ COMPAT_SYSCALL_DEFINE6(epoll_pwait, int, epfd,
compat_size_t
,
sigsetsize
)
{
long
err
;
compat_sigset_t
csigmask
;
sigset_t
ksigmask
,
sigsaved
;
/*
...
...
@@ -2269,9 +2268,8 @@ COMPAT_SYSCALL_DEFINE6(epoll_pwait, int, epfd,
if
(
sigmask
)
{
if
(
sigsetsize
!=
sizeof
(
compat_sigset_t
))
return
-
EINVAL
;
if
(
copy_from_user
(
&
csigmask
,
sigmask
,
sizeof
(
csigmask
)
))
if
(
get_compat_sigset
(
&
ksigmask
,
sigmask
))
return
-
EFAULT
;
sigset_from_compat
(
&
ksigmask
,
&
csigmask
);
sigsaved
=
current
->
blocked
;
set_current_blocked
(
&
ksigmask
);
}
...
...
fs/select.c
浏览文件 @
3968cf62
...
...
@@ -1301,7 +1301,6 @@ static long do_compat_pselect(int n, compat_ulong_t __user *inp,
struct
compat_timespec
__user
*
tsp
,
compat_sigset_t
__user
*
sigmask
,
compat_size_t
sigsetsize
)
{
compat_sigset_t
ss32
;
sigset_t
ksigmask
,
sigsaved
;
struct
timespec64
ts
,
end_time
,
*
to
=
NULL
;
int
ret
;
...
...
@@ -1318,9 +1317,8 @@ static long do_compat_pselect(int n, compat_ulong_t __user *inp,
if
(
sigmask
)
{
if
(
sigsetsize
!=
sizeof
(
compat_sigset_t
))
return
-
EINVAL
;
if
(
copy_from_user
(
&
ss32
,
sigmask
,
sizeof
(
ss32
)
))
if
(
get_compat_sigset
(
&
ksigmask
,
sigmask
))
return
-
EFAULT
;
sigset_from_compat
(
&
ksigmask
,
&
ss32
);
sigdelsetmask
(
&
ksigmask
,
sigmask
(
SIGKILL
)
|
sigmask
(
SIGSTOP
));
sigprocmask
(
SIG_SETMASK
,
&
ksigmask
,
&
sigsaved
);
...
...
@@ -1369,7 +1367,6 @@ COMPAT_SYSCALL_DEFINE5(ppoll, struct pollfd __user *, ufds,
unsigned
int
,
nfds
,
struct
compat_timespec
__user
*
,
tsp
,
const
compat_sigset_t
__user
*
,
sigmask
,
compat_size_t
,
sigsetsize
)
{
compat_sigset_t
ss32
;
sigset_t
ksigmask
,
sigsaved
;
struct
timespec64
ts
,
end_time
,
*
to
=
NULL
;
int
ret
;
...
...
@@ -1386,9 +1383,8 @@ COMPAT_SYSCALL_DEFINE5(ppoll, struct pollfd __user *, ufds,
if
(
sigmask
)
{
if
(
sigsetsize
!=
sizeof
(
compat_sigset_t
))
return
-
EINVAL
;
if
(
copy_from_user
(
&
ss32
,
sigmask
,
sizeof
(
ss32
)
))
if
(
get_compat_sigset
(
&
ksigmask
,
sigmask
))
return
-
EFAULT
;
sigset_from_compat
(
&
ksigmask
,
&
ss32
);
sigdelsetmask
(
&
ksigmask
,
sigmask
(
SIGKILL
)
|
sigmask
(
SIGSTOP
));
sigprocmask
(
SIG_SETMASK
,
&
ksigmask
,
&
sigsaved
);
...
...
fs/signalfd.c
浏览文件 @
3968cf62
...
...
@@ -312,15 +312,13 @@ COMPAT_SYSCALL_DEFINE4(signalfd4, int, ufd,
compat_size_t
,
sigsetsize
,
int
,
flags
)
{
compat_sigset_t
ss32
;
sigset_t
tmp
;
sigset_t
__user
*
ksigmask
;
if
(
sigsetsize
!=
sizeof
(
compat_sigset_t
))
return
-
EINVAL
;
if
(
copy_from_user
(
&
ss32
,
sigmask
,
sizeof
(
ss32
)
))
if
(
get_compat_sigset
(
&
tmp
,
sigmask
))
return
-
EFAULT
;
sigset_from_compat
(
&
tmp
,
&
ss32
);
ksigmask
=
compat_alloc_user_space
(
sizeof
(
sigset_t
));
if
(
copy_to_user
(
ksigmask
,
&
tmp
,
sizeof
(
sigset_t
)))
return
-
EFAULT
;
...
...
include/linux/compat.h
浏览文件 @
3968cf62
...
...
@@ -450,7 +450,7 @@ asmlinkage long compat_sys_settimeofday(struct compat_timeval __user *tv,
asmlinkage
long
compat_sys_adjtimex
(
struct
compat_timex
__user
*
utp
);
extern
void
sigset_from_compat
(
sigset_t
*
set
,
const
compat_sigset_t
*
compat
);
extern
int
get_compat_sigset
(
sigset_t
*
set
,
const
compat_sigset_t
__user
*
compat
);
extern
int
put_compat_sigset
(
compat_sigset_t
__user
*
compat
,
const
sigset_t
*
set
,
unsigned
int
size
);
...
...
kernel/compat.c
浏览文件 @
3968cf62
...
...
@@ -467,17 +467,26 @@ long compat_put_bitmap(compat_ulong_t __user *umask, unsigned long *mask,
return
-
EFAULT
;
}
void
sigset_from_compat
(
sigset_t
*
set
,
const
compat_sigset_t
*
compat
)
int
get_compat_sigset
(
sigset_t
*
set
,
const
compat_sigset_t
__user
*
compat
)
{
#ifdef __BIG_ENDIAN
compat_sigset_t
v
;
if
(
copy_from_user
(
&
v
,
compat
,
sizeof
(
compat_sigset_t
)))
return
-
EFAULT
;
switch
(
_NSIG_WORDS
)
{
case
4
:
set
->
sig
[
3
]
=
compat
->
sig
[
6
]
|
(((
long
)
compat
->
sig
[
7
])
<<
32
);
case
3
:
set
->
sig
[
2
]
=
compat
->
sig
[
4
]
|
(((
long
)
compat
->
sig
[
5
])
<<
32
);
case
2
:
set
->
sig
[
1
]
=
compat
->
sig
[
2
]
|
(((
long
)
compat
->
sig
[
3
])
<<
32
);
case
1
:
set
->
sig
[
0
]
=
compat
->
sig
[
0
]
|
(((
long
)
compat
->
sig
[
1
])
<<
32
);
case
4
:
set
->
sig
[
3
]
=
v
.
sig
[
6
]
|
(((
long
)
v
.
sig
[
7
])
<<
32
);
case
3
:
set
->
sig
[
2
]
=
v
.
sig
[
4
]
|
(((
long
)
v
.
sig
[
5
])
<<
32
);
case
2
:
set
->
sig
[
1
]
=
v
.
sig
[
2
]
|
(((
long
)
v
.
sig
[
3
])
<<
32
);
case
1
:
set
->
sig
[
0
]
=
v
.
sig
[
0
]
|
(((
long
)
v
.
sig
[
1
])
<<
32
);
}
#else
if
(
copy_from_user
(
set
,
compat
,
sizeof
(
compat_sigset_t
)))
return
-
EFAULT
;
#endif
return
0
;
}
EXPORT_SYMBOL_GPL
(
sigset_from_compa
t
);
EXPORT_SYMBOL_GPL
(
get_compat_sigse
t
);
int
put_compat_sigset
(
compat_sigset_t
__user
*
compat
,
const
sigset_t
*
set
,
...
...
kernel/signal.c
浏览文件 @
3968cf62
...
...
@@ -2600,7 +2600,6 @@ SYSCALL_DEFINE4(rt_sigprocmask, int, how, sigset_t __user *, nset,
COMPAT_SYSCALL_DEFINE4
(
rt_sigprocmask
,
int
,
how
,
compat_sigset_t
__user
*
,
nset
,
compat_sigset_t
__user
*
,
oset
,
compat_size_t
,
sigsetsize
)
{
#ifdef __BIG_ENDIAN
sigset_t
old_set
=
current
->
blocked
;
/* XXX: Don't preclude handling different sized sigset_t's. */
...
...
@@ -2608,13 +2607,10 @@ COMPAT_SYSCALL_DEFINE4(rt_sigprocmask, int, how, compat_sigset_t __user *, nset,
return
-
EINVAL
;
if
(
nset
)
{
compat_sigset_t
new32
;
sigset_t
new_set
;
int
error
;
if
(
copy_from_user
(
&
new32
,
nset
,
sizeof
(
compat_sigset_t
)
))
if
(
get_compat_sigset
(
&
new_set
,
nset
))
return
-
EFAULT
;
sigset_from_compat
(
&
new_set
,
&
new32
);
sigdelsetmask
(
&
new_set
,
sigmask
(
SIGKILL
)
|
sigmask
(
SIGSTOP
));
error
=
sigprocmask
(
how
,
&
new_set
,
NULL
);
...
...
@@ -2622,10 +2618,6 @@ COMPAT_SYSCALL_DEFINE4(rt_sigprocmask, int, how, compat_sigset_t __user *, nset,
return
error
;
}
return
oset
?
put_compat_sigset
(
oset
,
&
old_set
,
sizeof
(
*
oset
))
:
0
;
#else
return
sys_rt_sigprocmask
(
how
,
(
sigset_t
__user
*
)
nset
,
(
sigset_t
__user
*
)
oset
,
sigsetsize
);
#endif
}
#endif
...
...
@@ -2908,7 +2900,6 @@ COMPAT_SYSCALL_DEFINE4(rt_sigtimedwait, compat_sigset_t __user *, uthese,
struct
compat_siginfo
__user
*
,
uinfo
,
struct
compat_timespec
__user
*
,
uts
,
compat_size_t
,
sigsetsize
)
{
compat_sigset_t
s32
;
sigset_t
s
;
struct
timespec
t
;
siginfo_t
info
;
...
...
@@ -2917,9 +2908,8 @@ COMPAT_SYSCALL_DEFINE4(rt_sigtimedwait, compat_sigset_t __user *, uthese,
if
(
sigsetsize
!=
sizeof
(
sigset_t
))
return
-
EINVAL
;
if
(
copy_from_user
(
&
s32
,
uthese
,
sizeof
(
compat_sigset_t
)
))
if
(
get_compat_sigset
(
&
s
,
uthese
))
return
-
EFAULT
;
sigset_from_compat
(
&
s
,
&
s32
);
if
(
uts
)
{
if
(
compat_get_timespec
(
&
t
,
uts
))
...
...
@@ -3450,18 +3440,16 @@ COMPAT_SYSCALL_DEFINE4(rt_sigaction, int, sig,
if
(
act
)
{
compat_uptr_t
handler
;
compat_sigset_t
mask
;
ret
=
get_user
(
handler
,
&
act
->
sa_handler
);
new_ka
.
sa
.
sa_handler
=
compat_ptr
(
handler
);
#ifdef __ARCH_HAS_SA_RESTORER
ret
|=
get_user
(
restorer
,
&
act
->
sa_restorer
);
new_ka
.
sa
.
sa_restorer
=
compat_ptr
(
restorer
);
#endif
ret
|=
copy_from_user
(
&
mask
,
&
act
->
sa_mask
,
sizeof
(
mask
)
);
ret
|=
get_compat_sigset
(
&
new_ka
.
sa
.
sa_mask
,
&
act
->
sa_mask
);
ret
|=
get_user
(
new_ka
.
sa
.
sa_flags
,
&
act
->
sa_flags
);
if
(
ret
)
return
-
EFAULT
;
sigset_from_compat
(
&
new_ka
.
sa
.
sa_mask
,
&
mask
);
}
ret
=
do_sigaction
(
sig
,
act
?
&
new_ka
:
NULL
,
oact
?
&
old_ka
:
NULL
);
...
...
@@ -3649,22 +3637,15 @@ SYSCALL_DEFINE2(rt_sigsuspend, sigset_t __user *, unewset, size_t, sigsetsize)
#ifdef CONFIG_COMPAT
COMPAT_SYSCALL_DEFINE2
(
rt_sigsuspend
,
compat_sigset_t
__user
*
,
unewset
,
compat_size_t
,
sigsetsize
)
{
#ifdef __BIG_ENDIAN
sigset_t
newset
;
compat_sigset_t
newset32
;
/* XXX: Don't preclude handling different sized sigset_t's. */
if
(
sigsetsize
!=
sizeof
(
sigset_t
))
return
-
EINVAL
;
if
(
copy_from_user
(
&
newset32
,
unewset
,
sizeof
(
compat_sigset_t
)
))
if
(
get_compat_sigset
(
&
newset
,
unewset
))
return
-
EFAULT
;
sigset_from_compat
(
&
newset
,
&
newset32
);
return
sigsuspend
(
&
newset
);
#else
/* on little-endian bitmaps don't care about granularity */
return
sys_rt_sigsuspend
((
sigset_t
__user
*
)
unewset
,
sigsetsize
);
#endif
}
#endif
...
...
virt/kvm/kvm_main.c
浏览文件 @
3968cf62
...
...
@@ -2724,7 +2724,6 @@ static long kvm_vcpu_compat_ioctl(struct file *filp,
case
KVM_SET_SIGNAL_MASK
:
{
struct
kvm_signal_mask
__user
*
sigmask_arg
=
argp
;
struct
kvm_signal_mask
kvm_sigmask
;
compat_sigset_t
csigset
;
sigset_t
sigset
;
if
(
argp
)
{
...
...
@@ -2733,13 +2732,11 @@ static long kvm_vcpu_compat_ioctl(struct file *filp,
sizeof
(
kvm_sigmask
)))
goto
out
;
r
=
-
EINVAL
;
if
(
kvm_sigmask
.
len
!=
sizeof
(
c
sigse
t
))
if
(
kvm_sigmask
.
len
!=
sizeof
(
c
ompat_sigset_
t
))
goto
out
;
r
=
-
EFAULT
;
if
(
copy_from_user
(
&
csigset
,
sigmask_arg
->
sigset
,
sizeof
(
csigset
)))
if
(
get_compat_sigset
(
&
sigset
,
(
void
*
)
sigmask_arg
->
sigset
))
goto
out
;
sigset_from_compat
(
&
sigset
,
&
csigset
);
r
=
kvm_vcpu_ioctl_set_sigmask
(
vcpu
,
&
sigset
);
}
else
r
=
kvm_vcpu_ioctl_set_sigmask
(
vcpu
,
NULL
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录