From 4fbdd4d7cee1d1a743b7f36489ae14e26cd7bbaf Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 5 Oct 2022 12:47:59 +0200 Subject: [PATCH] 6.0-stable patches added patches: fix-coredump-breakage.patch --- queue-6.0/fix-coredump-breakage.patch | 48 +++++++++++++++++++++++++++ queue-6.0/series | 1 + 2 files changed, 49 insertions(+) create mode 100644 queue-6.0/fix-coredump-breakage.patch create mode 100644 queue-6.0/series diff --git a/queue-6.0/fix-coredump-breakage.patch b/queue-6.0/fix-coredump-breakage.patch new file mode 100644 index 00000000000..bfc2630f7c7 --- /dev/null +++ b/queue-6.0/fix-coredump-breakage.patch @@ -0,0 +1,48 @@ +From 4f526fef91b24197d489ff86789744c67f475bb4 Mon Sep 17 00:00:00 2001 +From: Al Viro +Date: Mon, 3 Oct 2022 20:26:08 -0400 +Subject: [brown paperbag] fix coredump breakage + +From: Al Viro + +commit 4f526fef91b24197d489ff86789744c67f475bb4 upstream. + +Let me count the ways in which I'd screwed up: + +* when emitting a page, handling of gaps in coredump should happen +before fetching the current file position. +* fix for a problem that occurs on rather uncommon setups (and hadn't +been observed in the wild) had been sent very late in the cycle. +* ... with badly insufficient testing, introducing an easily +reproducible breakage. Without giving it time to soak in -next. + +Fucked-up-by: Al Viro +Reported-by: "J. R. Okajima" +Tested-by: "J. R. Okajima" +Fixes: 06bbaa6dc53c "[coredump] don't use __kernel_write() on kmap_local_page()" +Cc: stable@kernel.org # v6.0-only +Signed-off-by: Al Viro +Signed-off-by: Greg Kroah-Hartman +--- + fs/coredump.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/fs/coredump.c ++++ b/fs/coredump.c +@@ -841,7 +841,7 @@ static int dump_emit_page(struct coredum + }; + struct iov_iter iter; + struct file *file = cprm->file; +- loff_t pos = file->f_pos; ++ loff_t pos; + ssize_t n; + + if (cprm->to_skip) { +@@ -853,6 +853,7 @@ static int dump_emit_page(struct coredum + return 0; + if (dump_interrupted()) + return 0; ++ pos = file->f_pos; + iov_iter_bvec(&iter, WRITE, &bvec, 1, PAGE_SIZE); + n = __kernel_write_iter(cprm->file, &iter, &pos); + if (n != PAGE_SIZE) diff --git a/queue-6.0/series b/queue-6.0/series new file mode 100644 index 00000000000..e18b247983f --- /dev/null +++ b/queue-6.0/series @@ -0,0 +1 @@ +fix-coredump-breakage.patch -- 2.47.3