Commit 14a5a70
Revert "null_blk: allow byte aligned memory offsets"
This reverts commit 3451cf3 and fixes
the following KASAN complaint when running test zbd/013:
BUG: KASAN: slab-use-after-free in null_handle_data_transfer+0x88c/0xe50 [null_blk]
Write of size 4096 at addr ffff8881ab162000 by task (udev-worker)/78072
CPU: 8 UID: 0 PID: 78072 Comm: (udev-worker) Not tainted 6.18.0-rc5-dbg #14 PREEMPT 737e33391e24fa2fcd9958673f6992b5ee131a07
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
<TASK>
show_stack+0x4d/0x60
dump_stack_lvl+0x61/0x80
print_address_description.constprop.0+0x8b/0x310
print_report+0xfd/0x1d7
kasan_report+0xde/0x1c0
kasan_check_range+0x10c/0x1f0
__asan_memcpy+0x3f/0x70
null_handle_data_transfer+0x88c/0xe50 [null_blk]
null_process_cmd+0x1a4/0x370 [null_blk]
null_process_zoned_cmd+0x1ff/0x3c0 [null_blk]
null_handle_cmd+0x1bd/0x580 [null_blk]
null_queue_rq+0x568/0x970 [null_blk]
null_queue_rqs+0xe5/0x2b0 [null_blk]
__blk_mq_flush_list+0x83/0xb0
blk_mq_dispatch_queue_requests+0x3d7/0x660
blk_mq_flush_plug_list+0x1a1/0x730
__blk_flush_plug+0x290/0x540
blk_finish_plug+0x53/0xc0
read_pages+0x456/0xad0
page_cache_ra_unbounded+0x3cd/0x6e0
force_page_cache_ra+0x1f0/0x370
page_cache_sync_ra+0x158/0x870
filemap_get_pages+0x327/0xcb0
filemap_read+0x336/0xd30
blkdev_read_iter+0x15c/0x430
vfs_read+0x79a/0x1150
ksys_read+0xfd/0x230
__x64_sys_read+0x76/0xc0
x64_sys_call+0x143c/0x17e0
do_syscall_64+0x96/0x360
entry_SYSCALL_64_after_hwframe+0x4b/0x53
</TASK>
Allocated by task 0 on cpu 0 at 3226.274686s:
kasan_save_stack+0x2a/0x50
kasan_save_track+0x1c/0x70
kasan_save_alloc_info+0x3d/0x50
__kasan_kmalloc+0xa0/0xb0
__kmalloc_cache_noprof+0x2e9/0x8a0
kmem_cache_free+0x590/0x870
mempool_free_slab+0x1b/0x20
mempool_free+0xd1/0x9b0
bio_free+0x15e/0x1c0
bio_put+0x34f/0x790
bio_endio+0x31d/0x6c0
blk_update_request+0x425/0xfb0
blk_mq_end_request+0x5d/0x370
null_cmd_timer_expired+0x43/0x60 [null_blk]
__hrtimer_run_queues+0x53e/0xb40
hrtimer_interrupt+0x32f/0x850
__sysvec_apic_timer_interrupt+0xdc/0x360
sysvec_apic_timer_interrupt+0xa4/0xe0
asm_sysvec_apic_timer_interrupt+0x1f/0x30
Freed by task 14 on cpu 0 at 3226.398721s:
kasan_save_stack+0x2a/0x50
kasan_save_track+0x1c/0x70
__kasan_save_free_info+0x3f/0x60
__kasan_slab_free+0x67/0x80
kfree+0x170/0x780
slab_free_after_rcu_debug+0x6c/0x250
rcu_do_batch+0x369/0x13f0
rcu_core+0x385/0x5a0
rcu_core_si+0x12/0x20
handle_softirqs+0x1a3/0x930
run_ksoftirqd+0x3e/0x60
smpboot_thread_fn+0x311/0xa00
kthread+0x3cc/0x830
ret_from_fork+0x39c/0x500
ret_from_fork_asm+0x11/0x20
Last potentially related work creation:
kasan_save_stack+0x2a/0x50
kasan_record_aux_stack+0xad/0xc0
__call_rcu_common.constprop.0+0xfb/0xbb0
call_rcu+0x12/0x20
kmem_cache_free+0x5bc/0x870
mempool_free_slab+0x1b/0x20
mempool_free+0xd1/0x9b0
bio_free+0x15e/0x1c0
bio_put+0x34f/0x790
bio_endio+0x31d/0x6c0
blk_update_request+0x425/0xfb0
blk_mq_end_request+0x5d/0x370
null_cmd_timer_expired+0x43/0x60 [null_blk]
__hrtimer_run_queues+0x53e/0xb40
hrtimer_interrupt+0x32f/0x850
__sysvec_apic_timer_interrupt+0xdc/0x360
sysvec_apic_timer_interrupt+0xa4/0xe0
asm_sysvec_apic_timer_interrupt+0x1f/0x30
The buggy address belongs to the object at ffff8881ab162000
which belongs to the cache kmalloc-32 of size 32
The buggy address is located 0 bytes inside of
freed 32-byte region [ffff8881ab162000, ffff8881ab162020)
Cc: Keith Busch <[email protected]>
Signed-off-by: Bart Van Assche <[email protected]>1 parent c622f6c commit 14a5a70
2 files changed
Lines changed: 22 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1130 | 1130 | | |
1131 | 1131 | | |
1132 | 1132 | | |
1133 | | - | |
| 1133 | + | |
1134 | 1134 | | |
1135 | 1135 | | |
| 1136 | + | |
1136 | 1137 | | |
1137 | | - | |
1138 | 1138 | | |
1139 | 1139 | | |
1140 | | - | |
1141 | | - | |
1142 | | - | |
| 1140 | + | |
1143 | 1141 | | |
1144 | 1142 | | |
1145 | 1143 | | |
1146 | 1144 | | |
| 1145 | + | |
1147 | 1146 | | |
1148 | 1147 | | |
1149 | 1148 | | |
1150 | 1149 | | |
1151 | 1150 | | |
1152 | | - | |
1153 | | - | |
| 1151 | + | |
1154 | 1152 | | |
1155 | 1153 | | |
1156 | 1154 | | |
1157 | 1155 | | |
1158 | 1156 | | |
1159 | 1157 | | |
1160 | 1158 | | |
1161 | | - | |
| 1159 | + | |
1162 | 1160 | | |
1163 | 1161 | | |
1164 | 1162 | | |
1165 | 1163 | | |
1166 | | - | |
| 1164 | + | |
1167 | 1165 | | |
1168 | 1166 | | |
1169 | 1167 | | |
| 1168 | + | |
1170 | 1169 | | |
1171 | | - | |
1172 | 1170 | | |
1173 | 1171 | | |
1174 | | - | |
1175 | | - | |
1176 | | - | |
| 1172 | + | |
1177 | 1173 | | |
| 1174 | + | |
1178 | 1175 | | |
1179 | 1176 | | |
| 1177 | + | |
1180 | 1178 | | |
1181 | | - | |
1182 | | - | |
| 1179 | + | |
| 1180 | + | |
1183 | 1181 | | |
1184 | 1182 | | |
1185 | 1183 | | |
1186 | 1184 | | |
1187 | | - | |
| 1185 | + | |
1188 | 1186 | | |
1189 | 1187 | | |
1190 | 1188 | | |
| |||
1230 | 1228 | | |
1231 | 1229 | | |
1232 | 1230 | | |
1233 | | - | |
| 1231 | + | |
1234 | 1232 | | |
1235 | 1233 | | |
1236 | 1234 | | |
| |||
1242 | 1240 | | |
1243 | 1241 | | |
1244 | 1242 | | |
1245 | | - | |
| 1243 | + | |
1246 | 1244 | | |
1247 | 1245 | | |
1248 | | - | |
| 1246 | + | |
1249 | 1247 | | |
1250 | 1248 | | |
1251 | 1249 | | |
| |||
1255 | 1253 | | |
1256 | 1254 | | |
1257 | 1255 | | |
1258 | | - | |
| 1256 | + | |
1259 | 1257 | | |
1260 | 1258 | | |
1261 | 1259 | | |
| |||
1273 | 1271 | | |
1274 | 1272 | | |
1275 | 1273 | | |
1276 | | - | |
| 1274 | + | |
1277 | 1275 | | |
1278 | 1276 | | |
1279 | 1277 | | |
| |||
1285 | 1283 | | |
1286 | 1284 | | |
1287 | 1285 | | |
1288 | | - | |
| 1286 | + | |
1289 | 1287 | | |
1290 | 1288 | | |
1291 | 1289 | | |
1292 | | - | |
| 1290 | + | |
1293 | 1291 | | |
1294 | 1292 | | |
1295 | 1293 | | |
| |||
1946 | 1944 | | |
1947 | 1945 | | |
1948 | 1946 | | |
1949 | | - | |
1950 | 1947 | | |
1951 | 1948 | | |
1952 | 1949 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
242 | 242 | | |
243 | 243 | | |
244 | 244 | | |
245 | | - | |
| 245 | + | |
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
| |||
0 commit comments