lib: debug: add common stack protection feature in lk
-fstack-protector is added in lk and corresponding
__stack_chk_fail function and __stack_chk_guard.
CRs-Fixed: 671500
Change-Id: I2ac186affa311005c4d727c8cd00a93c8f5014c9
diff --git a/lib/debug/debug.c b/lib/debug/debug.c
index bdc2d02..84d0678 100644
--- a/lib/debug/debug.c
+++ b/lib/debug/debug.c
@@ -1,6 +1,8 @@
/*
* Copyright (c) 2008 Travis Geiselbrecht
*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ *
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files
* (the "Software"), to deal in the Software without restriction,
@@ -32,6 +34,13 @@
#include <platform/debug.h>
#include <kernel/thread.h>
#include <kernel/timer.h>
+#include <rand.h>
+
+void __attribute__ ((noreturn))
+__stack_chk_fail (void)
+{
+ panic("stack smashing detected.");
+}
void spin(uint32_t usecs)
{