Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
kernel_linux
提交
2ba85f3a
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看板
提交
2ba85f3a
编写于
2月 07, 2008
作者:
D
David S. Miller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[SPARC64]: Make use of compat_sys_ptrace()
Signed-off-by:
N
David S. Miller
<
davem@davemloft.net
>
上级
df922075
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
111 addition
and
159 deletion
+111
-159
arch/sparc64/kernel/ptrace.c
arch/sparc64/kernel/ptrace.c
+108
-158
arch/sparc64/kernel/systbls.S
arch/sparc64/kernel/systbls.S
+1
-1
include/asm-sparc64/ptrace.h
include/asm-sparc64/ptrace.h
+2
-0
未找到文件。
arch/sparc64/kernel/ptrace.c
浏览文件 @
2ba85f3a
...
...
@@ -684,72 +684,39 @@ const struct user_regset_view *task_user_regset_view(struct task_struct *task)
return
&
user_sparc64_view
;
}
long
arch_ptrace
(
struct
task_struct
*
child
,
long
request
,
long
addr
,
long
data
)
struct
compat_fps
{
unsigned
int
regs
[
32
];
unsigned
int
fsr
;
unsigned
int
flags
;
unsigned
int
extra
;
unsigned
int
fpqd
;
struct
compat_fq
{
unsigned
int
insnaddr
;
unsigned
int
insn
;
}
fpq
[
16
];
};
long
compat_arch_ptrace
(
struct
task_struct
*
child
,
compat_long_t
request
,
compat_ulong_t
caddr
,
compat_ulong_t
cdata
)
{
long
addr2
=
task_pt_regs
(
current
)
->
u_regs
[
UREG_I4
];
const
struct
user_regset_view
*
view
;
const
struct
user_regset_view
*
view
=
task_user_regset_view
(
child
);
compat_ulong_t
caddr2
=
task_pt_regs
(
current
)
->
u_regs
[
UREG_I4
];
struct
pt_regs32
__user
*
pregs
;
struct
compat_fps
__user
*
fps
;
unsigned
long
addr2
=
caddr2
;
unsigned
long
addr
=
caddr
;
unsigned
long
data
=
cdata
;
int
ret
;
if
(
test_thread_flag
(
TIF_32BIT
))
addr2
&=
0xffffffffUL
;
pregs
=
(
struct
pt_regs32
__user
*
)
addr
;
fps
=
(
struct
compat_fps
__user
*
)
addr
;
view
=
task_user_regset_view
(
child
);
switch
(
request
)
{
switch
(
request
)
{
case
PTRACE_PEEKUSR
:
ret
=
(
addr
!=
0
)
?
-
EIO
:
0
;
break
;
case
PTRACE_PEEKTEXT
:
/* read word at location addr. */
case
PTRACE_PEEKDATA
:
{
unsigned
long
tmp64
;
unsigned
int
tmp32
;
int
copied
;
ret
=
-
EIO
;
if
(
test_thread_flag
(
TIF_32BIT
))
{
copied
=
access_process_vm
(
child
,
addr
,
&
tmp32
,
sizeof
(
tmp32
),
0
);
if
(
copied
==
sizeof
(
tmp32
))
ret
=
put_user
(
tmp32
,
(
unsigned
int
__user
*
)
data
);
}
else
{
copied
=
access_process_vm
(
child
,
addr
,
&
tmp64
,
sizeof
(
tmp64
),
0
);
if
(
copied
==
sizeof
(
tmp64
))
ret
=
put_user
(
tmp64
,
(
unsigned
long
__user
*
)
data
);
}
break
;
}
case
PTRACE_POKETEXT
:
/* write the word at location addr. */
case
PTRACE_POKEDATA
:
{
unsigned
long
tmp64
;
unsigned
int
tmp32
;
int
copied
;
ret
=
-
EIO
;
if
(
test_thread_flag
(
TIF_32BIT
))
{
tmp32
=
data
;
copied
=
access_process_vm
(
child
,
addr
,
&
tmp32
,
sizeof
(
tmp32
),
1
);
if
(
copied
==
sizeof
(
tmp32
))
ret
=
0
;
}
else
{
tmp64
=
data
;
copied
=
access_process_vm
(
child
,
addr
,
&
tmp64
,
sizeof
(
tmp64
),
1
);
if
(
copied
==
sizeof
(
tmp64
))
ret
=
0
;
}
break
;
}
case
PTRACE_GETREGS
:
{
struct
pt_regs32
__user
*
pregs
=
(
struct
pt_regs32
__user
*
)
addr
;
case
PTRACE_GETREGS
:
ret
=
copy_regset_to_user
(
child
,
view
,
REGSET_GENERAL
,
32
*
sizeof
(
u32
),
4
*
sizeof
(
u32
),
...
...
@@ -760,29 +727,8 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
15
*
sizeof
(
u32
),
&
pregs
->
u_regs
[
0
]);
break
;
}
case
PTRACE_GETREGS64
:
{
struct
pt_regs
__user
*
pregs
=
(
struct
pt_regs
__user
*
)
addr
;
ret
=
copy_regset_to_user
(
child
,
view
,
REGSET_GENERAL
,
1
*
sizeof
(
u64
),
15
*
sizeof
(
u64
),
&
pregs
->
u_regs
[
0
]);
if
(
!
ret
)
{
/* XXX doesn't handle 'y' register correctly XXX */
ret
=
copy_regset_to_user
(
child
,
view
,
REGSET_GENERAL
,
32
*
sizeof
(
u64
),
4
*
sizeof
(
u64
),
&
pregs
->
tstate
);
}
break
;
}
case
PTRACE_SETREGS
:
{
struct
pt_regs32
__user
*
pregs
=
(
struct
pt_regs32
__user
*
)
addr
;
case
PTRACE_SETREGS
:
ret
=
copy_regset_from_user
(
child
,
view
,
REGSET_GENERAL
,
32
*
sizeof
(
u32
),
4
*
sizeof
(
u32
),
...
...
@@ -793,39 +739,8 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
15
*
sizeof
(
u32
),
&
pregs
->
u_regs
[
0
]);
break
;
}
case
PTRACE_SETREGS64
:
{
struct
pt_regs
__user
*
pregs
=
(
struct
pt_regs
__user
*
)
addr
;
ret
=
copy_regset_from_user
(
child
,
view
,
REGSET_GENERAL
,
1
*
sizeof
(
u64
),
15
*
sizeof
(
u64
),
&
pregs
->
u_regs
[
0
]);
if
(
!
ret
)
{
/* XXX doesn't handle 'y' register correctly XXX */
ret
=
copy_regset_from_user
(
child
,
view
,
REGSET_GENERAL
,
32
*
sizeof
(
u64
),
4
*
sizeof
(
u64
),
&
pregs
->
tstate
);
}
break
;
}
case
PTRACE_GETFPREGS
:
{
struct
fps
{
unsigned
int
regs
[
32
];
unsigned
int
fsr
;
unsigned
int
flags
;
unsigned
int
extra
;
unsigned
int
fpqd
;
struct
fq
{
unsigned
int
insnaddr
;
unsigned
int
insn
;
}
fpq
[
16
];
};
struct
fps
__user
*
fps
=
(
struct
fps
__user
*
)
addr
;
case
PTRACE_GETFPREGS
:
ret
=
copy_regset_to_user
(
child
,
view
,
REGSET_FP
,
0
*
sizeof
(
u32
),
32
*
sizeof
(
u32
),
...
...
@@ -843,36 +758,8 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
ret
=
-
EFAULT
;
}
break
;
}
case
PTRACE_GETFPREGS64
:
{
struct
fps
{
unsigned
int
regs
[
64
];
unsigned
long
fsr
;
};
struct
fps
__user
*
fps
=
(
struct
fps
__user
*
)
addr
;
ret
=
copy_regset_to_user
(
child
,
view
,
REGSET_FP
,
0
*
sizeof
(
u64
),
33
*
sizeof
(
u64
),
fps
);
break
;
}
case
PTRACE_SETFPREGS
:
{
struct
fps
{
unsigned
int
regs
[
32
];
unsigned
int
fsr
;
unsigned
int
flags
;
unsigned
int
extra
;
unsigned
int
fpqd
;
struct
fq
{
unsigned
int
insnaddr
;
unsigned
int
insn
;
}
fpq
[
16
];
};
struct
fps
__user
*
fps
=
(
struct
fps
__user
*
)
addr
;
case
PTRACE_SETFPREGS
:
ret
=
copy_regset_from_user
(
child
,
view
,
REGSET_FP
,
0
*
sizeof
(
u32
),
32
*
sizeof
(
u32
),
...
...
@@ -883,21 +770,94 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
1
*
sizeof
(
u32
),
&
fps
->
fsr
);
break
;
case
PTRACE_READTEXT
:
case
PTRACE_READDATA
:
ret
=
ptrace_readdata
(
child
,
addr
,
(
char
__user
*
)
addr2
,
data
);
if
(
ret
==
data
)
ret
=
0
;
else
if
(
ret
>=
0
)
ret
=
-
EIO
;
break
;
case
PTRACE_WRITETEXT
:
case
PTRACE_WRITEDATA
:
ret
=
ptrace_writedata
(
child
,
(
char
__user
*
)
addr2
,
addr
,
data
);
if
(
ret
==
data
)
ret
=
0
;
else
if
(
ret
>=
0
)
ret
=
-
EIO
;
break
;
default:
ret
=
compat_ptrace_request
(
child
,
request
,
addr
,
data
);
break
;
}
case
PTRACE_SETFPREGS64
:
{
struct
fps
{
unsigned
int
regs
[
64
];
unsigned
long
fsr
;
};
struct
fps
__user
*
fps
=
(
struct
fps
__user
*
)
addr
;
return
ret
;
}
struct
fps
{
unsigned
int
regs
[
64
];
unsigned
long
fsr
;
};
long
arch_ptrace
(
struct
task_struct
*
child
,
long
request
,
long
addr
,
long
data
)
{
const
struct
user_regset_view
*
view
=
task_user_regset_view
(
child
);
struct
pt_regs
__user
*
pregs
=
(
struct
pt_regs
__user
*
)
addr
;
unsigned
long
addr2
=
task_pt_regs
(
current
)
->
u_regs
[
UREG_I4
];
struct
fps
__user
*
fps
=
(
struct
fps
__user
*
)
addr
;
int
ret
;
switch
(
request
)
{
case
PTRACE_PEEKUSR
:
ret
=
(
addr
!=
0
)
?
-
EIO
:
0
;
break
;
case
PTRACE_GETREGS64
:
ret
=
copy_regset_to_user
(
child
,
view
,
REGSET_GENERAL
,
1
*
sizeof
(
u64
),
15
*
sizeof
(
u64
),
&
pregs
->
u_regs
[
0
]);
if
(
!
ret
)
{
/* XXX doesn't handle 'y' register correctly XXX */
ret
=
copy_regset_to_user
(
child
,
view
,
REGSET_GENERAL
,
32
*
sizeof
(
u64
),
4
*
sizeof
(
u64
),
&
pregs
->
tstate
);
}
break
;
case
PTRACE_SETREGS64
:
ret
=
copy_regset_from_user
(
child
,
view
,
REGSET_GENERAL
,
1
*
sizeof
(
u64
),
15
*
sizeof
(
u64
),
&
pregs
->
u_regs
[
0
]);
if
(
!
ret
)
{
/* XXX doesn't handle 'y' register correctly XXX */
ret
=
copy_regset_from_user
(
child
,
view
,
REGSET_GENERAL
,
32
*
sizeof
(
u64
),
4
*
sizeof
(
u64
),
&
pregs
->
tstate
);
}
break
;
case
PTRACE_GETFPREGS64
:
ret
=
copy_regset_to_user
(
child
,
view
,
REGSET_FP
,
0
*
sizeof
(
u64
),
33
*
sizeof
(
u64
),
fps
);
break
;
case
PTRACE_SETFPREGS64
:
ret
=
copy_regset_to_user
(
child
,
view
,
REGSET_FP
,
0
*
sizeof
(
u64
),
33
*
sizeof
(
u64
),
fps
);
break
;
}
case
PTRACE_READTEXT
:
case
PTRACE_READDATA
:
...
...
@@ -919,16 +879,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
ret
=
-
EIO
;
break
;
case
PTRACE_GETEVENTMSG
:
{
if
(
test_thread_flag
(
TIF_32BIT
))
ret
=
put_user
(
child
->
ptrace_message
,
(
unsigned
int
__user
*
)
data
);
else
ret
=
put_user
(
child
->
ptrace_message
,
(
unsigned
long
__user
*
)
data
);
break
;
}
default:
ret
=
ptrace_request
(
child
,
request
,
addr
,
data
);
break
;
...
...
arch/sparc64/kernel/systbls.S
浏览文件 @
2ba85f3a
...
...
@@ -23,7 +23,7 @@ sys_call_table32:
/*
10
*/
.
word
sys_unlink
,
sunos_execv
,
sys_chdir
,
sys32_chown16
,
sys32_mknod
/*
15
*/
.
word
sys_chmod
,
sys32_lchown16
,
sparc_brk
,
sys32_perfctr
,
sys32_lseek
/*
20
*/
.
word
sys_getpid
,
sys_capget
,
sys_capset
,
sys32_setuid16
,
sys32_getuid16
/*
25
*/
.
word
sys32_vmsplice
,
sys_ptrace
,
sys_alarm
,
sys32_sigaltstack
,
sys32_pause
/*
25
*/
.
word
sys32_vmsplice
,
compat_
sys_ptrace
,
sys_alarm
,
sys32_sigaltstack
,
sys32_pause
/*
30
*/
.
word
compat_sys_utime
,
sys_lchown
,
sys_fchown
,
sys32_access
,
sys32_nice
.
word
sys_chown
,
sys_sync
,
sys32_kill
,
compat_sys_newstat
,
sys32_sendfile
/*
40
*/
.
word
compat_sys_newlstat
,
sys_dup
,
sys_pipe
,
compat_sys_times
,
sys_getuid
...
...
include/asm-sparc64/ptrace.h
浏览文件 @
2ba85f3a
...
...
@@ -95,6 +95,8 @@ struct sparc_trapf {
#ifdef __KERNEL__
#define __ARCH_WANT_COMPAT_SYS_PTRACE
#define force_successful_syscall_return() \
do { current_thread_info()->syscall_noerror = 1; \
} while (0)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录