Commit 79ea4a4
committed
iommufd/selftest: Fix buffer read overrrun in the dirty test
test_bit() is used to read the memory storing the bitmap, however
test_bit() always uses a unsigned long 8 byte access.
If the bitmap is not an aligned size of 64 bits this will now trigger a
KASAN warning reading past the end of the buffer.
Properly round the buffer allocation to an unsigned long size. Continue to
copy_from_user() using a byte granularity.
Fixes: 9560393 ("iommufd/selftest: Fix iommufd_test_dirty() to handle <u8 bitmaps")
Link: https://patch.msgid.link/r/[email protected]
Reviewed-by: Joao Martins <[email protected]>
Reviewed-by: Kevin Tian <[email protected]>
Signed-off-by: Jason Gunthorpe <[email protected]>1 parent 1d4684f commit 79ea4a4
1 file changed
+4
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1343 | 1343 | | |
1344 | 1344 | | |
1345 | 1345 | | |
1346 | | - | |
| 1346 | + | |
1347 | 1347 | | |
1348 | 1348 | | |
1349 | 1349 | | |
| |||
1364 | 1364 | | |
1365 | 1365 | | |
1366 | 1366 | | |
1367 | | - | |
1368 | | - | |
1369 | | - | |
| 1367 | + | |
| 1368 | + | |
1370 | 1369 | | |
1371 | 1370 | | |
1372 | 1371 | | |
1373 | 1372 | | |
1374 | 1373 | | |
1375 | | - | |
| 1374 | + | |
1376 | 1375 | | |
1377 | 1376 | | |
1378 | 1377 | | |
| |||
0 commit comments