aboutsummaryrefslogtreecommitdiff
path: root/libs/libc/inc/def.h
diff options
context:
space:
mode:
authorMarvin Borner2021-04-02 23:26:28 +0200
committerMarvin Borner2021-04-02 23:26:28 +0200
commitce98400f8a9ebd4e62e76b9e292b7598d0d66cc0 (patch)
tree823f06c2c325ead611863eeb3ac974c1ae562878 /libs/libc/inc/def.h
parentfe468b476d567b6aa0695a030c408ccf46278c7d (diff)
Added kernel section clear/protect after init
This is a huge security improvement as it prevents potential exploits of using or modifying internal kernel functions or data.
Diffstat (limited to 'libs/libc/inc/def.h')
-rw-r--r--libs/libc/inc/def.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/libs/libc/inc/def.h b/libs/libc/inc/def.h
index 583a351..f1201b9 100644
--- a/libs/libc/inc/def.h
+++ b/libs/libc/inc/def.h
@@ -23,7 +23,7 @@ typedef unsigned long long u64;
* Macros
*/
-#define UNUSED(__a) ((void)(__a))
+#define UNUSED(a) ((void)(a))
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
@@ -32,6 +32,7 @@ typedef unsigned long long u64;
#define ATTR __attribute__
#define NORETURN ATTR((noreturn))
+#define NOINLINE ATTR((noinline))
#define DEPRECATED ATTR((deprecated))
#define NONNULL ATTR((nonnull))
#define PURE ATTR((pure))
@@ -44,7 +45,11 @@ typedef unsigned long long u64;
#define UNUSED_FUNC ATTR((unused))
#define NO_SANITIZE ATTR((no_sanitize("undefined")))
#define ALIGNED(align) ATTR((aligned(align)))
-#define SECTION(section) ATTR((section(section)))
+
+#ifdef KERNEL
+#define CLEAR NOINLINE ATTR((section(".temp_clear")))
+#define PROTECTED ATTR((section(".temp_protect")))
+#endif
#define EOF (-1)
#define NULL ((void *)0)