-3

Is there any protection provided by kernel? Because when we tried to allocate memory using an malloc() from user space, the kernel allowed to allocated around 124 MB of memory, and when we try to write into it, the kernel crashed. If there was protection of kernel memory area, this wouldn't have happened

5
  • 3
    Show the complete code and describe environment. And it is "kernel" not "kernal".
    – ygrek
    Apr 1, 2010 at 9:47
  • @basu sagar: Did you intend to undo the spelling correction to your question title?
    – CB Bailey
    Apr 6, 2010 at 6:57
  • 1
    @sagar - Please post the code in question, if possible.
    – user50049
    Apr 6, 2010 at 10:55
  • 3
    I voted to delete my own answer, as the edited question is now completely different from the original question, and thus my answer no longer makes any sense.
    – janneb
    Apr 6, 2010 at 11:30
  • This question still doesn't make sense. kmalloc() is a kernel space API for kernel memory allocation so it wouldn't make sense for user-space. @sagar can you post the code in question to make it clear?
    – stsquad
    Apr 6, 2010 at 17:23

2 Answers 2

5

In kernel-space there is no memory protection. Then again, malloc() isn't available in kernel-space, so what are you asking?

1

Allocating memory in the kernel requires special consideration. It would be very helpful if you could post your code, or better explain your need for 'guaranteed' memory within kernel space.

Please keep in mind, kernel space is not _infinite_, in user space the kernel is what manages overcommitment. You have a very, very hard limit on memory within the kernel and lots of consumers competing to use it.

Again, if you post your code, many here could help you come up with a better design, which I believe is what you probably need.

Note, the link is from 2006. This illustrates my other point, what version of the kernel are you working with?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.