FreeBSD Bugzilla – Attachment 174080 Details for
Bug 212139
r298900 introduced a fatal failure case for >2TB disk size reporting bugs
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Prevent read-ahead from crossing 32 bit aliases of end-of-disk
p (text/plain), 1.14 KB, created by
Peter Wemm
on 2016-08-25 22:18:20 UTC
(
hide
)
Description:
Prevent read-ahead from crossing 32 bit aliases of end-of-disk
Filename:
MIME Type:
Creator:
Peter Wemm
Created:
2016-08-25 22:18:20 UTC
Size:
1.14 KB
patch
obsolete
>Index: biosdisk.c >=================================================================== >--- biosdisk.c (revision 304792) >+++ biosdisk.c (working copy) >@@ -497,7 +497,7 @@ > char *buf, size_t *rsize) > { > struct disk_devdesc *dev = (struct disk_devdesc *)devdata; >- int blks; >+ int blks, remaining; > #ifdef BD_SUPPORT_FRAGS /* XXX: sector size */ > char fragbuf[BIOSDISK_SECSIZE]; > size_t fragsize; >@@ -513,14 +513,15 @@ > if (rsize) > *rsize = 0; > >- if (dblk >= BD(dev).bd_sectors) { >- DEBUG("IO past disk end %llu", (unsigned long long)dblk); >- return (EIO); >- } >- >- if (dblk + blks > BD(dev).bd_sectors) { >- /* perform partial read */ >- blks = BD(dev).bd_sectors - dblk; >+ /* >+ * Perform partial read to prevent read-ahead crossing >+ * the end of disk - or any 32 bit aliases of the end. >+ * Signed arithmetic is used to handle wrap-around cases >+ * like we do for TCP sequence numbers. >+ */ >+ remaining = (int)(BD(dev).bd_sectors - dblk); /* truncate */ >+ if (remaining > 0 && remaining < blks) { >+ blks = remaining; > size = blks * BD(dev).bd_sectorsize; > DEBUG("short read %d", blks); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 212139
:
174052
|
174075
| 174080