Thread (36 messages) 36 messages, 2 authors, 2021-11-11

Re: [PATCH -rcu/kcsan 04/23] kcsan: Add core support for a subset of weak memory modeling

From: Peter Zijlstra <peterz@infradead.org>
Date: 2021-10-05 12:53:17
Also in: linux-doc, linux-kbuild, linux-mm, lkml

On Tue, Oct 05, 2021 at 12:58:46PM +0200, Marco Elver wrote:
+#if !defined(CONFIG_ARCH_WANTS_NO_INSTR) || defined(CONFIG_STACK_VALIDATION)
+/*
+ * Arch does not rely on noinstr, or objtool will remove memory barrier
+ * instrumentation, and no instrumentation of noinstr code is expected.
+ */
+#define kcsan_noinstr
I think this still wants to be at the very least:

#define kcsan_noinstr noinline notrace

without noinline it is possible LTO (or similarly daft things) will end
up inlining the calls, and since we rely on objtool to NOP out CALLs
this must not happen.

And since you want to mark these functions as uaccess_safe, there must
not be any tracing on, hence notrace.
+static inline bool within_noinstr(unsigned long ip) { return false; }
+#else
+#define kcsan_noinstr noinstr
+static __always_inline bool within_noinstr(unsigned long ip)
+{
+	return (unsigned long)__noinstr_text_start <= ip &&
+	       ip < (unsigned long)__noinstr_text_end;
+}
+#endif
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help