Skip to content

Commit

Permalink
rbd: bench-write should return error if io-size >= 4G
Browse files Browse the repository at this point in the history
Currently if user perform bench-write with io-size > 4G
then its crashing because currently during memory allocation
bufferptr taking size of buffer as a unsigned and io-size > 4G
will overflow with unsigned. so during memset operation it will
try to set io_size size of memory area pointed by bufferptr,
(bufferptr area is:  (4G - io_size)), so it will cause
segmentation fault.

Fix is to return error if io-size >= 4G

Fixes: http://tracker.ceph.com/issues/18422

Reported-by:  Jason Dillaman <dillaman@redhat.com>
Signed-off-by: Gaurav Kumar Garg <garg.gaurav52@gmail.com>
  • Loading branch information
gaurav36 committed Jan 10, 2017
1 parent e0acce4 commit 6ab73e5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/tools/rbd/action/Bench.cc
Expand Up @@ -196,6 +196,11 @@ int do_bench(librbd::Image& image, io_type_t io_type,
return -EINVAL;
}

if (io_size > std::numeric_limits<uint32_t>::max()) {
std::cerr << "rbd: io-size should be less than 4G" << std::endl;
return -EINVAL;
}

rbd_bencher b(&image, io_type, io_size);

std::cout << "bench "
Expand Down

0 comments on commit 6ab73e5

Please sign in to comment.