Tag: procfs

copy_from_user警告大小不可certificate是正确的?

我在编译我的内核模块时遇到了一个警告,我无法解决这个问题。 首先来看看这个简化的代码: #define READ_CHUNK 100u static int _procfs_write(struct file *file, const char *buf, unsigned long count, void *data) { char command[READ_CHUNK]; unsigned long left = count; while (left > 0) { unsigned int amount = left<READ_CHUNK?left:READ_CHUNK; if (copy_from_user(command, buf, amount)) return -EFAULT; buf += amount; left -= amount; /* process buffer */ } return count; […]

取消引用proc_dir_entry指针导致Linux 3.11及更高版本上的编译错误

我试图按照这里给出的示例rootkit https://github.com/ivyl/rootkit 我修改了这个例子,以便我可以在linux 3.11版本上编译它。 我发现最新的linux版本停止支持几个API,例如create_proc_entry,readdir已经被迭代等替换。 在Linux版本是3.11.0-23我还观察到我的include目录不包含internal.h,以便有完整的proc_dir_entry定义。 在linux上的较低版本(<3.10),我们在proc_fs.h文件中定义了proc_dir_entry。 修改后的rootkit文件如下所示: #include #include #include #include #include #include //#include “fs/proc/internal.h” #define MIN(a,b) \ ({ typeof (a) _a = (a); \ typeof (b) _b = (b); \ _a < _b ? _a : _b; }) #define MAX_PIDS 50 MODULE_LICENSE("Dual BSD/GPL"); MODULE_AUTHOR("Arkadiusz Hiler”); MODULE_AUTHOR(“Michal Winiarski”); //STATIC VARIABLES SECTION //we don’t want […]