免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1396 | 回复: 4
打印 上一主题 下一主题

hack.o: unresolved symbol sys_call_table 求救 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-07-25 16:29 |只看该作者 |倒序浏览
最近新学内核模块
我的代码如下:
  1. #define MODULE
  2. #define __KERNEL__

  3. #if CONFIG_MODVERSIONS==1
  4. #define MODVERSIONS
  5. #include <linux/modversions.h>
  6. #endif

  7. #include <linux/kernel.h>
  8. #include <linux/module.h>
  9. #include <asm/unistd.h>
  10. #include <sys/syscall.h>


  11. #define SYS_mkdir 39
  12. extern void* sys_call_table[];


  13. int (*orig_mkdir)(const char *path);


  14. int hacked_mkdir(const char *path)
  15. {
  16. /*        printk("hello world\n");        */
  17.         return 0;               
  18. }

  19. int init_module(void)
  20. {
  21.         orig_mkdir=sys_call_table[SYS_mkdir];       
  22.         sys_call_table[SYS_mkdir]=hacked_mkdir;       
  23.         return 0;
  24. }

  25. void cleanup_module(void)
  26. {
  27.         sys_call_table[SYS_mkdir]=orig_mkdir;       
  28. }
复制代码


INSMOD 就有错误,我是在LINUX2.6下做的,不对可是不知道怎么改
insmod hack.o
hack.o: unresolved symbol sys_call_table
hack.o:
Hint: You are trying to load a module without a GPL compatible license
      and it has unresolved symbols.  The module may be trying to access
      GPLONLY symbols but the problem is more likely to be a coding or
      user error.  Contact the module supplier for assistance, only they
      can help you.

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
2 [报告]
发表于 2006-07-25 16:31 |只看该作者
2.6都insmod .ko了.

论坛徽章:
0
3 [报告]
发表于 2006-07-25 16:33 |只看该作者

回复 2楼 mq110 的帖子

请详细说明下,确实不懂
我现在也就是照猫画虎而已,还不一定能画好

论坛徽章:
0
4 [报告]
发表于 2006-07-25 16:40 |只看该作者
sys_call_table没有导出,要你自己去找。

论坛徽章:
0
5 [报告]
发表于 2006-07-25 16:45 |只看该作者

回复 4楼 圆点坐标 的帖子

再提示下怎么找,先谢谢了
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP