内核模块是一个运行时可加载的目标文件,它被加载到操作系统内核中以向正在运行的内核添加功能。示例包括设备驱动程序和其他内核项。
在内核模块中分配物理连续页 我正在尝试使用alloc_pages_exact函数在DRAM中分配物理连续的页面。当我尝试分配10MB的页面时,返回的地址总是0。但是当我尝试分配...
static int __init hello_entry(void){ unsigned long i = 0; unsigned long j = 0; unsigned long counter; int fault = 0; char default_value = 0xff; unsigned long size_of_memory_to_test_bytes = 10 * 1024 * 1024;//10MB chunk unsigned long page_size = 8 * 1024;//8kB page size. From data sheet for elpida 4GB ddr3 ram unsigned long number_of_pages = size_of_memory_to_test_bytes / page_size; unsigned long number_of_hammer_access = 200000; printk("Number Of Bytes to allocate: %ld\n", number_of_pages * page_size); char* pages = (char *)alloc_pages_exact(number_of_pages * page_size, GFP_KERNEL); while(pages == 0);//The Program must wait till enough pages have been allocated! printk("Starting Address: %x", pages); char *hammerRow0, *hammerRow1, *victimRow; char hammerRow0_data, victimRow_data, hammerRow1_data, read_midvalue; printk(KERN_ALERT "Memory Test Entry!\n"); printk(KERN_ALERT "Page Size: %ld\n", page_size); printk(KERN_ALERT "Cache Line Size: %d\n", cache_line_size()); //The design consists of two hammer rows which will be repeatedly accessed one after another //There will be a victim row in between the two hammer rows, kind of like a victim row sandwiched between two hammer rows //This will server two purposes: //1. Greater probability of inducing bitflip in the victim row due to repeated access of two adjacent rows. //2. Clearing out the row buffer of DRAM chip so that it is guaranteed that the wordline will be accessed to access the data printk(KERN_INFO "Rowhammer Test Starts\n"); for(counter = 0; counter < number_of_pages - 2; counter++){ //Doing the rowhammer test on every page of dram hammerRow0 = pages + counter; victimRow = hammerRow0 + page_size; hammerRow1 = victimRow + page_size; //Storing initial data into rows to check them later for errors for(i = 0; i < page_size / sizeof(char); i++){ //Setting all bits of dram 1 to maximize the possibility of charge leak hammerRow0[i] = default_value; victimRow[i] = default_value; hammerRow1[i] = default_value; } //Starting Hammer Test //printk(KERN_INFO "Rowhammer Test Starts\n"); fault = 0; for(j = 0; j < number_of_hammer_access; j++){ //hammerRow0 access //This is an x86 specific funnction that executes CLFLUSH. Mre info on CLFLUSh: https://c9x.me/x86/html/file_module_x86_id_30.html clflush_cache_range(hammerRow0, sizeof(char)); read_midvalue = hammerRow0[0]; //Reading the first value present in the page //hammerRow1 access clflush_cache_range(hammerRow1, sizeof(int)); read_midvalue = hammerRow1[0]; //Reading the first value present in the page } //Checking the victim row for errors for(i = 0; i < page_size / sizeof(int); i++){ victimRow_data = victimRow[i]; if(victimRow_data != default_value){ printk(KERN_ALERT "victimRow Fault (After Hammering) at index %d: Present Value: %x \t Expected Value: %x:\tRow numer %d\n", i, victimRow_data, 0xff, counter); fault = 1; } } if(fault == 1){ printk(KERN_ALERT "Rowhammer Test Failed\n"); return 0; } else { //printk(KERN_ALERT "Rowhammer Test Passed for Row %d\n", counter); } } printk(KERN_ALERT "Rowhammer Test Passed\n"); return 0; } static void __exit hello_exit(void){ printk(KERN_INFO "Memory Test Exit!\n"); } module_init(hello_entry); module_exit(hello_exit); //Licensing Info MODULE_LICENSE("GPL"); MODULE_AUTHOR("jonvonton"); MODULE_DESCRIPTION("Rowhammer Testing");
在内核中进行io_uring提交 我需要一个快速的异步频道将数据从我的内核模块传输到用户空间应用程序。我尝试了io_uring。就我而言,在内核中处理其提交的方式是黑匣子,...
使用特定的chardev来确保他创建的模块会收到提交。那是简单的部分。困难的部分是那里存在的
我尝试在保留的内存区域实现自己的Linux驱动程序。我在此描述中遵循:https://xilinx-wiki.atlassian.net/wiki/wiki/spaces/a/pages/18841683/linux+reserved+reserved+memory 内存
我正在运行 Debian 发行版,并且系统安装了一个外部模块。 我对冗长的帖子表示歉意,但日志有助于澄清。 khaled@kh-deb:~$ uname -a Linux kh-deb 6.12.6-amd64...
我有一个正在处理数据包的内核模块。 我有一个正在运行的微线程,将从具有 spin_lock 的列表中读取。 有一个工作队列也在从同一列表中读取。 一个...
我有一个应用程序,它有两个外部内核模块和一个用户空间守护进程。我想在启动时从用 C 编写的守护程序代码加载模块,并在干净退出时卸载它们。我可以吗
我尝试安装内核模块 xfsprogs。它已成功安装在容器内。确实令人惊讶,但 lsmod 并未在容器内或主机系统中列出该模块。 哈...
我正在学习内核编程(我是一个非常初学者) 有两个内核模块 hello.ko 和 hello2.ko,我遵循这些步骤并且我收到这些输出 正在插入模块 hello.ko ...
尝试运行 EINJ 但找不到 <debugfs mount point>/apei/einj
我正在系统上运行 CentOS Stream 10,并且我正在尝试在其上运行 EINJ。根据文档,我应该在那里找到一个名为 available_error_type 的文件,但事实并非如此。 这是...
运行modules_prepare时如何处理Yocto GCC交叉编译器中的奇怪libc.so?
当尝试为 Yocto Linux 设置交叉编译环境时,在构建 Linux 内核使用的一些主机工具时,我遇到了不寻常的构建错误。这似乎...
我的存在遇到了一些麻烦,Makefile。我正在尝试创建一个名为“can.ko”的内核模块(.ko 文件)。我正在编译十几个左右的源文件: 目标=可以 对象 =
Netfilter 内核模块未获取 FTP 数据包的数据 问题 我一直在尝试编写一个内核模块来通过netfilter读取传出的FTP数据包的用户名、密码和cmd。当我测试我的cod时...
我的老师给了我一个linux内核vmlinuz-3.17.2和一个可以加载到qemu的rootfs.ext2。他要求我构建一个最简单的内核模块,打印一个 hello world 作为作业。 首先,我
所有内核模式驱动程序和Windows内核共享相同的虚拟地址空间吗?
正如主题所述,我想知道Windows内核和所有内核模式驱动程序是否有一个单一的虚拟地址空间?所以基本上内核模式驱动程序可以访问所有 W...
我正在编写一个C守护进程,它依赖于两个内核模块的存在来完成其工作。该程序不直接使用这些(或任何其他)模块。它只需要它们存在。
我通过修补新内核版本的编译错误来保持 WIFI 驱动程序的活动。我可以针对源代码树构建它,因此我不必启动要修复它的内核。
我正在学习 poll、select 和类似的函数,并且我经常被“会阻塞”这一说法所困扰(它出现在我正在阅读的关于为 Linux 构建驱动程序的书中,并且......
我在Linux中编写了一个简单的hello world内核模块,并尝试将其加载到内核中。但这是不可能的,因为我在想加载它时收到此错误。 模块验证失败:signa...