Common Sources of a Kernel Panic when Developing a Kernel Module

A common issues for the errors like this:

[896809] kernel panic - not syncing: Fatal exception

is probably, because of a bad memory allocation or utilization. For instance:

  • You haven’t allocated enough memory space and then, if you try to access or put an element at a certain memory position, in which doesn’ t exist you’re gonna have kernel panic. This is similar to what happens if you are working on userspace level, but instead of getting ‘kernel panic’ you’ll probably get ‘segmentation fault’ as the error.
  • You have a pointer variable which is not currently pointing at any memory space. It’s NULL. In this way, if you try to use that pointer with the operator ‘->’, you will get ‘kernel panic’ as well. This is similar to what would happen on userpace level, but instead of getting ‘kernel panic’, we probably would get something like ‘segmentation fault’ or simply, the program freezes.
  • You have a quite long run loop and at each iteration, kernel memory allocation is happening, which may result in lack of memory space.

Hope I helped you,

That’s all.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s