Commit 63722bbc authored by Ingo Molnar's avatar Ingo Molnar
Browse files

Merge branch 'kcsan' of...

Merge branch 'kcsan' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu

 into locking/core

Pull v5.9 KCSAN bits from Paul E. McKenney.

Perhaps the most important change is that GCC 11 now has all fixes in place
to support KCSAN, so GCC support can be enabled again.

Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parents 28cff52e 61d56d7a
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -8,7 +8,8 @@ approach to detect races. KCSAN's primary purpose is to detect `data races`_.
Usage
Usage
-----
-----


KCSAN requires Clang version 11 or later.
KCSAN is supported by both GCC and Clang. With GCC we require version 11 or
later, and with Clang also require version 11 or later.


To enable KCSAN configure the kernel with::
To enable KCSAN configure the kernel with::


+1 −1
Original line number Original line Diff line number Diff line
@@ -135,7 +135,7 @@ static inline void cpa_inc_2m_checked(void)


static inline void cpa_inc_4k_install(void)
static inline void cpa_inc_4k_install(void)
{
{
	cpa_4k_install++;
	data_race(cpa_4k_install++);
}
}


static inline void cpa_inc_lp_sameprot(int level)
static inline void cpa_inc_lp_sameprot(int level)
+2 −0
Original line number Original line Diff line number Diff line
@@ -248,6 +248,8 @@ static inline void __list_splice_init_rcu(struct list_head *list,
	 */
	 */


	sync();
	sync();
	ASSERT_EXCLUSIVE_ACCESS(*first);
	ASSERT_EXCLUSIVE_ACCESS(*last);


	/*
	/*
	 * Readers are finished with the source list, so perform splice.
	 * Readers are finished with the source list, so perform splice.
+7 −1
Original line number Original line Diff line number Diff line
@@ -359,7 +359,13 @@ struct vm_area_struct *vm_area_dup(struct vm_area_struct *orig)
	struct vm_area_struct *new = kmem_cache_alloc(vm_area_cachep, GFP_KERNEL);
	struct vm_area_struct *new = kmem_cache_alloc(vm_area_cachep, GFP_KERNEL);


	if (new) {
	if (new) {
		*new = *orig;
		ASSERT_EXCLUSIVE_WRITER(orig->vm_flags);
		ASSERT_EXCLUSIVE_WRITER(orig->vm_file);
		/*
		 * orig->shared.rb may be modified concurrently, but the clone
		 * will be reinitialized.
		 */
		*new = data_race(*orig);
		INIT_LIST_HEAD(&new->anon_vma_chain);
		INIT_LIST_HEAD(&new->anon_vma_chain);
		new->vm_next = new->vm_prev = NULL;
		new->vm_next = new->vm_prev = NULL;
	}
	}
+6 −3
Original line number Original line Diff line number Diff line
@@ -7,8 +7,11 @@ CFLAGS_REMOVE_core.o = $(CC_FLAGS_FTRACE)
CFLAGS_REMOVE_debugfs.o = $(CC_FLAGS_FTRACE)
CFLAGS_REMOVE_debugfs.o = $(CC_FLAGS_FTRACE)
CFLAGS_REMOVE_report.o = $(CC_FLAGS_FTRACE)
CFLAGS_REMOVE_report.o = $(CC_FLAGS_FTRACE)


CFLAGS_core.o := $(call cc-option,-fno-conserve-stack,) \
CFLAGS_core.o := $(call cc-option,-fno-conserve-stack) \
	$(call cc-option,-fno-stack-protector,)
	-fno-stack-protector -DDISABLE_BRANCH_PROFILING


obj-y := core.o debugfs.o report.o
obj-y := core.o debugfs.o report.o
obj-$(CONFIG_KCSAN_SELFTEST) += test.o
obj-$(CONFIG_KCSAN_SELFTEST) += selftest.o

CFLAGS_kcsan-test.o := $(CFLAGS_KCSAN) -g -fno-omit-frame-pointer
obj-$(CONFIG_KCSAN_TEST) += kcsan-test.o
Loading