Apparatus and method for dynamic detection of kernel stack overflow on operating system

A device and a method for detecting kernel stack overflow in an OS(Operating System) are provided to detect the kernel stack overflow by adding a protected area at the last part of a stack area allocated in a fixed size, and inducing page fault when a stack pointer enters the protected area. A kernel stack manager(310) initializes a stack by adding a protected area at the end part of a stack area when a kernel stack is generated. A page fault handler(320) outputs an error message when a page fault exception is generated when overflow occurs in the kernel stack. A virtual memory manager(330) manages addressing a memory used by the kernel and addressing the kernel stack. A page frame allocator(340) manages the memory in a page unit, and maps the memory to a virtual memory when the memory is allocated. The protected area of the stack area is allocated in one page unit and is initialized in a state that a physical page is not allocated.