diff options
author | Luis R. Rodriguez <mcgrof@kernel.org> | 2015-11-05 11:16:47 -0800 |
---|---|---|
committer | Luis R. Rodriguez <mcgrof@kernel.org> | 2016-02-11 08:42:16 -0800 |
commit | 90400e43eb107f125b2234240f80c60e0e0ae0dd (patch) | |
tree | b5cfe8937a644f95c55963ca8180640d9aaea74a | |
parent | 448e7177faf7cb19fb45157360d463d6195e8868 (diff) | |
download | linker-tables-90400e43eb107f125b2234240f80c60e0e0ae0dd.tar.gz |
kasan: mimic the kernel's setup
Kasan has 2 tier calls, an early init call followed by
a setup_arch() specific call. Our work will be to find
a solution that fits using the tables.
Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
-rw-r--r-- | kasan.c | 21 | ||||
-rw-r--r-- | kasan.h | 1 | ||||
-rw-r--r-- | start_kernel.c | 3 | ||||
-rw-r--r-- | x86.c | 6 | ||||
-rw-r--r-- | xen.c | 4 |
5 files changed, 13 insertions, 22 deletions
@@ -6,6 +6,7 @@ static bool __is_kasan_setup = false; int kasan_early_init(void) { + printf("Early init for Kasan...\n"); __is_kasan_setup = true; return 0; } @@ -15,22 +16,8 @@ bool is_kasan_setup(void) return __is_kasan_setup; } -static int init_kasan(void) { - sleep(1); - +void setup_arch_kasan(void) { if (!is_kasan_setup()) - return -EOPNOTSUPP; - - return 0; + return; + printf("Calling setup_arch work for Kasan...\n"); } - -static int detect_kasan(void) { - return 1; -} - -struct init_fn kasan_init_fn __init_fn(INIT_EARLY) = { - .detect = detect_kasan, - .early_init = init_kasan, - .name = "Kasan", - .critical = true, -}; @@ -1,4 +1,5 @@ #include <stdbool.h> int kasan_early_init(void); +void setup_arch_kasan(void); bool is_kasan_setup(void); diff --git a/start_kernel.c b/start_kernel.c index 266f5c5..8f3b1ae 100644 --- a/start_kernel.c +++ b/start_kernel.c @@ -5,8 +5,9 @@ int start_kernel(void) { + printf("Calling start_kernel()...\n"); + setup_arch(); return late_init(); } - @@ -17,8 +17,8 @@ static int x86_64_start_kernel(void) { int ret; - sort_table(__tbl, __tbl_end); - check_table_entries(__tbl, __tbl_end); + sort_table(__tbl, __tbl_end); + check_table_entries(__tbl, __tbl_end); ret = early_init(); if (ret) { @@ -42,4 +42,6 @@ int startup_64(void) void setup_arch(void) { setup_arch_init(); + if (is_kasan_setup()) + setup_arch_kasan(); } @@ -19,8 +19,8 @@ int startup_xen(void) __booting_xen = true; - sort_table(__tbl, __tbl_end); - check_table_entries(__tbl, __tbl_end); + sort_table(__tbl, __tbl_end); + check_table_entries(__tbl, __tbl_end); ret = early_init(); if (ret) { |