linux报无法分配内存,在Linux中插入模块时出错 - 1无法分配内存(error inserting a module in Linux — 1 Cannot allocate memory)...

在Linux中插入模块时出错 - 1无法分配内存(error inserting a module in Linux — 1 Cannot allocate memory)

eCryptfs是一个符合POSIX标准的加密文件系统,自2.6.19版以来一直是主线Linux内核的一部分。

当我尝试插入模块(ecryptfs.ko)时,我收到以下错误:

insmod:插入'ecryptfs.ko'时出错:-1无法分配内存

有人可以帮帮我吗?

下面是dmesg

Failed to allocate one or more kmem_cache objects

kmem_cache_create: duplicate cache ecryptfs_auth_tok_list_item

Pid: 3332, comm: insmod Tainted: G O 3.2.2+ #1

Call Trace:

[] ? printk+0x15/0x17

[] kmem_cache_create+0x41c/0x458

[] ecryptfs_init+0x38/0x1b1 [ecryptfs]

[] do_one_initcall+0x71/0x118

[] ? 0xd0ebcfff

[] sys_init_module+0x60/0x18c

[] sysenter_do_call+0x12/0x36

ecryptfs_init_kmem_caches: ecryptfs_auth_tok_list_item: kmem_cache_create

failed

Failed to allocate one or more kmem_cache objects

eCryptfs is a POSIX-compliant encrypted filesystem that has been part of the mainline Linux Kernel since version 2.6.19.

When I try to insert the module (ecryptfs.ko), I get the following error:

insmod: error inserting 'ecryptfs.ko': -1 Cannot allocate memory

Can some one please help me out?

below is the dmesg

Failed to allocate one or more kmem_cache objects

kmem_cache_create: duplicate cache ecryptfs_auth_tok_list_item

Pid: 3332, comm: insmod Tainted: G O 3.2.2+ #1

Call Trace:

[] ? printk+0x15/0x17

[] kmem_cache_create+0x41c/0x458

[] ecryptfs_init+0x38/0x1b1 [ecryptfs]

[] do_one_initcall+0x71/0x118

[] ? 0xd0ebcfff

[] sys_init_module+0x60/0x18c

[] sysenter_do_call+0x12/0x36

ecryptfs_init_kmem_caches: ecryptfs_auth_tok_list_item: kmem_cache_create

failed

Failed to allocate one or more kmem_cache objects

原文:https://stackoverflow.com/questions/10262510

更新时间:2019-11-23 08:51

最满意答案

从您在dmesg中看到的错误开始:

kmem_cache_create: duplicate cache ecryptfs_auth_tok_list_item

加载ecryptfs模块时,它首先要为自己创建一堆内存缓存。 该错误表明已存在具有该名称的缓存。

您可以通过查看sysfs来检查缓存是否已存在:

$ ls -ld /sys/kernel/slab/ecryptfs*

NB。 由于板坯合并,它可能不会出现在/proc/slabinfo 。

如果你看到任何表明已经加载了ecryptfs模块的ecryptfs slab,或者它已经内置在你的内核中。

通常情况下,模块加载器不会让你加载同一个模块两次,但也许你做了一些奇怪的事情来混淆它。

A likely cause of something like this happening is if one recompiles and installs a kernel and its modules but forgets to mount /boot before installing the kernel. After a reboot, one will then run with the old kernel but new modules. In any event, check that the running kernel is current, and reinstall both the kernel and the modules if in doubt:

mount /boot

cd /usr/src/linux

make && make install && make modules_install

I have done the above steps and error was solved

2012-04-22

相关问答

你有没有为cat.subjects分配内存 cat.subject = [[NSMutableArray alloc] init];

要么 subject = [[NSMutableArray alloc] init];

在你的Category课程? 如果没有那就去做吧。 这可能是问题之一。 更新 首先从Category *cat = [Category alloc];更改您的代码Category *cat = [Category alloc]; to Category *cat = [[Ca

...

至于你的第一个问题 - 模块本身的限制是64兆字节。 模块加载器将拒绝加载超过此大小的模块。 从kernel / module.c : if (len > 64 * 1024 * 1024 || (hdr = vmalloc(len)) == NULL)

return ERR_PTR(-ENOMEM);

对于2.6.32以及对于较新的内核也是如此,高达3.3。 编辑:在内核版本3.4中, 删除了64 Mb限制。 现在实际的限制只取决于vmalloc()可以分配多少内存。 If I

...

我想到了。 问题是我为虚拟机指定的ram的数量,它是1024MB,现在我有512MB,没关系,现在我需要找到如何提高这个数量的ram,512不是那么多,机器有点滞后。 I figured it out. The problem was in the amount of ram I had specified for the virtual machine, and it was 1024MB, now I have 512MB and it is ok, now I need to find ho

...

从您在dmesg中看到的错误开始: kmem_cache_create: duplicate cache ecryptfs_auth_tok_list_item

加载ecryptfs模块时,它首先要为自己创建一堆内存缓存。 该错误表明已存在具有该名称的缓存。 您可以通过查看sysfs来检查缓存是否已存在: $ ls -ld /sys/kernel/slab/ecryptfs*

NB。 由于板坯合并,它可能不会出现在/proc/slabinfo 。 如果你看到任何表明已经加载了ecryptfs模

...

首先,你不能分配一点(在现代系统中甚至不是一个字节),因为你无法解决它。 存储器地址始终提供具有数据总线宽度的数据(例如,64位)。 如果你想模仿按位分配@ godel9是对的。 我更喜欢 ptr = malloc((numbits % 8) + 1).

First of all you cannot allocate a bit (not even a byte in modern systems) because you can't address it. A memory address

...

malloc在 。 包括那个。 阅读该函数的手册页会给你这些信息。 它不依赖于编译器。 malloc is in . Include that. Reading the man page for that function would have given you that information. It's not compiler-dependent.

为什么分配内存是必要的? 因此,您将内存标记为您的内存。 没有其他人可以使用它。 它还验证实际上有可用内存。 如果你的系统只有1000字节的内存,那么选择字节1500来存储一些数据是一个坏主意。 如果我们使用内存而不分配它会发生什么? 没人知道。 您写的地址可能不存在。 可能已经开始使用其他进程,因此您将覆盖其数据。 记忆可以得到保护; 例如,在前一种情况下,操作系统可能会注意到您正在访问另一个进程已声明的内存,并阻止您。 您可能拥有该内存区域,但程序的另一部分由于某种原因正在使用它,并且您已经覆

...

要检查内存泄漏,您可能希望在Valgrind下运行该程序: http : //valgrind.org 要从控制台/ shell获取/设置限制,可以使用ulimit命令。 从程序内部,系统调用getrlimit() / setrlimit()提供此功能。 内存可能因fork()而变得紧张的情况的另一种解决方法是使用vfork() ,然后立即调用exec*()系列函数。 从man vfork : vfork()是clone(2)的一个特例。 它用于创建新进程而无需复制父进程的页表。 在创建子项然后立

...

我没有得到的是内核如何存储这些结构,或者它如何为它们分配空间。 因为对于订单0页面,您需要1M条目(每个是4KiB页面),这是否意味着内核分配1MiB * sizeof(结构页面)? 通过调用paging_init()来完成区域的初始化(arch / x86 / mm / init_32.c;一些描述 - https://www.kernel.org/doc/gorman/html/understand/understand005.html 2.3区域初始化和http ://repo.hacker

...

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值