Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
20ecc91c
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看板
提交
20ecc91c
编写于
10月 21, 2012
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
m68k: sanitize copy_thread(), fork/vfork/clone wrappers, switch to generic fork/vfork
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
dfe09ae0
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
46 addition
and
71 deletion
+46
-71
arch/m68k/include/asm/unistd.h
arch/m68k/include/asm/unistd.h
+2
-0
arch/m68k/kernel/entry.S
arch/m68k/kernel/entry.S
+9
-14
arch/m68k/kernel/process.c
arch/m68k/kernel/process.c
+32
-54
arch/m68k/kernel/syscalltable.S
arch/m68k/kernel/syscalltable.S
+3
-3
未找到文件。
arch/m68k/include/asm/unistd.h
浏览文件 @
20ecc91c
...
...
@@ -32,6 +32,8 @@
#define __ARCH_WANT_SYS_RT_SIGACTION
#define __ARCH_WANT_SYS_RT_SIGSUSPEND
#define __ARCH_WANT_SYS_EXECVE
#define __ARCH_WANT_SYS_FORK
#define __ARCH_WANT_SYS_VFORK
/*
* "Conditional" syscalls
...
...
arch/m68k/kernel/entry.S
浏览文件 @
20ecc91c
...
...
@@ -44,34 +44,29 @@
.
globl
system_call
,
buserr
,
trap
,
resume
.
globl
sys_call_table
.
globl
sys_fork
,
sys_clone
,
sys_vfork
.
globl
__sys_fork
,
__sys_clone
,
__
sys_vfork
.
globl
ret_from_interrupt
,
bad_interrupt
.
globl
auto_irqhandler_fixup
.
globl
user_irqvec_fixup
.
text
ENTRY
(
sys_fork
)
ENTRY
(
__
sys_fork
)
SAVE_SWITCH_STACK
pea
%
sp
@
(
SWITCH_STACK_SIZE
)
jbsr
m68k_fork
addql
#
4
,%
sp
RESTORE_SWITCH_STACK
jbsr
sys_fork
lea
%
sp
@
(
24
),%
sp
rts
ENTRY
(
sys_clone
)
ENTRY
(
__
sys_clone
)
SAVE_SWITCH_STACK
pea
%
sp
@
(
SWITCH_STACK_SIZE
)
jbsr
m68k_clone
addql
#
4
,%
sp
RESTORE_SWITCH_STACK
lea
%
sp
@
(
28
),%
sp
rts
ENTRY
(
sys_vfork
)
ENTRY
(
__
sys_vfork
)
SAVE_SWITCH_STACK
pea
%
sp
@
(
SWITCH_STACK_SIZE
)
jbsr
m68k_vfork
addql
#
4
,%
sp
RESTORE_SWITCH_STACK
jbsr
sys_vfork
lea
%
sp
@
(
24
),%
sp
rts
ENTRY
(
sys_sigreturn
)
...
...
arch/m68k/kernel/process.c
浏览文件 @
20ecc91c
...
...
@@ -136,57 +136,36 @@ void flush_thread(void)
}
/*
* "m68k_fork()".. By the time we get here, the
* non-volatile registers have also been saved on the
* stack. We do some ugly pointer stuff here.. (see
* also copy_thread)
* Why not generic sys_clone, you ask? m68k passes all arguments on stack.
* And we need all registers saved, which means a bunch of stuff pushed
* on top of pt_regs, which means that sys_clone() arguments would be
* buried. We could, of course, copy them, but it's too costly for no
* good reason - generic clone() would have to copy them *again* for
* do_fork() anyway. So in this case it's actually better to pass pt_regs *
* and extract arguments for do_fork() from there. Eventually we might
* go for calling do_fork() directly from the wrapper, but only after we
* are finished with do_fork() prototype conversion.
*/
asmlinkage
int
m68k_fork
(
struct
pt_regs
*
regs
)
{
#ifdef CONFIG_MMU
return
do_fork
(
SIGCHLD
,
rdusp
(),
regs
,
0
,
NULL
,
NULL
);
#else
return
-
EINVAL
;
#endif
}
asmlinkage
int
m68k_vfork
(
struct
pt_regs
*
regs
)
{
return
do_fork
(
CLONE_VFORK
|
CLONE_VM
|
SIGCHLD
,
rdusp
(),
regs
,
0
,
NULL
,
NULL
);
}
asmlinkage
int
m68k_clone
(
struct
pt_regs
*
regs
)
{
unsigned
long
clone_flags
;
unsigned
long
newsp
;
int
__user
*
parent_tidptr
,
*
child_tidptr
;
/* syscall2 puts clone_flags in d1 and usp in d2 */
clone_flags
=
regs
->
d1
;
newsp
=
regs
->
d2
;
parent_tidptr
=
(
int
__user
*
)
regs
->
d3
;
child_tidptr
=
(
int
__user
*
)
regs
->
d4
;
if
(
!
newsp
)
newsp
=
rdusp
();
return
do_fork
(
clone_flags
,
newsp
,
regs
,
0
,
parent_tidptr
,
child_tidptr
);
/* regs will be equal to current_pt_regs() */
return
do_fork
(
regs
->
d1
,
regs
->
d2
,
regs
,
0
,
(
int
__user
*
)
regs
->
d3
,
(
int
__user
*
)
regs
->
d4
);
}
int
copy_thread
(
unsigned
long
clone_flags
,
unsigned
long
usp
,
unsigned
long
arg
,
struct
task_struct
*
p
,
struct
pt_regs
*
regs
)
struct
task_struct
*
p
,
struct
pt_regs
*
unused
)
{
struct
pt_regs
*
childregs
;
struct
switch_stack
*
childstack
;
struct
fork_frame
{
struct
switch_stack
sw
;
struct
pt_regs
regs
;
}
*
frame
;
childregs
=
(
struct
pt_regs
*
)
(
task_stack_page
(
p
)
+
THREAD_SIZE
)
-
1
;
childstack
=
((
struct
switch_stack
*
)
childregs
)
-
1
;
frame
=
(
struct
fork_frame
*
)
(
task_stack_page
(
p
)
+
THREAD_SIZE
)
-
1
;
p
->
thread
.
usp
=
usp
;
p
->
thread
.
ksp
=
(
unsigned
long
)
childstack
;
p
->
thread
.
esp0
=
(
unsigned
long
)
childregs
;
p
->
thread
.
ksp
=
(
unsigned
long
)
frame
;
p
->
thread
.
esp0
=
(
unsigned
long
)
&
frame
->
regs
;
/*
* Must save the current SFC/DFC value, NOT the value when
...
...
@@ -194,25 +173,24 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
*/
p
->
thread
.
fs
=
get_fs
().
seg
;
if
(
unlikely
(
!
regs
))
{
if
(
unlikely
(
p
->
flags
&
PF_KTHREAD
))
{
/* kernel thread */
memset
(
childstack
,
0
,
sizeof
(
struct
switch_stack
)
+
sizeof
(
struct
pt_regs
));
childregs
->
sr
=
PS_S
;
childstack
->
a3
=
usp
;
/* function */
childstack
->
d7
=
arg
;
childstack
->
retpc
=
(
unsigned
long
)
ret_from_kernel_thread
;
memset
(
frame
,
0
,
sizeof
(
struct
fork_frame
));
frame
->
regs
.
sr
=
PS_S
;
frame
->
sw
.
a3
=
usp
;
/* function */
frame
->
sw
.
d7
=
arg
;
frame
->
sw
.
retpc
=
(
unsigned
long
)
ret_from_kernel_thread
;
p
->
thread
.
usp
=
0
;
return
0
;
}
*
childregs
=
*
regs
;
childregs
->
d0
=
0
;
*
childstack
=
((
struct
switch_stack
*
)
regs
)[
-
1
]
;
childstack
->
retpc
=
(
unsigned
long
)
ret_from_fork
;
memcpy
(
frame
,
container_of
(
current_pt_regs
(),
struct
fork_frame
,
regs
),
sizeof
(
struct
fork_frame
))
;
frame
->
regs
.
d0
=
0
;
frame
->
sw
.
retpc
=
(
unsigned
long
)
ret_from_fork
;
p
->
thread
.
usp
=
usp
?:
rdusp
()
;
if
(
clone_flags
&
CLONE_SETTLS
)
task_thread_info
(
p
)
->
tp_value
=
regs
->
d5
;
task_thread_info
(
p
)
->
tp_value
=
frame
->
regs
.
d5
;
#ifdef CONFIG_FPU
if
(
!
FPU_IS_EMU
)
{
...
...
arch/m68k/kernel/syscalltable.S
浏览文件 @
20ecc91c
...
...
@@ -22,7 +22,7 @@ ALIGN
ENTRY
(
sys_call_table
)
.
long
sys_restart_syscall
/*
0
-
old
"setup()"
system
call
,
used
for
restarting
*/
.
long
sys_exit
.
long
sys_fork
.
long
__
sys_fork
.
long
sys_read
.
long
sys_write
.
long
sys_open
/*
5
*/
...
...
@@ -140,7 +140,7 @@ ENTRY(sys_call_table)
.
long
sys_ipc
.
long
sys_fsync
.
long
sys_sigreturn
.
long
sys_clone
/*
120
*/
.
long
__sys_clone
/*
120
*/
.
long
sys_setdomainname
.
long
sys_newuname
.
long
sys_cacheflush
/*
modify_ldt
for
i386
*/
...
...
@@ -210,7 +210,7 @@ ENTRY(sys_call_table)
.
long
sys_sendfile
.
long
sys_ni_syscall
/*
streams1
*/
.
long
sys_ni_syscall
/*
streams2
*/
.
long
sys_vfork
/*
190
*/
.
long
__sys_vfork
/*
190
*/
.
long
sys_getrlimit
.
long
sys_mmap2
.
long
sys_truncate64
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录