Fix data race in pipe_wait

==================================================================
ThreadSanitizer: data-race in pipe_wait

Read of size 4 by thread T1 (K1):
 [<     inlined    >] pipe_wait+0xdf/0x110 pipe_lock_nested /ktsan/fs/pipe.c:59
 [<     inlined    >] pipe_wait+0xdf/0x110 pipe_lock /ktsan/fs/pipe.c:68
 [<ffffffff8124a4ef>] pipe_wait+0xdf/0x110 /ktsan/fs/pipe.c:116
 [<ffffffff8124af8d>] pipe_read+0x30d/0x4b0 /ktsan/fs/pipe.c:319
 [<ffffffff8123cab5>] new_sync_read+0xf5/0x150 /ktsan/fs/read_write.c:406
 [<ffffffff8123d5b0>] vfs_read+0xe0/0x260 /ktsan/fs/read_write.c:430
 [<     inlined    >] SyS_read+0x6b/0xe0 SYSC_read /ktsan/fs/read_write.c:567
 [<ffffffff8123e9db>] SyS_read+0x6b/0xe0 /ktsan/fs/read_write.c:560
 [<ffffffff81dd5d29>] system_call_fastpath+0x16/0x1b /ktsan/arch/x86/kernel/entry_64.S:422
DBG: cpu = ffff88041fd16030

Previous write of size 4 by thread T279 (K808):
 [<ffffffff8124b35a>] put_pipe_info+0x4a/0xb0 /ktsan/fs/pipe.c:537
 [<ffffffff8124b4b3>] pipe_release+0xf3/0x150 /ktsan/fs/pipe.c:565
 [<ffffffff812400bf>] __fput+0x15f/0x310 /ktsan/fs/file_table.c:216
 [<ffffffff812402e9>] ____fput+0x19/0x30 /ktsan/fs/file_table.c:252
 [<ffffffff810b14a5>] task_work_run+0x115/0x130 /ktsan/kernel/task_work.c:123 (discriminator 1)
 [<     inlined    >] do_exit+0x515/0x13e0 exit_task_work /ktsan/include/linux/task_work.h:21
 [<ffffffff81081ae5>] do_exit+0x515/0x13e0 /ktsan/kernel/exit.c:755
 [<ffffffff8108463f>] do_group_exit+0x7f/0x140 /ktsan/kernel/exit.c:884
 [<     inlined    >] SyS_exit_group+0x1c/0x20 SYSC_exit_group /ktsan/kernel/exit.c:895
 [<ffffffff8108471c>] SyS_exit_group+0x1c/0x20 /ktsan/kernel/exit.c:893
 [<ffffffff81dd5d29>] system_call_fastpath+0x16/0x1b /ktsan/arch/x86/kernel/entry_64.S:422
DBG: cpu = 0

DBG: addr: ffff8800db985994
DBG: first offset: 4, second offset: 4
DBG: T1 clock: {T1: 62768282, T279: 18160}
DBG: T279 clock: {T279: 28289}
==================================================================
Fix race in kmem_cache_alloc

==================================================================
ThreadSanitizer: data-race in kmem_cache_alloc

Write of size 4 by thread T1 (K1):
 [<     inlined    >] kmem_cache_alloc+0x222/0x9b0 ____cache_alloc /ktsan/mm/slab.c:3083
 [<     inlined    >] kmem_cache_alloc+0x222/0x9b0 __do_cache_alloc /ktsan/mm/slab.c:3356
 [<     inlined    >] kmem_cache_alloc+0x222/0x9b0 slab_alloc /ktsan/mm/slab.c:3395
 [<ffffffff81224e32>] kmem_cache_alloc+0x222/0x9b0 /ktsan/mm/slab.c:3557
 [<     inlined    >] ida_pre_get+0x5b/0x140 kmem_cache_zalloc /ktsan/include/linux/slab.h:629
 [<     inlined    >] ida_pre_get+0x5b/0x140 __idr_pre_get /ktsan/lib/idr.c:197
 [<ffffffff814f6d5b>] ida_pre_get+0x5b/0x140 /ktsan/lib/idr.c:897
 [<ffffffff812e95fa>] proc_alloc_inum+0x7a/0x120 /ktsan/fs/proc/generic.c:136
 [<ffffffff812e96c8>] proc_register+0x28/0x200 /ktsan/fs/proc/generic.c:292
 [<ffffffff812e9b43>] proc_create_data+0x93/0xf0 /ktsan/fs/proc/generic.c:445
 [<     inlined    >] proc_dma_init+0x27/0x30 proc_create /ktsan/include/linux/proc_fs.h:34
 [<ffffffff823154b7>] proc_dma_init+0x27/0x30 /ktsan/kernel/dma.c:151
 [<ffffffff8100032d>] do_one_initcall+0xbd/0x220 /ktsan/init/main.c:794
 [<     inlined    >] kernel_init_freeable+0x2bb/0x382 do_initcall_level /ktsan/init/main.c:860
 [<     inlined    >] kernel_init_freeable+0x2bb/0x382 do_initcalls /ktsan/init/main.c:868
 [<     inlined    >] kernel_init_freeable+0x2bb/0x382 do_basic_setup /ktsan/init/main.c:887
 [<ffffffff822fd81a>] kernel_init_freeable+0x2bb/0x382 /ktsan/init/main.c:1008
 [<ffffffff810004a6>] kernel_init+0x16/0x150 /ktsan/init/main.c:938
 [<ffffffff81dd5c7c>] ret_from_fork+0x7c/0xb0 /ktsan/arch/x86/kernel/entry_64.S:347
DBG: cpu = ffff88041fc96030

Previous read of size 4 by thread T197 (K194):
 [<ffffffff812281bc>] drain_array+0x4c/0x160 /ktsan/mm/slab.c:4010
 [<ffffffff8122981c>] cache_reap+0xcc/0x340 /ktsan/mm/slab.c:4062
 [<ffffffff810ab46b>] process_one_work+0x2eb/0x750 /ktsan/kernel/workqueue.c:2027
 [<ffffffff810ac3ab>] worker_thread+0xcb/0x760 /ktsan/kernel/workqueue.c:2160
 [<ffffffff810b5fd2>] kthread+0x152/0x170 /ktsan/kernel/kthread.c:207
 [<ffffffff81dd5c7c>] ret_from_fork+0x7c/0xb0 /ktsan/arch/x86/kernel/entry_64.S:347
DBG: cpu = 0

DBG: addr: ffff88011572160c
DBG: first offset: 4, second offset: 4
DBG: T1 clock: {T1: 54287773, T197: 29170}
DBG: T197 clock: {T197: 30224}
==================================================================
Fix race in skb_queue_tail

==================================================================
ThreadSanitizer: data-race in skb_queue_tail

Write of size 8 by thread T290 (K823):
 [<     inlined    >] skb_queue_tail+0x63/0xc0 __skb_insert /ktsan/include/linux/skbuff.h:1245
 [<     inlined    >] skb_queue_tail+0x63/0xc0 __skb_queue_before /ktsan/include/linux/skbuff.h:1351
 [<     inlined    >] skb_queue_tail+0x63/0xc0 __skb_queue_tail /ktsan/include/linux/skbuff.h:1385
 [<ffffffff81a7a6e3>] skb_queue_tail+0x63/0xc0 /ktsan/net/core/skbuff.c:2320
 [<ffffffff81ae172e>] __netlink_sendskb+0x3e/0x70 /ktsan/net/netlink/af_netlink.c:1748
 [<     inlined    >] netlink_broadcast_filtered+0x2d7/0x540 netlink_broadcast_deliver /ktsan/net/netl
ink/af_netlink.c:1943
 [<     inlined    >] netlink_broadcast_filtered+0x2d7/0x540 do_one_broadcast /ktsan/net/netlink/af_ne
tlink.c:2010
 [<ffffffff81ae37f7>] netlink_broadcast_filtered+0x2d7/0x540 /ktsan/net/netlink/af_netlink.c:2055
 [<ffffffff814fa456>] kobject_uevent_env+0x4a6/0x6c0 /ktsan/lib/kobject_uevent.c:317
 [<ffffffff814fa693>] kobject_uevent+0x23/0x40 /ktsan/lib/kobject_uevent.c:375
 [<ffffffff817751f6>] uevent_store+0x76/0x80 /ktsan/drivers/base/core.c:419
 [<ffffffff81773566>] dev_attr_store+0x46/0x70 /ktsan/drivers/base/core.c:136
 [<ffffffff812fc9a1>] sysfs_kf_write+0xa1/0xd0 /ktsan/fs/sysfs/file.c:115
 [<ffffffff812fb5f5>] kernfs_fop_write+0x165/0x210 /ktsan/fs/kernfs/file.c:304
 [<ffffffff8123d843>] vfs_write+0x113/0x310 /ktsan/fs/read_write.c:532
 [<     inlined    >] SyS_write+0x6b/0xe0 SYSC_write /ktsan/fs/read_write.c:583
 [<ffffffff8123eabb>] SyS_write+0x6b/0xe0 /ktsan/fs/read_write.c:575
 [<ffffffff81dd5d29>] system_call_fastpath+0x16/0x1b /ktsan/arch/x86/kernel/entry_64.S:422
DBG: cpu = ffff88041fc96030

Previous read of size 8 by thread T289 (K822):
 [<     inlined    >] datagram_poll+0x105/0x1d0 skb_queue_empty /ktsan/include/linux/skbuff.h:906
 [<ffffffff81a873b5>] datagram_poll+0x105/0x1d0 /ktsan/net/core/datagram.c:864
 [<ffffffff81a6ebab>] sock_poll+0x9b/0x220 /ktsan/net/socket.c:1162
 [<     inlined    >] ep_send_events_proc+0x194/0x340 ep_item_poll /ktsan/fs/eventpoll.c:800
 [<ffffffff812a90c4>] ep_send_events_proc+0x194/0x340 /ktsan/fs/eventpoll.c:1509
 [<ffffffff812a9f2a>] ep_scan_ready_list+0x12a/0x360 /ktsan/fs/eventpoll.c:626
 [<     inlined    >] ep_poll+0x19e/0x5e0 ep_send_events /ktsan/fs/eventpoll.c:1557
 [<ffffffff812aa35e>] ep_poll+0x19e/0x5e0 /ktsan/fs/eventpoll.c:1660
 [<     inlined    >] SyS_epoll_wait+0x102/0x130 SYSC_epoll_wait /ktsan/fs/eventpoll.c:1998
 [<ffffffff812ac422>] SyS_epoll_wait+0x102/0x130 /ktsan/fs/eventpoll.c:1963
 [<ffffffff81dd5d29>] system_call_fastpath+0x16/0x1b /ktsan/arch/x86/kernel/entry_64.S:422
DBG: cpu = 0

DBG: addr: ffff880111dd1090
DBG: first offset: 0, second offset: 0
DBG: T290 clock: {T290: 1989957, T289: 241975}
DBG: T289 clock: {T289: 242139}
==================================================================
Merge branch 'tsan-fixes' into tsan-dev-rcu
Fix another race in skb_queue_tail

==================================================================
ThreadSanitizer: data-race in skb_queue_tail

Write of size 8 by thread T569 (K820):
 [<     inlined    >] skb_queue_tail+0x63/0xc0 __skb_insert /include/linux/skbuff.h:1245
 [<     inlined    >] skb_queue_tail+0x63/0xc0 __skb_queue_before /include/linux/skbuff.h:1351
 [<     inlined    >] skb_queue_tail+0x63/0xc0 __skb_queue_tail /include/linux/skbuff.h:1385
 [<ffffffff81a7a753>] skb_queue_tail+0x63/0xc0 /net/core/skbuff.c:2320
 [<ffffffff81be4035>] unix_dgram_sendmsg+0xa45/0xb70 /net/unix/af_unix.c:1603
 [<     inlined    >] sock_sendmsg+0x109/0x140 __sock_sendmsg_nosec /net/socket.c:634
 [<     inlined    >] sock_sendmsg+0x109/0x140 __sock_sendmsg /net/socket.c:642
 [<ffffffff81a6f299>] sock_sendmsg+0x109/0x140 /net/socket.c:653
 [<ffffffff81a6faa9>] SYSC_sendto+0x1e9/0x2d0 /net/socket.c:1812
 [<ffffffff81a70b24>] SyS_sendto+0x44/0x60 /net/socket.c:1777
 [<ffffffff81dd5da9>] system_call_fastpath+0x16/0x1b /arch/x86/kernel/entry_64.S:422
DBG: cpu = ffff88041fd16030

Previous read of size 8 by thread T568 (K818):
 [<     inlined    >] unix_dgram_poll+0x10b/0x2d0 skb_queue_empty /include/linux/skbuff.h:906
 [<ffffffff81be08cb>] unix_dgram_poll+0x10b/0x2d0 /net/unix/af_unix.c:2233
 [<ffffffff81a6ec1b>] sock_poll+0x9b/0x220 /net/socket.c:1162
 [<     inlined    >] ep_send_events_proc+0x194/0x340 ep_item_poll /fs/eventpoll.c:800
 [<ffffffff812a9134>] ep_send_events_proc+0x194/0x340 /fs/eventpoll.c:1509
 [<ffffffff812a9f9a>] ep_scan_ready_list+0x12a/0x360 /fs/eventpoll.c:626
 [<     inlined    >] ep_poll+0x19e/0x5e0 ep_send_events /fs/eventpoll.c:1557
 [<ffffffff812aa3ce>] ep_poll+0x19e/0x5e0 /fs/eventpoll.c:1660
 [<     inlined    >] SyS_epoll_wait+0x102/0x130 SYSC_epoll_wait /fs/eventpoll.c:1998
 [<ffffffff812ac492>] SyS_epoll_wait+0x102/0x130 /fs/eventpoll.c:1963
 [<ffffffff81dd5da9>] system_call_fastpath+0x16/0x1b /arch/x86/kernel/entry_64.S:422
DBG: cpu = 0

DBG: addr: ffff8800db36cb90
DBG: first offset: 0, second offset: 0
DBG: T569 clock: {T569: 139338, T568: 577943}
DBG: T568 clock: {T568: 577964}
==================================================================
Merge branch 'tsan-fixes' into tsan-dev-rcu
Merge pull request #9 from google/tsan-dev

Handle percpu synchronization
Merge pull request #10 from google/tsan-dev-fixes

Small ktsan fixes && a test for accesses with different offsets
Merge branch 'tsan' of https://github.com/google/ktsan into tsan-dev-rcu
Fix rcu && add tests for rcu
Intercept rcu_read_lock/unlock_bh/sched