我可以从模块添加系统调用吗?

发布于 2024-09-12 18:11:11 字数 21 浏览 2 评论 0原文

我可以从模块添加系统调用吗?

Can I add a systemcall from a module?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

勿忘初心 2024-09-19 18:11:11

在某些内核版本中,可以通过更改 sys_call_table 来添加或修改系统调用。但由于该表不打算在运行时更改,因此它没有保护。更改表将导致竞争条件。即使没有竞争条件,在使用或堆叠模块时移除模块也会出现问题。由于从模块更改 sys_call_table 时出现问题,该符号不再在新内核中导出。换句话说,如果在尝试加载模块时收到“unresolved symbol sys_call_table”,则意味着该模块中存在错误,并且内核不再接受此类有错误的模块。

In some kernel versions it is possible to add or modify a systemcall by changing the sys_call_table. But because this table is not intended to be changed at runtime, it has no protection. Changing the table will lead to race conditions. Even without the race conditions, there are problems related to removing the modules while they are in use or stacked. Because of the problems with changing sys_call_table from modules, the symbol is no longer exported in new kernels. In other words if you get "unresolved symbol sys_call_table" when trying to load a module, it means there is a bug in the module, and the kernel does no longer accept such buggy modules.

当梦初醒 2024-09-19 18:11:11

听起来真是个糟糕的主意,无论你是否可以。如果您的新系统调用将在文件/设备上运行,也许您可​​以将其设为 ioctl 或类似的东西,而不是使其成为自己的系统调用?

Sounds like a really bad idea, regardless of whether you can. If your new system call will operate on files/devices, perhaps you could make it an ioctl or something similar rather than making it its own syscall?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文