Commit ead91de
mm/vmalloc: fix data race in show_numa_info()
commit 5c5f0468d172ddec2e333d738d2a1f85402cf0bc upstream.
The following data-race was found in show_numa_info():
==================================================================
BUG: KCSAN: data-race in vmalloc_info_show / vmalloc_info_show
read to 0xffff88800971fe30 of 4 bytes by task 8289 on cpu 0:
show_numa_info mm/vmalloc.c:4936 [inline]
vmalloc_info_show+0x5a8/0x7e0 mm/vmalloc.c:5016
seq_read_iter+0x373/0xb40 fs/seq_file.c:230
proc_reg_read_iter+0x11e/0x170 fs/proc/inode.c:299
....
write to 0xffff88800971fe30 of 4 bytes by task 8287 on cpu 1:
show_numa_info mm/vmalloc.c:4934 [inline]
vmalloc_info_show+0x38f/0x7e0 mm/vmalloc.c:5016
seq_read_iter+0x373/0xb40 fs/seq_file.c:230
proc_reg_read_iter+0x11e/0x170 fs/proc/inode.c:299
....
value changed: 0x0000008f -> 0x00000000
==================================================================
According to this report,there is a read/write data-race because
m->private is accessible to multiple CPUs. To fix this, instead of
allocating the heap in proc_vmalloc_init() and passing the heap address to
m->private, vmalloc_info_show() should allocate the heap.
Link: https://lkml.kernel.org/r/[email protected]
Fixes: 8e1d743 ("mm: vmalloc: support multiple nodes in vmallocinfo")
Signed-off-by: Jeongjun Park <[email protected]>
Suggested-by: Eric Dumazet <[email protected]>
Suggested-by: Andrew Morton <[email protected]>
Reviewed-by: "Uladzislau Rezki (Sony)" <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>1 parent 679bf9a commit ead91de
1 file changed
+35
-28
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3095 | 3095 | | |
3096 | 3096 | | |
3097 | 3097 | | |
3098 | | - | |
| 3098 | + | |
3099 | 3099 | | |
3100 | 3100 | | |
3101 | 3101 | | |
| |||
4938 | 4938 | | |
4939 | 4939 | | |
4940 | 4940 | | |
4941 | | - | |
4942 | | - | |
4943 | | - | |
4944 | | - | |
4945 | | - | |
4946 | 4941 | | |
4947 | | - | |
4948 | | - | |
| 4942 | + | |
| 4943 | + | |
| 4944 | + | |
| 4945 | + | |
| 4946 | + | |
| 4947 | + | |
| 4948 | + | |
| 4949 | + | |
| 4950 | + | |
| 4951 | + | |
| 4952 | + | |
4949 | 4953 | | |
4950 | | - | |
4951 | | - | |
4952 | | - | |
4953 | | - | |
| 4954 | + | |
| 4955 | + | |
4954 | 4956 | | |
4955 | | - | |
| 4957 | + | |
4956 | 4958 | | |
4957 | | - | |
4958 | | - | |
4959 | | - | |
4960 | | - | |
4961 | | - | |
4962 | | - | |
| 4959 | + | |
| 4960 | + | |
| 4961 | + | |
| 4962 | + | |
| 4963 | + | |
4963 | 4964 | | |
4964 | 4965 | | |
4965 | 4966 | | |
| |||
4987 | 4988 | | |
4988 | 4989 | | |
4989 | 4990 | | |
| 4991 | + | |
| 4992 | + | |
| 4993 | + | |
| 4994 | + | |
4990 | 4995 | | |
4991 | 4996 | | |
4992 | 4997 | | |
| |||
5003 | 5008 | | |
5004 | 5009 | | |
5005 | 5010 | | |
| 5011 | + | |
| 5012 | + | |
| 5013 | + | |
| 5014 | + | |
| 5015 | + | |
5006 | 5016 | | |
5007 | 5017 | | |
5008 | 5018 | | |
| |||
5037 | 5047 | | |
5038 | 5048 | | |
5039 | 5049 | | |
5040 | | - | |
| 5050 | + | |
| 5051 | + | |
| 5052 | + | |
5041 | 5053 | | |
5042 | 5054 | | |
5043 | 5055 | | |
| |||
5047 | 5059 | | |
5048 | 5060 | | |
5049 | 5061 | | |
| 5062 | + | |
| 5063 | + | |
5050 | 5064 | | |
5051 | 5065 | | |
5052 | 5066 | | |
5053 | 5067 | | |
5054 | 5068 | | |
5055 | | - | |
5056 | | - | |
5057 | | - | |
5058 | | - | |
5059 | | - | |
5060 | | - | |
5061 | | - | |
5062 | | - | |
| 5069 | + | |
5063 | 5070 | | |
5064 | 5071 | | |
5065 | 5072 | | |
| |||
0 commit comments