QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1209|回复: 2

模块加载时出现unresolved symbol问题

[复制链接]
发表于 2003-10-19 22:33:38 | 显示全部楼层 |阅读模式
在redhat9.0,内核2.4.20下,用insmod加载模块出现unresolved symbol sys_call_table的错误,但在debian下,同样版本内核(编译时用的选现也差不多)没问题。
有谁知道怎么回事?
[code:1]
#include <linux/kernel.h>
#include <linux/module.h>
#include <sys/syscall.h>

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

extern void *sys_call_table[];

/* Pointer to original chdir function, we must call this
   from our intercept function to allow for normal directory
   changes.  This will also be used to restore the syscall pointer
   when this module is unloaded. */
int (*old_sys_chdir)(const char *);

int (*sys_getuid)();

int sys_chdir_intercept(const char *path) {
  printk("%d %s\n", sys_getuid(), path);

  return old_sys_chdir(path);
}

int init_module() {
  // Outputted to your syslog
  printk("Module loaded..\n");

  old_sys_chdir = sys_call_table[__NR_chdir];
  sys_call_table[__NR_chdir] = sys_chdir_intercept;

  sys_getuid = sys_call_table[__NR_getuid];

  return 0;
}

void cleanup_module() {
  // Outputted to your syslog
  printk("Module unloaded..\n");

  sys_call_table[__NR_chdir] = old_sys_chdir;
}[/code:1]
 楼主| 发表于 2003-10-20 21:07:42 | 显示全部楼层
大哥们帮帮忙吧。。。
回复

使用道具 举报

发表于 2003-10-21 00:14:28 | 显示全部楼层
if u use rh kernel like 2.4.20-8/9 it disable the system_call_table export. u need to reenable it or use a different kernel.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-9-28 04:15 , Processed in 0.068324 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表