]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
mgr/DaemonServer.cc: prevent integer underflow that is triggered by large increases... 41862/head
authorCory Snyder <csnyder@iland.com>
Fri, 28 May 2021 19:08:49 +0000 (15:08 -0400)
committerCory Snyder <csnyder@iland.com>
Tue, 15 Jun 2021 13:44:58 +0000 (09:44 -0400)
commit67c46c837f0fefa972bfe1e4fa6f795900d5b816
treecc838ed382c005d815abb8192cc3414118e4dff7
parent35be045edfba00bec8492fe76abf8c384f2ebbac
mgr/DaemonServer.cc: prevent integer underflow that is triggered by large increases to pg_num/pgp_num

This fixes a scenario where mgrs continually crash while attempting to apply large increases to pg_num/pgp_num. The max step size (estmax) for each incremental update to the pgp_num is calculated as a percentage of the pg_num, which permits the possibility for the max step size (estmax) to be greater than the current pgp_num when the increase is large; this causes an integer underflow when the max step size is subtracted from the pgp_num in order to calculate the next step size with std::clamp. The integer underflow causes hi < lo in args passed to std::clamp, which causes a failed assertion, SIGABRT, and ultimately crashing mgr.

Fixes: https://tracker.ceph.com/issues/47738
Signed-off-by: Cory Snyder <csnyder@iland.com>
(cherry picked from commit b4316d257e928b3789b818054927c2e98bb3c0d6)
src/mgr/DaemonServer.cc