Bug #4773
closedrbd: have rbd_obj_method_sync() return transfer count
0%
Description
Callers of rbd_obj_method_sync() don't know how many bytes of data
got returned by the class method call. As a result, they have been
assuming enough got returned to decode whatever was expected.
This isn't safe. We know how many bytes got transferred, so have
rbd_obj_method_sync() return that amount (rather than just 0) if
the call is successful.
Change all callers to use this return value to ensure decoding of
the results is done safely.
Signed-off-by: Alex Elder <elder@inktank.com>
Updated by Alex Elder almost 11 years ago
- Target version set to v0.62a
I've implemented these fixes and will post them for
review after I've done some better testing.
I also made a few more miscellaneous changes, which I'll
just add to this bug.
First two patches that flesh out some code. I've been
carrying these around but there's no reason not to just
check them in.
libceph: validate timespec conversions A ceph timespec contains 32-bit unsigned values for its seconds and nanoseconds components. For a standard timespec, both fields are signed, and the seconds field is almost surely 64 bits. Add some explicit casts so the fact that this conversion is taking place is obvious. Also trip a bug if we ever try to put out of range (negative or too big) values into a ceph timespec. Signed-off-by: Alex Elder <elder@inktank.com>
libceph: add signed type limits Flesh out the limits defined in <linux/ceph/decode.h> to include the maximum and minimum values for signed type S8, S16, S32, and S64. Signed-off-by: Alex Elder <elder@inktank.com>
Next, two cleanups:
rbd: void data pointers for rbd_obj_method_sync() Make the inbound and outbound data parameters have void rather than character type for rbd_obj_method_sync(). This makes it more clear they don't expect typed data, and eliminates the need for some silly type casts. One more unrelated change: define the features buffer used in _rbd_dev_v2_snap_features() to be a packed data structure. Signed-off-by: Alex Elder <elder@inktank.com>
rbd: give rbd_obj_read_sync() buffer void type Make the buf parameter into which the data is to be read have type void pointer. Signed-off-by: Alex Elder <elder@inktank.com>
Updated by Alex Elder almost 11 years ago
- Status changed from In Progress to Fix Under Review
The following have been posted for review, and are
available in the "review/wip-stripe-v2" branch of
the ceph-client git repository.
[PATCH 1/2] libceph: add signed type limits
[PATCH 2/2] libceph: validate timespec conversions
[PATCH 1/2] rbd: give rbd_obj_read_sync() buffer void type
[PATCH 2/2] rbd: void data pointers for rbd_obj_method_sync()
[PATCH] rbd: have rbd_obj_method_sync() return transfer count
Updated by Alex Elder almost 11 years ago
- Status changed from Fix Under Review to Resolved
The following have been committed to the "testing" branch of
the ceph-client git repository.
3ad6cbd9 libceph: add signed type limits
7de8ad4 libceph: validate timespec conversions
48cd1f3 rbd: give rbd_obj_read_sync() buffer void type
d77e581 rbd: void data pointers for rbd_obj_method_sync()
9f203f3 rbd: have rbd_obj_method_sync() return transfer count