Commit f3cce68
block: fix off-by-one error in addr validation
The block device validated addresses from virtio descriptors before
trying to execute requests. In this validation, the `checked_offset`
function of guest memory was used to determine if the slice defined
by the sum of the address and length of the virtio descriptor was
within the guest memory bounds. However, this sum is greater than
the last valid offset, `addr + len - 1`, by 1. This made the block
device mark descriptors with slices at the very end of a region as
invalid, making the last byte of a memory region unusable by the
block device.
This check was performed as the previous guest memory model did not
have it built in. This commit removes the checks as the current guest
memory model validates the addresses before operations. Also added
regression tests for this case.
Signed-off-by: George Pisaltu <[email protected]>1 parent 2896480 commit f3cce68
2 files changed
+78
-29
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
301 | 301 | | |
302 | 302 | | |
303 | 303 | | |
304 | | - | |
305 | | - | |
306 | | - | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
307 | 308 | | |
308 | 309 | | |
309 | 310 | | |
| |||
603 | 604 | | |
604 | 605 | | |
605 | 606 | | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
606 | 640 | | |
607 | 641 | | |
608 | 642 | | |
| |||
690 | 724 | | |
691 | 725 | | |
692 | 726 | | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
693 | 760 | | |
694 | 761 | | |
695 | 762 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | 10 | | |
12 | 11 | | |
13 | 12 | | |
14 | 13 | | |
15 | | - | |
| 14 | + | |
16 | 15 | | |
17 | 16 | | |
18 | 17 | | |
| |||
159 | 158 | | |
160 | 159 | | |
161 | 160 | | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | 161 | | |
170 | 162 | | |
171 | 163 | | |
| |||
179 | 171 | | |
180 | 172 | | |
181 | 173 | | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | 174 | | |
191 | 175 | | |
192 | 176 | | |
| |||
257 | 241 | | |
258 | 242 | | |
259 | 243 | | |
260 | | - | |
| 244 | + | |
261 | 245 | | |
262 | 246 | | |
263 | 247 | | |
| |||
440 | 424 | | |
441 | 425 | | |
442 | 426 | | |
| 427 | + | |
| 428 | + | |
443 | 429 | | |
444 | 430 | | |
445 | 431 | | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | | - | |
| 432 | + | |
450 | 433 | | |
451 | 434 | | |
452 | 435 | | |
453 | 436 | | |
454 | 437 | | |
455 | 438 | | |
456 | 439 | | |
| 440 | + | |
| 441 | + | |
457 | 442 | | |
458 | 443 | | |
459 | 444 | | |
460 | | - | |
461 | | - | |
462 | | - | |
463 | | - | |
| 445 | + | |
464 | 446 | | |
465 | 447 | | |
466 | 448 | | |
| |||
0 commit comments