Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exception Codes: KERN_PROTECTION_FAILURE at 0x00000000 Error

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x00000000

What is Kernel protection error?
Where can i find the details about Exception type and code clearly?

like image 555
muthukumar Avatar asked Dec 21 '25 15:12

muthukumar


1 Answers

You can see the full list of Mach kernel exceptions in /usr/include/mach/exception_types.h. Most if not all boil down to some flavor of “your program did something wrong”.

As hotpaw2 already told you, the specific thing you did wrong in this case was dereference NULL. You might have done this directly, in your own code, or indirectly by passing NULL to some library function or framework method. For example, passing NULL as one of the pointer arguments to memcpy is a good way to cause this crash.

Note that sending an Objective-C message to nil is OK—it does nothing and returns 0. On the other hand, passing nil as an argument in a message may not be OK. Passing nil where it isn't wanted may result in an NSException being thrown (which will cause a SIGTRAP, not SIGBUS, signal), or it may lead to some code eventually dereferencing NULL. Or it may be perfectly harmless. But you shouldn't do it unless the documentation explicitly says it's OK, because otherwise, even if it works now, it may break later.

like image 105
Peter Hosey Avatar answered Dec 23 '25 05:12

Peter Hosey