Skip to content
Advertisement

System crash with Linux CryptoApi Module

I tried to write Linux kernel module with cryptoapi. I found some examples like this: https://codedream.me/2014/04/cryptoapi-linux-kernel/

This example is working for me. Then I made some changes. Now my system crashes, when I try to load module. Can you help me with this?

JavaScript

When variable len = 1000, module is loaded normal. But if I change it on len = 5000, I get system crash when I load module.

My system is: Linux ubuntu-virtual-machine 3.13.0-65-generic #105-Ubuntu SMP Mon Sep 21 18:50:58 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Advertisement

Answer

You’re probably running out of stack space. Stack in kernel threads is extremely limited; allocating 15 KB (5000 x 3) of data on the stack is not going to work.

Use kmalloc() and kfree() to allocate large buffers.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement