mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

Blame SOURCES/0092-lib-Increase-default-memsize-to-1280-RHBZ-1837765.patch

498672
From ee88832841e82a407c9df44a82b87270ec0d492b Mon Sep 17 00:00:00 2001
498672
From: "Richard W.M. Jones" <rjones@redhat.com>
498672
Date: Tue, 30 Jun 2020 17:34:47 +0100
498672
Subject: [PATCH] lib: Increase default memsize to 1280 (RHBZ#1837765).
498672
498672
Argon2 is the default LUKS Password-Based Key Derivation Function
498672
(PBKDF) for some new guests such as RHEL 8.2 and Fedora.  It is
498672
designed to be "memory hard", meaning that by design it requires large
498672
amounts of memory, making it expensive to brute-force.  Unfortunately
498672
the default for guests which had more than a few GB of RAM at install
498672
time is to require about 1 GB of RAM to decrypt the block device,
498672
which is considerably larger than the default available in the
498672
libguestfs appliance.
498672
498672
To make it possible to open these encrypted disks we need to make the
498672
appliance larger.  This could be done as a one-off, and the current
498672
workaround is simply to set LIBGUESTFS_MEMSIZE=2048 or a similar
498672
amount.  However since we don't know in advance whether we could be
498672
dealing with an encrypted disk, partition, etc. or what PBKDF it uses,
498672
the only way to deal with this in all circumstances is to increase the
498672
default memsize.  This commit increases it quite a lot (768 -> 1280)
498672
which is unfortunate.
498672
498672
Note as there is some confusion on this point: Since libguestfs does
498672
not attempt to decrypt disks in parallel, you only need ~ 1GB in
498672
total, not per encrypted disk.
498672
498672
For a reproducer, see:
498672
https://bugzilla.redhat.com/show_bug.cgi?id=1837765#c14
498672
498672
(cherry picked from commit 224f373043302845122bf701ffc6e3416e0168fa)
498672
---
498672
 lib/guestfs-internal.h | 6 +++---
498672
 1 file changed, 3 insertions(+), 3 deletions(-)
498672
498672
diff --git a/lib/guestfs-internal.h b/lib/guestfs-internal.h
498672
index 75b8a5c8e..30553d7c0 100644
498672
--- a/lib/guestfs-internal.h
498672
+++ b/lib/guestfs-internal.h
498672
@@ -94,7 +94,7 @@
498672
  * creating device nodes.
498672
  */
498672
 #ifdef __powerpc__
498672
-#  define DEFAULT_MEMSIZE 1024
498672
+#  define DEFAULT_MEMSIZE 1280
498672
 #endif
498672
 
498672
 /* Kernel 3.19 is unable to uncompress the initramfs on aarch64 unless
498672
@@ -103,12 +103,12 @@
498672
  * common on aarch64, treat this like the ppc case above.
498672
  */
498672
 #ifdef __aarch64__
498672
-#  define DEFAULT_MEMSIZE 1024
498672
+#  define DEFAULT_MEMSIZE 1280
498672
 #endif
498672
 
498672
 /* The default and minimum memory size for most users. */
498672
 #ifndef DEFAULT_MEMSIZE
498672
-#  define DEFAULT_MEMSIZE 768
498672
+#  define DEFAULT_MEMSIZE 1280
498672
 #endif
498672
 #ifndef MIN_MEMSIZE
498672
 #  define MIN_MEMSIZE 256
498672
-- 
498672
2.18.4
498672