Re: [PATCH v3 04/25] kcsan: Add core support for a subset of weak memory modeling

From: Marco Elver
Date: Fri Dec 03 2021 - 03:56:58 EST


On Tue, Nov 30, 2021 at 12:44PM +0100, Marco Elver wrote:
[...]
> v3:
> * Remove kcsan_noinstr hackery, since we now try to avoid adding any
> instrumentation to .noinstr.text in the first place.
[...]

I missed some cleanups after changes from v2 to v3 -- the below cleanup
is missing.

Full replacement patch attached.

Thanks,
-- Marco

------ >8 ------

diff --git a/kernel/kcsan/core.c b/kernel/kcsan/core.c
index 2254cb75cbb0..916060913966 100644
--- a/kernel/kcsan/core.c
+++ b/kernel/kcsan/core.c
@@ -12,7 +12,6 @@
#include <linux/delay.h>
#include <linux/export.h>
#include <linux/init.h>
-#include <linux/instrumentation.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/moduleparam.h>
@@ -21,8 +20,6 @@
#include <linux/sched.h>
#include <linux/uaccess.h>

-#include <asm/sections.h>
-
#include "encoding.h"
#include "kcsan.h"
#include "permissive.h"
@@ -1086,9 +1083,7 @@ noinline void __tsan_func_entry(void *call_pc)
if (!IS_ENABLED(CONFIG_KCSAN_WEAK_MEMORY))
return;

- instrumentation_begin();
add_kcsan_stack_depth(1);
- instrumentation_end();
}
EXPORT_SYMBOL(__tsan_func_entry);

@@ -1100,7 +1095,6 @@ noinline void __tsan_func_exit(void)
if (!IS_ENABLED(CONFIG_KCSAN_WEAK_MEMORY))
return;

- instrumentation_begin();
reorder_access = get_reorder_access(get_ctx());
if (!reorder_access)
goto out;
@@ -1120,7 +1114,6 @@ noinline void __tsan_func_exit(void)
}
out:
add_kcsan_stack_depth(-1);
- instrumentation_end();
}
EXPORT_SYMBOL(__tsan_func_exit);