GEOM's stripeoffset overflows at 4 gigabyte margin (2^32) because of its u_int type. This leads to incorrect data in the output generated by "sysctl kern.geom.confxml" command, "graid list" etc. when GEOM array has volumes larger than 4G.
Details
Create an array with first RAID1 volume /dev/raid/r0 spanning first 4097 megabytes of ada0 and ada1 disks:
$ graid label -S 4097M Promise r0 RAID1 ada0 ada1
Then, add second SINGLE volume /dev/raid/r1 to the same array utilizing the rest of ada0:
$ graid label Promise r1 SINGLE ada0 $ graid list | grep -A4 raid/r1 2. Name: raid/r1 Mediasize: 6374293504 (5.9G) Sectorsize: 512 Stripesize: 0 Stripeoffset: 1048576
It shows stripeoffset as 1M instead of 4097M due to overflow in the GEOM despite of right 64 bit offsets within GEOM_RAID itself.
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
As I have written in private: I see no big problem here, while applying this breaks an ABIs (BTW there should be bumped disk ABI version). But other thoughts are welcome.
Does this change break ABI or KBI ? Or both ?
Some providers take stripesize/offset in create, e.g. nop. Do they need a fix included into the change ?
sys/geom/geom.h | ||
---|---|---|
204 ↗ | (On Diff #36356) | I do not like the gap between sectorsize and stripesize. |
sys/geom/geom_disk.h | ||
---|---|---|
100 ↗ | (On Diff #36356) | Thanks! Done. |
sys/geom/geom.h | ||
---|---|---|
204 ↗ | (On Diff #36356) | Do you mean that compiler will use 8-byte alignment ffo "stripesize", so "sectorsize" should be moved nead the end of the struct? |
The 'yes' answer to tri-state question is not informative.
If there is ABI breakage, its impact must be evaluated. It could be that this change is not acceptable if affecting symver-ed interfaces.
I believe this is a KBI breakage. I don't think it's an ABI breakage. But I don't see any changes to libgeom.
I believe this is a KBI breakage. I don't think it's an ABI breakage. But I don't see any changes to libgeom.
libgeom already uses off_t/ssize_t/strtoumax for stripesize/stripeoffset.
Yes, I've missed that part, thanks. More changes added for geom_nop and geom_stripe (but not its on-disk metadata), and for geom_redboot (not sure if it's connected to build, though).
All changes are within kernel land only and ioctls DIOCGSTRIPE{SIZE|OFFSET} already use off_t.