Commit 5c966f4
mm/vmalloc: fix data race in show_numa_info()
commit 5c5f046 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/20250508165620.15321-1-aha310510@gmail.com
Fixes: 8e1d743 ("mm: vmalloc: support multiple nodes in vmallocinfo")
Signed-off-by: Jeongjun Park <aha310510@gmail.com>
Suggested-by: Eric Dumazet <edumazet@google.com>
Suggested-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: "Uladzislau Rezki (Sony)" <urezki@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent 80c25d7 commit 5c966f4
1 file changed
Lines changed: 35 additions & 28 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3100 | 3100 | | |
3101 | 3101 | | |
3102 | 3102 | | |
3103 | | - | |
| 3103 | + | |
3104 | 3104 | | |
3105 | 3105 | | |
3106 | 3106 | | |
| |||
4934 | 4934 | | |
4935 | 4935 | | |
4936 | 4936 | | |
4937 | | - | |
4938 | | - | |
4939 | | - | |
4940 | | - | |
4941 | | - | |
4942 | 4937 | | |
4943 | | - | |
4944 | | - | |
| 4938 | + | |
| 4939 | + | |
| 4940 | + | |
| 4941 | + | |
| 4942 | + | |
| 4943 | + | |
| 4944 | + | |
| 4945 | + | |
| 4946 | + | |
| 4947 | + | |
| 4948 | + | |
4945 | 4949 | | |
4946 | | - | |
4947 | | - | |
4948 | | - | |
4949 | | - | |
| 4950 | + | |
| 4951 | + | |
4950 | 4952 | | |
4951 | | - | |
| 4953 | + | |
4952 | 4954 | | |
4953 | | - | |
4954 | | - | |
4955 | | - | |
4956 | | - | |
4957 | | - | |
4958 | | - | |
| 4955 | + | |
| 4956 | + | |
| 4957 | + | |
| 4958 | + | |
| 4959 | + | |
4959 | 4960 | | |
4960 | 4961 | | |
4961 | 4962 | | |
| |||
4983 | 4984 | | |
4984 | 4985 | | |
4985 | 4986 | | |
| 4987 | + | |
| 4988 | + | |
| 4989 | + | |
| 4990 | + | |
4986 | 4991 | | |
4987 | 4992 | | |
4988 | 4993 | | |
| |||
4999 | 5004 | | |
5000 | 5005 | | |
5001 | 5006 | | |
| 5007 | + | |
| 5008 | + | |
| 5009 | + | |
| 5010 | + | |
| 5011 | + | |
5002 | 5012 | | |
5003 | 5013 | | |
5004 | 5014 | | |
| |||
5033 | 5043 | | |
5034 | 5044 | | |
5035 | 5045 | | |
5036 | | - | |
| 5046 | + | |
| 5047 | + | |
| 5048 | + | |
5037 | 5049 | | |
5038 | 5050 | | |
5039 | 5051 | | |
| |||
5043 | 5055 | | |
5044 | 5056 | | |
5045 | 5057 | | |
| 5058 | + | |
| 5059 | + | |
5046 | 5060 | | |
5047 | 5061 | | |
5048 | 5062 | | |
5049 | 5063 | | |
5050 | 5064 | | |
5051 | | - | |
5052 | | - | |
5053 | | - | |
5054 | | - | |
5055 | | - | |
5056 | | - | |
5057 | | - | |
5058 | | - | |
| 5065 | + | |
5059 | 5066 | | |
5060 | 5067 | | |
5061 | 5068 | | |
| |||
0 commit comments