]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: use portable zero-ing memory function
authorYuanXin <yuanxin@didiglobal.com>
Sat, 27 Feb 2021 03:37:19 +0000 (11:37 +0800)
committerJason Dillaman <dillaman@redhat.com>
Mon, 1 Mar 2021 18:25:50 +0000 (13:25 -0500)
Signed-off-by: YuanXin <yuanxin@didiglobal.com>
(cherry picked from commit 72c04a9d319520c29dfdf952408beb12ed73a88e)

src/librbd/crypto/luks/LoadRequest.cc
src/tools/rbd_nbd/rbd-nbd.cc

index 2b0dbe47d25dfe7ca1e536ab3dad1a2656bcec60..f23b7ec8b01eeaa24343df046a7dfb9562b6dce2 100644 (file)
@@ -212,7 +212,7 @@ void LoadRequest<I>::read_volume_key() {
 
 template <typename I>
 void LoadRequest<I>::finish(int r) {
-  explicit_bzero(&m_passphrase[0], m_passphrase.size());
+  ceph_memzero_s(&m_passphrase[0], m_passphrase.size(), m_passphrase.size());
   m_on_finish->complete(r);
   delete this;
 }
index 3a13ff82fb1ccaffd15b8e54512d45d02f463c1d..044808830084c65100786133cabb73f590dd4b6a 100644 (file)
@@ -1660,7 +1660,7 @@ static int do_map(int argc, const char *argv[], Config *cfg, bool reconnect)
     std::string passphrase((std::istreambuf_iterator<char>(file)),
                            (std::istreambuf_iterator<char>()));
     auto sg = make_scope_guard([&] {
-      explicit_bzero(&passphrase[0], passphrase.size()); });
+      ceph_memzero_s(&passphrase[0], passphrase.size(), passphrase.size()); });
     file.close();
     if (!passphrase.empty() && passphrase[passphrase.length() - 1] == '\n') {
       passphrase.erase(passphrase.length() - 1);