summaryrefslogtreecommitdiff
path: root/kernel/fork.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2020-08-01 09:25:21 +0200
committerIngo Molnar <mingo@kernel.org>2020-08-01 09:26:27 +0200
commit63722bbca662b19eb39fe709c11a5fa3994b4c3f (patch)
tree845060d13c90891cb89f18e29c40cf6dfdebe850 /kernel/fork.c
parent28cff52eaeb5c43144d0c730080aff0d6bc1e5d5 (diff)
parent61d56d7aa5eca3b909bce51ba8125b0fa44d7e17 (diff)
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: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/fork.c')
-rw-r--r--kernel/fork.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index 56a640799680..0cc3d9cd6cc2 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -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);
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);
new->vm_next = new->vm_prev = NULL;
}