blob: 8d47f456e928be9199d4b308eabdb5ef79a07bf1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#include <stdarg.h>
#include "stdio.h"
#include "stdlib.h"
// abaos has a kernel_panic function
// TODO: we should not need this stub, rather, libc functions should
// use other means to abort the process (e.g. with abort), then the
// kernel should catch this exception and issue the kernel_panic itself.
// anyway: the kernel has to decide whether it dies in panic or it
// kills the culprid child an merely goes his way..
void kernel_panic( const char *format, ... )
{
(void)printf( "\n*** KERNEL PANIC ***\n" );
va_list args;
va_start( args, format );
(void)vprintf( format, args );
va_end( args );
puts( "" );
exit( 255 );
}
uintptr_t __stack_chk_guard = STACK_CHK_GUARD;
__attribute__( ( noreturn ) )
void __stack_chk_fail_local( void )
{
abort( );
}
__attribute__( ( noreturn ) )
void __stack_chk_fail( void )
{
kernel_panic( "Stack smashing detected!" );
// make gcc happy on noreturn does return
for( ;; );
}
|