当前位置: 首页 > news >正文

重庆水务建设项目集团网站平台公司市场化运营

重庆水务建设项目集团网站,平台公司市场化运营,无锡手机网站建设,婚纱摄影网站开发的目的3.3.1 IPC钩子函数设计与实现 IPC Binder是Android最重要的进程间通信机制#xff0c;因此#xff0c;必须在此实施强制访问控制。 1. 修改secuirty.h 打开终端shell#xff0c;输入指令“cd /android4.0/kernel/goldfish/include/linux/vim security.h”#xff0c;找到结…3.3.1 IPC钩子函数设计与实现 IPC Binder是Android最重要的进程间通信机制因此必须在此实施强制访问控制。 1. 修改secuirty.h 打开终端shell输入指令“cd /android4.0/kernel/goldfish/include/linux/vim security.h”找到结构security_operations加入函数指针变量如下所示 /* * This is the main security structure. */ struct security_operations {    charname[SECURITY_NAME_MAX 1]; #ifdef HAVE_SMACK    /*     * to add a binder hook     * */    int(*binder_transaction) (struct task_struct *from, struct task_struct *to); #endif 随后在security_operations定义结尾后加入函数声明如下 #ifdef HAVE_SMACK int security_binder_transaction(structtask_struct *from, struct task_struct *to); #endif 在LSM钩子函数实现处加入security_binder_transaction的定义如下 #ifdef HAVE_SMACK static inline intsecurity_binder_transaction(struct task_struct *from, struct task_struct *to) {    return 0; } #endif 2. 修改security.c 打开终端shell输入指令“cd /android4.0/kernel/goldfish/security/vim security.c”加入函数如下所示 #ifdefHAVE_SMACK intsecurity_binder_transaction(struct task_struct *from, struct task_struct *to) {     returnsecurity_ops-binder_transaction(from, to); } #endif 3. 修改smack_lsm.c 打开终端shell输入指令“cd /android4.0/kernel/goldfish/security/smack/vim smack_lsm.c”加入函数“smack_binder_transaction”如下所示 #ifdefHAVE_SMACK /*  * smack_binder_transaction - to check bindertransaction between two tasks  * */ static intsmack_binder_transaction(struct task_struct *from, struct task_struct *to) {     int rc1, rc2;     /*      * ask the two task must have writepermission to each other      * */     rc1 smk_access(task_security(from),task_security(to), MAY_WRITE);     rc2 smk_access(task_security(to),task_security(from), MAY_WRITE);       return rc1 0 rc2 0 ? 0:1; } #endif 此钩子函数用来判断源进程from和目标进程to之间有没有互相写权限。最后在结构体security_operations smack_ops新增成员变量如下 structsecurity_operations smack_ops {    .name                       smack, #ifdefHAVE_SMACK    .binder_transaction smack_binder_transaction, #endif 4. 重新编译模拟器内核 编译Android内核方法已经在第二章有所阐述这里不再叙述。 3.3.2   每个进程分为用户空间和内核空间两部分不同进程的用户空间是无法共享的进程内核空间通过Android Binder来实现IPC。Binder驱动代码位于“/android4.0/kernel/goldfish/driver/staging/android/bind.c”文件中其中binder_transaction函数使用binder_transaction_data结构体的数据来执行Binder寻址、复制Binder IPC数据、生成及检索Binder节点等操作。打开终端shell输入指令“cd /host/android4.0/kernel/goldfish/drivers/staging/android/vim binder.c”找到该函数的定义如下 static voidbinder_transaction(struct binder_proc *proc, struct binder_thread *thread, struct binder_transaction_data *tr, int reply); 在源进程和目标进程确定后加入代码如下        if(security_binder_transaction(proc-tsk,target_proc-tsk)) {            return_error BR_FAILED_REPLY;            goto err_invalid_target_handle;        } 其中target_proc-tsk指向目标进程的task_structproc-tsk指向源进程的task_struct加入security_task_movememory用来判断当前进程对源进程有没有写权限security_binder_transaction用来判断源进程对目标进程有没有写权限这两个函数均为LSM钩子函数由于内核已经装载了smack模块因此它们是指向了smack内核的smack_task_movememory和smack_binder_transaction。加入上述代码的目的是为了防止进程不经授权滥用IPC Binder进行通信正如下图所示   如上图所示服务客户端通过Binder调用Service Server的foo函数服务客户端将Binder IPC数据通过BinderDriver传递给Service ServerBinder Driver是源进程和目标进程通信的媒介IPC检查机制就是在Binder Driver中检查源进程和目标进程之间有没有互相“写”的权限。在进程的安全标签不是“_”的前提下使用Smack可以实现对进程的控制。例如上层应用如果要想实现发短信的功能与上层应用所对应的Linux进程是在BinderDriver中与radio进程进行互相通信如果smack规则否定了上层应用对radio“写”权限那么上层应用不能实现发短信的功能。再如上层应用要想实现访问通讯录的目的上层应用也是在Binder Driver中与通讯录进程进行通信如果smack规则容许上层应用对通讯录进程有“写”的权限那么上层应用才可以访问通讯录。恶意软件可能绕过Android框架层的权限检查机制但它们绕不过内核的IPC检查。 转载于:https://www.cnblogs.com/pangblog/p/3265265.html
http://www.pierceye.com/news/901757/

相关文章:

  • 小规模公司做网站成本是什么wordpress主题转html
  • seo做的比较好的网站的几个特征app网站建设教程视频教程
  • 网站建设规范优质高等职业院校建设网站
  • 国内做网站哪家公司好机票什么网站建设
  • 万盛经开区建设局官方网站高校校园网站建设的要求
  • 制作企业网站的实训报告防伪码查询网站怎么做的
  • 做网站会很忙吗网站 js 广告代码
  • 没有网站域名备案专业做书画推广的网站
  • 做app网站公司名称有没有做黑市网站
  • apache建设网站做网站页面代码
  • html5 单页网站网络运维从入门到精通
  • 联合建设官方网站银川网站seo
  • jsp网站开发与设计摘要网站开发是什么
  • 公司网站建设论文结束语谷歌建站多少钱
  • 陕西省建设工会网站漳州做网站最便宜
  • asp网站怎么做301定向辽宁网络优化方法
  • 足球网站建设无锡企业网站的建设
  • 网站建设 国风网络学校网站建设新闻
  • 网站集成微信登录ai logo设计网站
  • 给客户做网站kesioncms企业网站蓝色模板
  • 哪个网站可以做视频播放器建筑工程网络计划方法
  • 长沙做网站的有哪些wordpress投稿页面路径怎么写
  • 京东第一次做网站如何做像淘宝一样的网站
  • 南湖网站建设公司怎么用iapp做网站软件
  • 永康网站建设专业公司六安网约车收入怎么样
  • 长沙品质企业建站服务电话随州公司做网站
  • 怎么做期货网站永久免费linux服务器
  • 怎么访问被禁止的网站微信商城网站方案
  • 建设网站需要会什么简单网页代码html
  • 南通网站怎么推广淘客选品网站开发