From: Greg Kroah-Hartman Date: Thu, 15 Jul 2021 11:21:57 +0000 (+0200) Subject: 5.4-stable patches X-Git-Tag: v5.4.133~60 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d7001543b3f0977a609f6096f11428d5f8e2ba76;p=thirdparty%2Fkernel%2Fstable-queue.git 5.4-stable patches added patches: crypto-ccp-annotate-sev-firmware-file-names.patch fscrypt-don-t-ignore-minor_hash-when-hash-is-0.patch perf-bench-fix-2-memory-sanitizer-warnings.patch --- diff --git a/queue-5.4/crypto-ccp-annotate-sev-firmware-file-names.patch b/queue-5.4/crypto-ccp-annotate-sev-firmware-file-names.patch new file mode 100644 index 00000000000..625cb098e86 --- /dev/null +++ b/queue-5.4/crypto-ccp-annotate-sev-firmware-file-names.patch @@ -0,0 +1,40 @@ +From c8671c7dc7d51125ab9f651697866bf4a9132277 Mon Sep 17 00:00:00 2001 +From: Joerg Roedel +Date: Mon, 26 Apr 2021 10:17:48 +0200 +Subject: crypto: ccp - Annotate SEV Firmware file names + +From: Joerg Roedel + +commit c8671c7dc7d51125ab9f651697866bf4a9132277 upstream. + +Annotate the firmware files CCP might need using MODULE_FIRMWARE(). +This will get them included into an initrd when CCP is also included +there. Otherwise the CCP module will not find its firmware when loaded +before the root-fs is mounted. +This can cause problems when the pre-loaded SEV firmware is too old to +support current SEV and SEV-ES virtualization features. + +Fixes: e93720606efd ("crypto: ccp - Allow SEV firmware to be chosen based on Family and Model") +Cc: stable@vger.kernel.org # v4.20+ +Acked-by: Tom Lendacky +Signed-off-by: Joerg Roedel +Signed-off-by: Herbert Xu +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/crypto/ccp/psp-dev.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/drivers/crypto/ccp/psp-dev.c ++++ b/drivers/crypto/ccp/psp-dev.c +@@ -40,6 +40,10 @@ static int psp_probe_timeout = 5; + module_param(psp_probe_timeout, int, 0644); + MODULE_PARM_DESC(psp_probe_timeout, " default timeout value, in seconds, during PSP device probe"); + ++MODULE_FIRMWARE("amd/amd_sev_fam17h_model0xh.sbin"); /* 1st gen EPYC */ ++MODULE_FIRMWARE("amd/amd_sev_fam17h_model3xh.sbin"); /* 2nd gen EPYC */ ++MODULE_FIRMWARE("amd/amd_sev_fam19h_model0xh.sbin"); /* 3rd gen EPYC */ ++ + static bool psp_dead; + static int psp_timeout; + diff --git a/queue-5.4/fscrypt-don-t-ignore-minor_hash-when-hash-is-0.patch b/queue-5.4/fscrypt-don-t-ignore-minor_hash-when-hash-is-0.patch new file mode 100644 index 00000000000..acd873b523a --- /dev/null +++ b/queue-5.4/fscrypt-don-t-ignore-minor_hash-when-hash-is-0.patch @@ -0,0 +1,59 @@ +From 77f30bfcfcf484da7208affd6a9e63406420bf91 Mon Sep 17 00:00:00 2001 +From: Eric Biggers +Date: Thu, 27 May 2021 16:52:36 -0700 +Subject: fscrypt: don't ignore minor_hash when hash is 0 + +From: Eric Biggers + +commit 77f30bfcfcf484da7208affd6a9e63406420bf91 upstream. + +When initializing a no-key name, fscrypt_fname_disk_to_usr() sets the +minor_hash to 0 if the (major) hash is 0. + +This doesn't make sense because 0 is a valid hash code, so we shouldn't +ignore the filesystem-provided minor_hash in that case. Fix this by +removing the special case for 'hash == 0'. + +This is an old bug that appears to have originated when the encryption +code in ext4 and f2fs was moved into fs/crypto/. The original ext4 and +f2fs code passed the hash by pointer instead of by value. So +'if (hash)' actually made sense then, as it was checking whether a +pointer was NULL. But now the hashes are passed by value, and +filesystems just pass 0 for any hashes they don't have. There is no +need to handle this any differently from the hashes actually being 0. + +It is difficult to reproduce this bug, as it only made a difference in +the case where a filename's 32-bit major hash happened to be 0. +However, it probably had the largest chance of causing problems on +ubifs, since ubifs uses minor_hash to do lookups of no-key names, in +addition to using it as a readdir cookie. ext4 only uses minor_hash as +a readdir cookie, and f2fs doesn't use minor_hash at all. + +Fixes: 0b81d0779072 ("fs crypto: move per-file encryption from f2fs tree to fs/crypto") +Cc: # v4.6+ +Link: https://lore.kernel.org/r/20210527235236.2376556-1-ebiggers@kernel.org +Signed-off-by: Eric Biggers +Signed-off-by: Greg Kroah-Hartman + +--- + fs/crypto/fname.c | 9 ++------- + 1 file changed, 2 insertions(+), 7 deletions(-) + +--- a/fs/crypto/fname.c ++++ b/fs/crypto/fname.c +@@ -273,13 +273,8 @@ int fscrypt_fname_disk_to_usr(struct ino + oname->name); + return 0; + } +- if (hash) { +- digested_name.hash = hash; +- digested_name.minor_hash = minor_hash; +- } else { +- digested_name.hash = 0; +- digested_name.minor_hash = 0; +- } ++ digested_name.hash = hash; ++ digested_name.minor_hash = minor_hash; + memcpy(digested_name.digest, + FSCRYPT_FNAME_DIGEST(iname->name, iname->len), + FSCRYPT_FNAME_DIGEST_SIZE); diff --git a/queue-5.4/perf-bench-fix-2-memory-sanitizer-warnings.patch b/queue-5.4/perf-bench-fix-2-memory-sanitizer-warnings.patch new file mode 100644 index 00000000000..727f512625b --- /dev/null +++ b/queue-5.4/perf-bench-fix-2-memory-sanitizer-warnings.patch @@ -0,0 +1,52 @@ +From d2c73501a767514b6c85c7feff9457a165d51057 Mon Sep 17 00:00:00 2001 +From: Ian Rogers +Date: Fri, 11 Sep 2020 22:37:25 -0700 +Subject: perf bench: Fix 2 memory sanitizer warnings + +From: Ian Rogers + +commit d2c73501a767514b6c85c7feff9457a165d51057 upstream. + +Memory sanitizer warns if a write is performed where the memory being +read for the write is uninitialized. Avoid this warning by initializing +the memory. + +Signed-off-by: Ian Rogers +Acked-by: Jiri Olsa +Cc: Alexander Shishkin +Cc: Mark Rutland +Cc: Namhyung Kim +Cc: Peter Zijlstra +Cc: Stephane Eranian +Link: http://lore.kernel.org/lkml/20200912053725.1405857-1-irogers@google.com +Signed-off-by: Arnaldo Carvalho de Melo +Cc: Anders Roxell +Signed-off-by: Greg Kroah-Hartman + +--- + tools/perf/bench/sched-messaging.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/tools/perf/bench/sched-messaging.c ++++ b/tools/perf/bench/sched-messaging.c +@@ -66,11 +66,10 @@ static void fdpair(int fds[2]) + /* Block until we're ready to go */ + static void ready(int ready_out, int wakefd) + { +- char dummy; + struct pollfd pollfd = { .fd = wakefd, .events = POLLIN }; + + /* Tell them we're ready. */ +- if (write(ready_out, &dummy, 1) != 1) ++ if (write(ready_out, "R", 1) != 1) + err(EXIT_FAILURE, "CLIENT: ready write"); + + /* Wait for "GO" signal */ +@@ -85,6 +84,7 @@ static void *sender(struct sender_contex + unsigned int i, j; + + ready(ctx->ready_out, ctx->wakefd); ++ memset(data, 'S', sizeof(data)); + + /* Now pump to every receiver. */ + for (i = 0; i < nr_loops; i++) { diff --git a/queue-5.4/series b/queue-5.4/series index 38567e16a96..a5125ff00d7 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -69,3 +69,6 @@ sctp-validate-from_addr_param-return.patch sctp-add-size-validation-when-walking-chunks.patch mips-loongsoon64-reserve-memory-below-starting-pfn-t.patch mips-set-mips32r5-for-virt-extensions.patch +fscrypt-don-t-ignore-minor_hash-when-hash-is-0.patch +crypto-ccp-annotate-sev-firmware-file-names.patch +perf-bench-fix-2-memory-sanitizer-warnings.patch