Skip to content

Commit a49b345

Browse files
committed
Add panic error code for heap corruption
Currently, the memory allocator does not trigger a kernel panic on detected corruption or invalid operations. However, once the heap is corrupted, the kernel can no longer guarantee safe or correct behavior. Introduce ERR_HEAP_CORRUPT with a corresponding error message to prepare for future panic-on-error handling in the memory allocator.
1 parent 84fd57c commit a49b345

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

include/private/error.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ enum {
2727

2828
/* Memory Protection Errors */
2929
ERR_STACK_CHECK, /* Stack overflow or corruption detected */
30+
ERR_HEAP_CORRUPT, /* Heap corruption or invalid free detected */
3031

3132
/* IPC and Synchronization Errors */
3233
ERR_PIPE_ALLOC, /* Pipe allocation failed */

kernel/error.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ static const struct error_code error_desc[] = {
2222

2323
/* stack guard */
2424
{ERR_STACK_CHECK, "stack corruption"},
25+
{ERR_HEAP_CORRUPT, "heap corruption or invalid free"},
2526

2627
/* IPC / sync */
2728
{ERR_PIPE_ALLOC, "pipe allocation"},

0 commit comments

Comments
 (0)