aboutsummaryrefslogtreecommitdiff
path: root/include/apos/canary.h
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2022-09-14 21:30:11 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2022-09-14 21:30:11 +0300
commitcabbf335824db0df835e4c541c19d3803ce38454 (patch)
treee7397d2b6637545b8e18f26135e3ad2a0a2fbe1e /include/apos/canary.h
parent025778e89e7d0fe3cd1ad53537c9cc6f3cd819cc (diff)
downloadkmi-cabbf335824db0df835e4c541c19d3803ce38454.tar.gz
kmi-cabbf335824db0df835e4c541c19d3803ce38454.zip
add canary to kernel stack
Diffstat (limited to 'include/apos/canary.h')
-rw-r--r--include/apos/canary.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/include/apos/canary.h b/include/apos/canary.h
new file mode 100644
index 0000000..30a3dd2
--- /dev/null
+++ b/include/apos/canary.h
@@ -0,0 +1,27 @@
+#ifndef APOS_CANARY_H
+#define APOS_CANARY_H
+
+/**
+ * @file canary.h
+ * Kernel stack canary handling.
+ */
+
+#include <apos/tcb.h>
+#include <apos/types.h>
+
+/**
+ * Place canary at end of kernel stack.
+ *
+ * @param t \ref tcb whose kernel stack to place canary in.
+ */
+void set_canary(struct tcb *t);
+
+/**
+ * Check that canary hasn't been accidentally overwritten.
+ *
+ * @param t \ref tcb whose kernel stack canary to check.
+ * @return \ref true if overwritten, \ref false otherwise.
+ */
+bool check_canary(struct tcb *t);
+
+#endif /* APOS_CANARY_H */