Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
ea536ad4
cloud-kernel
项目概览
openanolis
/
cloud-kernel
大约 1 年 前同步成功
通知
158
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ea536ad4
编写于
12月 23, 2012
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
mips: switch to generic sigaltstack
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
c6489c14
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
20 addition
and
127 deletion
+20
-127
arch/mips/Kconfig
arch/mips/Kconfig
+1
-0
arch/mips/include/asm/compat.h
arch/mips/include/asm/compat.h
+8
-0
arch/mips/kernel/scall64-n32.S
arch/mips/kernel/scall64-n32.S
+1
-1
arch/mips/kernel/scall64-o32.S
arch/mips/kernel/scall64-o32.S
+1
-1
arch/mips/kernel/signal.c
arch/mips/kernel/signal.c
+3
-18
arch/mips/kernel/signal32.c
arch/mips/kernel/signal32.c
+3
-72
arch/mips/kernel/signal_n32.c
arch/mips/kernel/signal_n32.c
+3
-35
未找到文件。
arch/mips/Kconfig
浏览文件 @
ea536ad4
...
...
@@ -41,6 +41,7 @@ config MIPS
select HAVE_MOD_ARCH_SPECIFIC
select MODULES_USE_ELF_REL if MODULES
select MODULES_USE_ELF_RELA if MODULES && 64BIT
select GENERIC_SIGALTSTACK
menu "Machine selection"
...
...
arch/mips/include/asm/compat.h
浏览文件 @
ea536ad4
...
...
@@ -288,6 +288,14 @@ struct compat_shmid64_ds {
compat_ulong_t
__unused2
;
};
/* MIPS has unusual order of fields in stack_t */
typedef
struct
compat_sigaltstack
{
compat_uptr_t
ss_sp
;
compat_size_t
ss_size
;
int
ss_flags
;
}
compat_stack_t
;
#define compat_sigaltstack compat_sigaltstack
static
inline
int
is_compat_task
(
void
)
{
return
test_thread_flag
(
TIF_32BIT_ADDR
);
...
...
arch/mips/kernel/scall64-n32.S
浏览文件 @
ea536ad4
...
...
@@ -233,7 +233,7 @@ EXPORT(sysn32_call_table)
PTR
compat_sys_rt_sigtimedwait
PTR
sys_32_rt_sigqueueinfo
PTR
sysn32_rt_sigsuspend
PTR
sys32
_sigaltstack
PTR
compat_sys
_sigaltstack
PTR
compat_sys_utime
/*
6130
*/
PTR
sys_mknod
PTR
sys_32_personality
...
...
arch/mips/kernel/scall64-o32.S
浏览文件 @
ea536ad4
...
...
@@ -398,7 +398,7 @@ sys_call_table:
PTR
sys_getcwd
PTR
sys_capget
PTR
sys_capset
/*
4205
*/
PTR
sys32
_sigaltstack
PTR
compat_sys
_sigaltstack
PTR
sys_32_sendfile
PTR
sys_ni_syscall
PTR
sys_ni_syscall
...
...
arch/mips/kernel/signal.c
浏览文件 @
ea536ad4
...
...
@@ -313,15 +313,6 @@ SYSCALL_DEFINE3(sigaction, int, sig, const struct sigaction __user *, act,
}
#endif
asmlinkage
int
sys_sigaltstack
(
nabi_no_regargs
struct
pt_regs
regs
)
{
const
stack_t
__user
*
uss
=
(
const
stack_t
__user
*
)
regs
.
regs
[
4
];
stack_t
__user
*
uoss
=
(
stack_t
__user
*
)
regs
.
regs
[
5
];
unsigned
long
usp
=
regs
.
regs
[
29
];
return
do_sigaltstack
(
uss
,
uoss
,
usp
);
}
#ifdef CONFIG_TRAD_SIGNALS
asmlinkage
void
sys_sigreturn
(
nabi_no_regargs
struct
pt_regs
regs
)
{
...
...
@@ -378,9 +369,8 @@ asmlinkage void sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
else
if
(
sig
)
force_sig
(
sig
,
current
);
/* It is more difficult to avoid calling this function than to
call it and ignore errors. */
do_sigaltstack
(
&
frame
->
rs_uc
.
uc_stack
,
NULL
,
regs
.
regs
[
29
]);
if
(
restore_altstack
(
&
frame
->
rs_uc
.
uc_stack
))
goto
badframe
;
/*
* Don't let your children do this ...
...
...
@@ -457,12 +447,7 @@ static int setup_rt_frame(void *sig_return, struct k_sigaction *ka,
/* Create the ucontext. */
err
|=
__put_user
(
0
,
&
frame
->
rs_uc
.
uc_flags
);
err
|=
__put_user
(
NULL
,
&
frame
->
rs_uc
.
uc_link
);
err
|=
__put_user
((
void
__user
*
)
current
->
sas_ss_sp
,
&
frame
->
rs_uc
.
uc_stack
.
ss_sp
);
err
|=
__put_user
(
sas_ss_flags
(
regs
->
regs
[
29
]),
&
frame
->
rs_uc
.
uc_stack
.
ss_flags
);
err
|=
__put_user
(
current
->
sas_ss_size
,
&
frame
->
rs_uc
.
uc_stack
.
ss_size
);
err
|=
__save_altstack
(
&
frame
->
rs_uc
.
uc_stack
,
regs
->
regs
[
29
]);
err
|=
setup_sigcontext
(
regs
,
&
frame
->
rs_uc
.
uc_mcontext
);
err
|=
__copy_to_user
(
&
frame
->
rs_uc
.
uc_sigmask
,
set
,
sizeof
(
*
set
));
...
...
arch/mips/kernel/signal32.c
浏览文件 @
ea536ad4
...
...
@@ -61,17 +61,10 @@ struct sigaction32 {
compat_sigset_t
sa_mask
;
};
/* IRIX compatible stack_t */
typedef
struct
sigaltstack32
{
s32
ss_sp
;
compat_size_t
ss_size
;
int
ss_flags
;
}
stack32_t
;
struct
ucontext32
{
u32
uc_flags
;
s32
uc_link
;
stack32_t
uc_stack
;
compat_stack_t
uc_stack
;
struct
sigcontext32
uc_mcontext
;
compat_sigset_t
uc_sigmask
;
/* mask last for extensibility */
};
...
...
@@ -350,45 +343,6 @@ SYSCALL_DEFINE3(32_sigaction, long, sig, const struct sigaction32 __user *, act,
return
ret
;
}
asmlinkage
int
sys32_sigaltstack
(
nabi_no_regargs
struct
pt_regs
regs
)
{
const
stack32_t
__user
*
uss
=
(
const
stack32_t
__user
*
)
regs
.
regs
[
4
];
stack32_t
__user
*
uoss
=
(
stack32_t
__user
*
)
regs
.
regs
[
5
];
unsigned
long
usp
=
regs
.
regs
[
29
];
stack_t
kss
,
koss
;
int
ret
,
err
=
0
;
mm_segment_t
old_fs
=
get_fs
();
s32
sp
;
if
(
uss
)
{
if
(
!
access_ok
(
VERIFY_READ
,
uss
,
sizeof
(
*
uss
)))
return
-
EFAULT
;
err
|=
__get_user
(
sp
,
&
uss
->
ss_sp
);
kss
.
ss_sp
=
(
void
__user
*
)
(
long
)
sp
;
err
|=
__get_user
(
kss
.
ss_size
,
&
uss
->
ss_size
);
err
|=
__get_user
(
kss
.
ss_flags
,
&
uss
->
ss_flags
);
if
(
err
)
return
-
EFAULT
;
}
set_fs
(
KERNEL_DS
);
ret
=
do_sigaltstack
(
uss
?
(
stack_t
__user
*
)
&
kss
:
NULL
,
uoss
?
(
stack_t
__user
*
)
&
koss
:
NULL
,
usp
);
set_fs
(
old_fs
);
if
(
!
ret
&&
uoss
)
{
if
(
!
access_ok
(
VERIFY_WRITE
,
uoss
,
sizeof
(
*
uoss
)))
return
-
EFAULT
;
sp
=
(
int
)
(
unsigned
long
)
koss
.
ss_sp
;
err
|=
__put_user
(
sp
,
&
uoss
->
ss_sp
);
err
|=
__put_user
(
koss
.
ss_size
,
&
uoss
->
ss_size
);
err
|=
__put_user
(
koss
.
ss_flags
,
&
uoss
->
ss_flags
);
if
(
err
)
return
-
EFAULT
;
}
return
ret
;
}
int
copy_siginfo_to_user32
(
compat_siginfo_t
__user
*
to
,
siginfo_t
*
from
)
{
int
err
;
...
...
@@ -490,10 +444,7 @@ asmlinkage void sys32_sigreturn(nabi_no_regargs struct pt_regs regs)
asmlinkage
void
sys32_rt_sigreturn
(
nabi_no_regargs
struct
pt_regs
regs
)
{
struct
rt_sigframe32
__user
*
frame
;
mm_segment_t
old_fs
;
sigset_t
set
;
stack_t
st
;
s32
sp
;
int
sig
;
frame
=
(
struct
rt_sigframe32
__user
*
)
regs
.
regs
[
29
];
...
...
@@ -510,22 +461,9 @@ asmlinkage void sys32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
else
if
(
sig
)
force_sig
(
sig
,
current
);
/* The ucontext contains a stack32_t, so we must convert! */
if
(
__get_user
(
sp
,
&
frame
->
rs_uc
.
uc_stack
.
ss_sp
))
goto
badframe
;
st
.
ss_sp
=
(
void
__user
*
)(
long
)
sp
;
if
(
__get_user
(
st
.
ss_size
,
&
frame
->
rs_uc
.
uc_stack
.
ss_size
))
goto
badframe
;
if
(
__get_user
(
st
.
ss_flags
,
&
frame
->
rs_uc
.
uc_stack
.
ss_flags
))
if
(
compat_restore_altstack
(
&
frame
->
rs_uc
.
uc_stack
))
goto
badframe
;
/* It is more difficult to avoid calling this function than to
call it and ignore errors. */
old_fs
=
get_fs
();
set_fs
(
KERNEL_DS
);
do_sigaltstack
((
stack_t
__user
*
)
&
st
,
NULL
,
regs
.
regs
[
29
]);
set_fs
(
old_fs
);
/*
* Don't let your children do this ...
*/
...
...
@@ -590,7 +528,6 @@ static int setup_rt_frame_32(void *sig_return, struct k_sigaction *ka,
{
struct
rt_sigframe32
__user
*
frame
;
int
err
=
0
;
s32
sp
;
frame
=
get_sigframe
(
ka
,
regs
,
sizeof
(
*
frame
));
if
(
!
access_ok
(
VERIFY_WRITE
,
frame
,
sizeof
(
*
frame
)))
...
...
@@ -602,13 +539,7 @@ static int setup_rt_frame_32(void *sig_return, struct k_sigaction *ka,
/* Create the ucontext. */
err
|=
__put_user
(
0
,
&
frame
->
rs_uc
.
uc_flags
);
err
|=
__put_user
(
0
,
&
frame
->
rs_uc
.
uc_link
);
sp
=
(
int
)
(
long
)
current
->
sas_ss_sp
;
err
|=
__put_user
(
sp
,
&
frame
->
rs_uc
.
uc_stack
.
ss_sp
);
err
|=
__put_user
(
sas_ss_flags
(
regs
->
regs
[
29
]),
&
frame
->
rs_uc
.
uc_stack
.
ss_flags
);
err
|=
__put_user
(
current
->
sas_ss_size
,
&
frame
->
rs_uc
.
uc_stack
.
ss_size
);
err
|=
__compat_save_altstack
(
&
frame
->
rs_uc
.
uc_stack
,
regs
->
regs
[
29
]);
err
|=
setup_sigcontext32
(
regs
,
&
frame
->
rs_uc
.
uc_mcontext
);
err
|=
__copy_conv_sigset_to_user
(
&
frame
->
rs_uc
.
uc_sigmask
,
set
);
...
...
arch/mips/kernel/signal_n32.c
浏览文件 @
ea536ad4
...
...
@@ -50,18 +50,10 @@
extern
int
setup_sigcontext
(
struct
pt_regs
*
,
struct
sigcontext
__user
*
);
extern
int
restore_sigcontext
(
struct
pt_regs
*
,
struct
sigcontext
__user
*
);
/* IRIX compatible stack_t */
typedef
struct
sigaltstack32
{
s32
ss_sp
;
compat_size_t
ss_size
;
int
ss_flags
;
}
stack32_t
;
struct
ucontextn32
{
u32
uc_flags
;
s32
uc_link
;
stack32_t
uc_stack
;
compat_stack_t
uc_stack
;
struct
sigcontext
uc_mcontext
;
compat_sigset_t
uc_sigmask
;
/* mask last for extensibility */
};
...
...
@@ -97,10 +89,7 @@ asmlinkage int sysn32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
asmlinkage
void
sysn32_rt_sigreturn
(
nabi_no_regargs
struct
pt_regs
regs
)
{
struct
rt_sigframe_n32
__user
*
frame
;
mm_segment_t
old_fs
;
sigset_t
set
;
stack_t
st
;
s32
sp
;
int
sig
;
frame
=
(
struct
rt_sigframe_n32
__user
*
)
regs
.
regs
[
29
];
...
...
@@ -117,22 +106,8 @@ asmlinkage void sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
else
if
(
sig
)
force_sig
(
sig
,
current
);
/* The ucontext contains a stack32_t, so we must convert! */
if
(
__get_user
(
sp
,
&
frame
->
rs_uc
.
uc_stack
.
ss_sp
))
goto
badframe
;
st
.
ss_sp
=
(
void
__user
*
)(
long
)
sp
;
if
(
__get_user
(
st
.
ss_size
,
&
frame
->
rs_uc
.
uc_stack
.
ss_size
))
if
(
compat_restore_altstack
(
&
frame
->
rs_uc
.
uc_stack
))
goto
badframe
;
if
(
__get_user
(
st
.
ss_flags
,
&
frame
->
rs_uc
.
uc_stack
.
ss_flags
))
goto
badframe
;
/* It is more difficult to avoid calling this function than to
call it and ignore errors. */
old_fs
=
get_fs
();
set_fs
(
KERNEL_DS
);
do_sigaltstack
((
stack_t
__user
*
)
&
st
,
NULL
,
regs
.
regs
[
29
]);
set_fs
(
old_fs
);
/*
* Don't let your children do this ...
...
...
@@ -153,7 +128,6 @@ static int setup_rt_frame_n32(void *sig_return, struct k_sigaction *ka,
{
struct
rt_sigframe_n32
__user
*
frame
;
int
err
=
0
;
s32
sp
;
frame
=
get_sigframe
(
ka
,
regs
,
sizeof
(
*
frame
));
if
(
!
access_ok
(
VERIFY_WRITE
,
frame
,
sizeof
(
*
frame
)))
...
...
@@ -165,13 +139,7 @@ static int setup_rt_frame_n32(void *sig_return, struct k_sigaction *ka,
/* Create the ucontext. */
err
|=
__put_user
(
0
,
&
frame
->
rs_uc
.
uc_flags
);
err
|=
__put_user
(
0
,
&
frame
->
rs_uc
.
uc_link
);
sp
=
(
int
)
(
long
)
current
->
sas_ss_sp
;
err
|=
__put_user
(
sp
,
&
frame
->
rs_uc
.
uc_stack
.
ss_sp
);
err
|=
__put_user
(
sas_ss_flags
(
regs
->
regs
[
29
]),
&
frame
->
rs_uc
.
uc_stack
.
ss_flags
);
err
|=
__put_user
(
current
->
sas_ss_size
,
&
frame
->
rs_uc
.
uc_stack
.
ss_size
);
err
|=
__compat_save_altstack
(
&
frame
->
rs_uc
.
uc_stack
,
regs
->
regs
[
29
]);
err
|=
setup_sigcontext
(
regs
,
&
frame
->
rs_uc
.
uc_mcontext
);
err
|=
__copy_conv_sigset_to_user
(
&
frame
->
rs_uc
.
uc_sigmask
,
set
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录