Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
anbox
提交
2095bebe
A
anbox
项目概览
openeuler
/
anbox
通知
24
Star
1
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
anbox
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2095bebe
编写于
12月 06, 2016
作者:
S
Simon Fels
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
kernel: binder: use kallsyms_lookup_name for internal symbol access
上级
f2110223
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
48 addition
and
45 deletion
+48
-45
kernel/binder/Makefile
kernel/binder/Makefile
+1
-9
kernel/binder/deps.c
kernel/binder/deps.c
+47
-18
kernel/binder/gen_deps.sh
kernel/binder/gen_deps.sh
+0
-18
未找到文件。
kernel/binder/Makefile
浏览文件 @
2095bebe
ccflags-y
+=
-I
$(src)
ifneq
($(KERNELRELEASE),)
ccflags-y
+=
-I
$(src)
-Wno-int-conversion
obj-m
:=
binder_linux.o
binder_linux-y
:=
deps.o binder.o
$(obj)/deps.o
:
$(src)/deps.h
$(obj)/deps.h
:
$(src)/gen_deps.sh
sudo
$(src)
/gen_deps.sh
>
$@
else
KERNEL_SRC
?=
/lib/modules/
$(
shell
uname
-r
)
/build
all
:
...
...
@@ -19,4 +12,3 @@ install:
clean
:
rm
-rf
deps.h
*
.o
*
.ko
*
.mod.c
*
.symvers
*
.order .
*
.cmd .tmp_versions
endif
kernel/binder/deps.c
浏览文件 @
2095bebe
...
...
@@ -5,96 +5,125 @@
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include "deps.h"
static
struct
vm_struct
*
(
*
get_vm_area_ptr
)(
unsigned
long
,
unsigned
long
)
=
GET_VM_AREA
;
static
void
(
*
zap_page_range_ptr
)(
struct
vm_area_struct
*
,
unsigned
long
,
unsigned
long
,
struct
zap_details
*
)
=
ZAP_PAGE_RANGE
;
static
int
(
*
map_kernel_range_noflush_ptr
)(
unsigned
long
start
,
unsigned
long
size
,
pgprot_t
prot
,
struct
page
**
pages
)
=
MAP_KERNEL_RANGE_NOFLUSH
;
static
void
(
*
unmap_kernel_range_ptr
)(
unsigned
long
,
unsigned
long
)
=
UNMAP_KERNEL_RANGE
;
static
struct
files_struct
*
(
*
get_files_struct_ptr
)(
struct
task_struct
*
)
=
GET_FILES_STRUCT
;
static
void
(
*
put_files_struct_ptr
)(
struct
files_struct
*
)
=
PUT_FILES_STRUCT
;
static
struct
sighand_struct
*
(
*
__lock_task_sighand_ptr
)(
struct
task_struct
*
,
unsigned
long
*
)
=
__LOCK_TASK_SIGHAND
;
static
int
(
*
__alloc_fd_ptr
)(
struct
files_struct
*
files
,
unsigned
start
,
unsigned
end
,
unsigned
flags
)
=
__ALLOC_FD
;
static
void
(
*
__fd_install_ptr
)(
struct
files_struct
*
files
,
unsigned
int
fd
,
struct
file
*
file
)
=
__FD_INSTALL
;
static
int
(
*
__close_fd_ptr
)(
struct
files_struct
*
files
,
unsigned
int
fd
)
=
__CLOSE_FD
;
static
int
(
*
can_nice_ptr
)(
const
struct
task_struct
*
,
const
int
)
=
CAN_NICE
;
static
int
(
*
security_binder_set_context_mgr_ptr
)(
struct
task_struct
*
mgr
)
=
SECURITY_BINDER_SET_CONTEXT_MGR
;
static
int
(
*
security_binder_transaction_ptr
)(
struct
task_struct
*
from
,
struct
task_struct
*
to
)
=
SECURITY_BINDER_TRANSACTION
;
static
int
(
*
security_binder_transfer_binder_ptr
)(
struct
task_struct
*
from
,
struct
task_struct
*
to
)
=
SECURITY_BINDER_TRANSFER_BINDER
;
static
int
(
*
security_binder_transfer_file_ptr
)(
struct
task_struct
*
from
,
struct
task_struct
*
to
,
struct
file
*
file
)
=
SECURITY_BINDER_TRANSFER_FILE
;
#include <linux/kallsyms.h>
static
struct
vm_struct
*
(
*
get_vm_area_ptr
)(
unsigned
long
,
unsigned
long
)
=
NULL
;
static
void
(
*
zap_page_range_ptr
)(
struct
vm_area_struct
*
,
unsigned
long
,
unsigned
long
,
struct
zap_details
*
)
=
NULL
;
static
int
(
*
map_kernel_range_noflush_ptr
)(
unsigned
long
start
,
unsigned
long
size
,
pgprot_t
prot
,
struct
page
**
pages
)
=
NULL
;
static
void
(
*
unmap_kernel_range_ptr
)(
unsigned
long
,
unsigned
long
)
=
NULL
;
static
struct
files_struct
*
(
*
get_files_struct_ptr
)(
struct
task_struct
*
)
=
NULL
;
static
void
(
*
put_files_struct_ptr
)(
struct
files_struct
*
)
=
NULL
;
static
struct
sighand_struct
*
(
*
__lock_task_sighand_ptr
)(
struct
task_struct
*
,
unsigned
long
*
)
=
NULL
;
static
int
(
*
__alloc_fd_ptr
)(
struct
files_struct
*
files
,
unsigned
start
,
unsigned
end
,
unsigned
flags
)
=
NULL
;
static
void
(
*
__fd_install_ptr
)(
struct
files_struct
*
files
,
unsigned
int
fd
,
struct
file
*
file
)
=
NULL
;
static
int
(
*
__close_fd_ptr
)(
struct
files_struct
*
files
,
unsigned
int
fd
)
=
NULL
;
static
int
(
*
can_nice_ptr
)(
const
struct
task_struct
*
,
const
int
)
=
NULL
;
static
int
(
*
security_binder_set_context_mgr_ptr
)(
struct
task_struct
*
mgr
)
=
NULL
;
static
int
(
*
security_binder_transaction_ptr
)(
struct
task_struct
*
from
,
struct
task_struct
*
to
)
=
NULL
;
static
int
(
*
security_binder_transfer_binder_ptr
)(
struct
task_struct
*
from
,
struct
task_struct
*
to
)
=
NULL
;
static
int
(
*
security_binder_transfer_file_ptr
)(
struct
task_struct
*
from
,
struct
task_struct
*
to
,
struct
file
*
file
)
=
NULL
;
struct
vm_struct
*
get_vm_area
(
unsigned
long
size
,
unsigned
long
flags
)
{
if
(
!
get_vm_area_ptr
)
get_vm_area_ptr
=
kallsyms_lookup_name
(
"get_vm_area"
);
return
get_vm_area_ptr
(
size
,
flags
);
}
void
zap_page_range
(
struct
vm_area_struct
*
vma
,
unsigned
long
address
,
unsigned
long
size
,
struct
zap_details
*
details
)
{
if
(
!
zap_page_range_ptr
)
zap_page_range_ptr
=
kallsyms_lookup_name
(
"zap_page_range"
);
zap_page_range_ptr
(
vma
,
address
,
size
,
details
);
}
int
map_kernel_range_noflush
(
unsigned
long
start
,
unsigned
long
size
,
pgprot_t
prot
,
struct
page
**
pages
)
{
if
(
!
map_kernel_range_noflush_ptr
)
map_kernel_range_noflush_ptr
=
kallsyms_lookup_name
(
"map_kernel_range_noflush"
);
return
map_kernel_range_noflush_ptr
(
start
,
size
,
prot
,
pages
);
}
void
unmap_kernel_range
(
unsigned
long
addr
,
unsigned
long
size
)
{
if
(
!
unmap_kernel_range_ptr
)
unmap_kernel_range_ptr
=
kallsyms_lookup_name
(
"unmap_kernel_range"
);
unmap_kernel_range_ptr
(
addr
,
size
);
}
struct
files_struct
*
get_files_struct
(
struct
task_struct
*
task
)
{
if
(
!
get_files_struct_ptr
)
get_files_struct_ptr
=
kallsyms_lookup_name
(
"get_files_struct"
);
return
get_files_struct_ptr
(
task
);
}
void
put_files_struct
(
struct
files_struct
*
files
)
{
if
(
!
put_files_struct_ptr
)
put_files_struct_ptr
=
kallsyms_lookup_name
(
"put_files_struct"
);
put_files_struct_ptr
(
files
);
}
struct
sighand_struct
*
__lock_task_sighand
(
struct
task_struct
*
tsk
,
unsigned
long
*
flags
)
{
if
(
!
__lock_task_sighand_ptr
)
__lock_task_sighand_ptr
=
kallsyms_lookup_name
(
"__lock_task_sighand"
);
return
__lock_task_sighand_ptr
(
tsk
,
flags
);
}
int
__alloc_fd
(
struct
files_struct
*
files
,
unsigned
start
,
unsigned
end
,
unsigned
flags
)
{
if
(
!
__alloc_fd_ptr
)
__alloc_fd_ptr
=
kallsyms_lookup_name
(
"__alloc_fd"
);
return
__alloc_fd_ptr
(
files
,
start
,
end
,
flags
);
}
void
__fd_install
(
struct
files_struct
*
files
,
unsigned
int
fd
,
struct
file
*
file
)
{
if
(
!
__fd_install_ptr
)
__fd_install_ptr
=
kallsyms_lookup_name
(
"__fd_install"
);
__fd_install_ptr
(
files
,
fd
,
file
);
}
int
__close_fd
(
struct
files_struct
*
files
,
unsigned
int
fd
)
{
if
(
!
__close_fd_ptr
)
__close_fd_ptr
=
kallsyms_lookup_name
(
"__close_fd_ptr"
);
return
__close_fd_ptr
(
files
,
fd
);
}
int
can_nice
(
const
struct
task_struct
*
p
,
const
int
nice
)
{
if
(
!
can_nice_ptr
)
can_nice_ptr
=
kallsyms_lookup_name
(
"can_nice"
);
return
can_nice_ptr
(
p
,
nice
);
}
int
security_binder_set_context_mgr
(
struct
task_struct
*
mgr
)
{
if
(
!
security_binder_set_context_mgr_ptr
)
security_binder_set_context_mgr_ptr
=
kallsyms_lookup_name
(
"security_binder_set_context_mgr"
);
return
security_binder_set_context_mgr_ptr
(
mgr
);
}
int
security_binder_transaction
(
struct
task_struct
*
from
,
struct
task_struct
*
to
)
{
if
(
!
security_binder_transaction_ptr
)
security_binder_transaction_ptr
=
kallsyms_lookup_name
(
"security_binder_transaction"
);
return
security_binder_transaction_ptr
(
from
,
to
);
}
int
security_binder_transfer_binder
(
struct
task_struct
*
from
,
struct
task_struct
*
to
)
{
if
(
!
security_binder_transfer_binder_ptr
)
security_binder_transfer_binder_ptr
=
kallsyms_lookup_name
(
"security_binder_transfer_binder"
);
return
security_binder_transfer_binder_ptr
(
from
,
to
);
}
int
security_binder_transfer_file
(
struct
task_struct
*
from
,
struct
task_struct
*
to
,
struct
file
*
file
)
{
if
(
!
security_binder_transfer_file_ptr
)
security_binder_transfer_file_ptr
=
kallsyms_lookup_name
(
"security_binder_transfer_file"
);
return
security_binder_transfer_file_ptr
(
from
,
to
,
file
);
}
kernel/binder/gen_deps.sh
已删除
100755 → 0
浏览文件 @
f2110223
#!/bin/sh
SYMS
=
"get_vm_area zap_page_range map_kernel_range_noflush unmap_kernel_range "
\
"get_files_struct put_files_struct __lock_task_sighand "
\
"__alloc_fd __fd_install __close_fd can_nice "
\
"security_binder_set_context_mgr security_binder_transaction "
\
"security_binder_transfer_binder security_binder_transfer_file"
for
sym
in
$SYMS
;
do
addr
=
`
cat
/proc/kallsyms |
grep
-Ee
'^[0-9a-f]+ T '
$sym
'$'
|
sed
-e
's/\s.*$//g'
`
if
[
a
$addr
=
'a'
]
;
then
echo
"Error: can't find symbol
$sym
"
exit
1
fi
name
=
`
echo
$sym
|
tr
'[:lower:]'
'[:upper:]'
`
echo
"#define
$name
\t
(void *)0x
$addr
"
done
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录