Commit d7d94ae
ublk: use unchecked copy helpers for bio page data
Bio pages may originate from slab caches that lack a usercopy region
(e.g. jbd2 frozen metadata buffers allocated via jbd2_alloc()).
When CONFIG_HARDENED_USERCOPY is enabled, copy_to_iter() calls
check_copy_size() which rejects these slab pages, triggering a
kernel BUG in usercopy_abort().
This is a false positive: the data is ordinary block I/O content —
the same data the loop/nbd driver writes to its backing file via
vfs_iter_write(). The bvec length is always trusted, so the size
check in check_copy_size() is not needed either.
Switch to _copy_to_iter()/_copy_from_iter() which skip the
check_copy_size() wrapper while the underlying copy_to_user()
remains unchanged.
Fixes: 2299cee ("ublk: use copy_{to,from}_iter() for user copy")
Signed-off-by: Ming Lei <[email protected]>1 parent 3236861 commit d7d94ae
1 file changed
Lines changed: 10 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1281 | 1281 | | |
1282 | 1282 | | |
1283 | 1283 | | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
1284 | 1292 | | |
1285 | | - | |
| 1293 | + | |
1286 | 1294 | | |
1287 | | - | |
| 1295 | + | |
1288 | 1296 | | |
1289 | 1297 | | |
1290 | 1298 | | |
| |||
0 commit comments