]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Drop coredump-standartize-and-fix-logging.patch
authorSasha Levin <sashal@kernel.org>
Mon, 7 Oct 2024 18:46:17 +0000 (14:46 -0400)
committerSasha Levin <sashal@kernel.org>
Mon, 7 Oct 2024 18:46:17 +0000 (14:46 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-6.10/coredump-standartize-and-fix-logging.patch [deleted file]
queue-6.10/series
queue-6.11/coredump-standartize-and-fix-logging.patch [deleted file]
queue-6.11/series
queue-6.6/coredump-standartize-and-fix-logging.patch [deleted file]
queue-6.6/series

diff --git a/queue-6.10/coredump-standartize-and-fix-logging.patch b/queue-6.10/coredump-standartize-and-fix-logging.patch
deleted file mode 100644 (file)
index a91cbc5..0000000
+++ /dev/null
@@ -1,178 +0,0 @@
-From f0a5649db30d6ff2509281ace680db9cc08ce258 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 18 Jul 2024 11:27:24 -0700
-Subject: coredump: Standartize and fix logging
-
-From: Roman Kisel <romank@linux.microsoft.com>
-
-[ Upstream commit c114e9948c2b6a0b400266e59cc656b59e795bca ]
-
-The coredump code does not log the process ID and the comm
-consistently, logs unescaped comm when it does log it, and
-does not always use the ratelimited logging. That makes it
-harder to analyze logs and puts the system at the risk of
-spamming the system log incase something crashes many times
-over and over again.
-
-Fix that by logging TGID and comm (escaped) consistently and
-using the ratelimited logging always.
-
-Signed-off-by: Roman Kisel <romank@linux.microsoft.com>
-Tested-by: Allen Pais <apais@linux.microsoft.com>
-Link: https://lore.kernel.org/r/20240718182743.1959160-2-romank@linux.microsoft.com
-Signed-off-by: Kees Cook <kees@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/coredump.c            | 43 +++++++++++++++-------------------------
- include/linux/coredump.h | 22 ++++++++++++++++++++
- 2 files changed, 38 insertions(+), 27 deletions(-)
-
-diff --git a/fs/coredump.c b/fs/coredump.c
-index a57a06b80f571..19d3343b93c6b 100644
---- a/fs/coredump.c
-+++ b/fs/coredump.c
-@@ -586,8 +586,7 @@ void do_coredump(const kernel_siginfo_t *siginfo)
-               struct subprocess_info *sub_info;
-               if (ispipe < 0) {
--                      printk(KERN_WARNING "format_corename failed\n");
--                      printk(KERN_WARNING "Aborting core\n");
-+                      coredump_report_failure("format_corename failed, aborting core");
-                       goto fail_unlock;
-               }
-@@ -607,27 +606,21 @@ void do_coredump(const kernel_siginfo_t *siginfo)
-                        * right pid if a thread in a multi-threaded
-                        * core_pattern process dies.
-                        */
--                      printk(KERN_WARNING
--                              "Process %d(%s) has RLIMIT_CORE set to 1\n",
--                              task_tgid_vnr(current), current->comm);
--                      printk(KERN_WARNING "Aborting core\n");
-+                      coredump_report_failure("RLIMIT_CORE is set to 1, aborting core");
-                       goto fail_unlock;
-               }
-               cprm.limit = RLIM_INFINITY;
-               dump_count = atomic_inc_return(&core_dump_count);
-               if (core_pipe_limit && (core_pipe_limit < dump_count)) {
--                      printk(KERN_WARNING "Pid %d(%s) over core_pipe_limit\n",
--                             task_tgid_vnr(current), current->comm);
--                      printk(KERN_WARNING "Skipping core dump\n");
-+                      coredump_report_failure("over core_pipe_limit, skipping core dump");
-                       goto fail_dropcount;
-               }
-               helper_argv = kmalloc_array(argc + 1, sizeof(*helper_argv),
-                                           GFP_KERNEL);
-               if (!helper_argv) {
--                      printk(KERN_WARNING "%s failed to allocate memory\n",
--                             __func__);
-+                      coredump_report_failure("%s failed to allocate memory", __func__);
-                       goto fail_dropcount;
-               }
-               for (argi = 0; argi < argc; argi++)
-@@ -644,8 +637,7 @@ void do_coredump(const kernel_siginfo_t *siginfo)
-               kfree(helper_argv);
-               if (retval) {
--                      printk(KERN_INFO "Core dump to |%s pipe failed\n",
--                             cn.corename);
-+                      coredump_report_failure("|%s pipe failed", cn.corename);
-                       goto close_fail;
-               }
-       } else {
-@@ -658,10 +650,8 @@ void do_coredump(const kernel_siginfo_t *siginfo)
-                       goto fail_unlock;
-               if (need_suid_safe && cn.corename[0] != '/') {
--                      printk(KERN_WARNING "Pid %d(%s) can only dump core "\
--                              "to fully qualified path!\n",
--                              task_tgid_vnr(current), current->comm);
--                      printk(KERN_WARNING "Skipping core dump\n");
-+                      coredump_report_failure(
-+                              "this process can only dump core to a fully qualified path, skipping core dump");
-                       goto fail_unlock;
-               }
-@@ -730,13 +720,13 @@ void do_coredump(const kernel_siginfo_t *siginfo)
-               idmap = file_mnt_idmap(cprm.file);
-               if (!vfsuid_eq_kuid(i_uid_into_vfsuid(idmap, inode),
-                                   current_fsuid())) {
--                      pr_info_ratelimited("Core dump to %s aborted: cannot preserve file owner\n",
--                                          cn.corename);
-+                      coredump_report_failure("Core dump to %s aborted: "
-+                              "cannot preserve file owner", cn.corename);
-                       goto close_fail;
-               }
-               if ((inode->i_mode & 0677) != 0600) {
--                      pr_info_ratelimited("Core dump to %s aborted: cannot preserve file permissions\n",
--                                          cn.corename);
-+                      coredump_report_failure("Core dump to %s aborted: "
-+                              "cannot preserve file permissions", cn.corename);
-                       goto close_fail;
-               }
-               if (!(cprm.file->f_mode & FMODE_CAN_WRITE))
-@@ -757,7 +747,7 @@ void do_coredump(const kernel_siginfo_t *siginfo)
-                * have this set to NULL.
-                */
-               if (!cprm.file) {
--                      pr_info("Core dump to |%s disabled\n", cn.corename);
-+                      coredump_report_failure("Core dump to |%s disabled", cn.corename);
-                       goto close_fail;
-               }
-               if (!dump_vma_snapshot(&cprm))
-@@ -983,11 +973,10 @@ void validate_coredump_safety(void)
- {
-       if (suid_dumpable == SUID_DUMP_ROOT &&
-           core_pattern[0] != '/' && core_pattern[0] != '|') {
--              pr_warn(
--"Unsafe core_pattern used with fs.suid_dumpable=2.\n"
--"Pipe handler or fully qualified core dump path required.\n"
--"Set kernel.core_pattern before fs.suid_dumpable.\n"
--              );
-+
-+              coredump_report_failure("Unsafe core_pattern used with fs.suid_dumpable=2: "
-+                      "pipe handler or fully qualified core dump path required. "
-+                      "Set kernel.core_pattern before fs.suid_dumpable.");
-       }
- }
-diff --git a/include/linux/coredump.h b/include/linux/coredump.h
-index 0904ba010341a..45e598fe34766 100644
---- a/include/linux/coredump.h
-+++ b/include/linux/coredump.h
-@@ -43,8 +43,30 @@ extern int dump_align(struct coredump_params *cprm, int align);
- int dump_user_range(struct coredump_params *cprm, unsigned long start,
-                   unsigned long len);
- extern void do_coredump(const kernel_siginfo_t *siginfo);
-+
-+/*
-+ * Logging for the coredump code, ratelimited.
-+ * The TGID and comm fields are added to the message.
-+ */
-+
-+#define __COREDUMP_PRINTK(Level, Format, ...) \
-+      do {    \
-+              char comm[TASK_COMM_LEN];       \
-+      \
-+              get_task_comm(comm, current);   \
-+              printk_ratelimited(Level "coredump: %d(%*pE): " Format "\n",    \
-+                      task_tgid_vnr(current), (int)strlen(comm), comm, ##__VA_ARGS__);        \
-+      } while (0)     \
-+
-+#define coredump_report(fmt, ...) __COREDUMP_PRINTK(KERN_INFO, fmt, ##__VA_ARGS__)
-+#define coredump_report_failure(fmt, ...) __COREDUMP_PRINTK(KERN_WARNING, fmt, ##__VA_ARGS__)
-+
- #else
- static inline void do_coredump(const kernel_siginfo_t *siginfo) {}
-+
-+#define coredump_report(...)
-+#define coredump_report_failure(...)
-+
- #endif
- #if defined(CONFIG_COREDUMP) && defined(CONFIG_SYSCTL)
--- 
-2.43.0
-
index 6206ff0cb75bb0f132520ac0e4181f44aaa59d8a..c5037b424fa0efa40bee52d59eb342a2eeb99828 100644 (file)
@@ -162,7 +162,6 @@ hwmon-nct6775-add-g15cf-to-asus-wmi-monitoring-list.patch
 fbdev-efifb-register-sysfs-groups-through-driver-cor.patch
 fbdev-pxafb-fix-possible-use-after-free-in-pxafb_tas.patch
 pmdomain-core-don-t-hold-the-genpd-lock-when-calling.patch
-coredump-standartize-and-fix-logging.patch
 rcuscale-provide-clear-error-when-async-specified-wi.patch
 power-reset-brcmstb-do-not-go-into-infinite-loop-if-.patch
 iommu-arm-smmu-v3-match-stall-behaviour-for-s2.patch
diff --git a/queue-6.11/coredump-standartize-and-fix-logging.patch b/queue-6.11/coredump-standartize-and-fix-logging.patch
deleted file mode 100644 (file)
index 04e5ada..0000000
+++ /dev/null
@@ -1,178 +0,0 @@
-From 2edeead034757dcfefb3c3b99a8310120ba86a47 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 18 Jul 2024 11:27:24 -0700
-Subject: coredump: Standartize and fix logging
-
-From: Roman Kisel <romank@linux.microsoft.com>
-
-[ Upstream commit c114e9948c2b6a0b400266e59cc656b59e795bca ]
-
-The coredump code does not log the process ID and the comm
-consistently, logs unescaped comm when it does log it, and
-does not always use the ratelimited logging. That makes it
-harder to analyze logs and puts the system at the risk of
-spamming the system log incase something crashes many times
-over and over again.
-
-Fix that by logging TGID and comm (escaped) consistently and
-using the ratelimited logging always.
-
-Signed-off-by: Roman Kisel <romank@linux.microsoft.com>
-Tested-by: Allen Pais <apais@linux.microsoft.com>
-Link: https://lore.kernel.org/r/20240718182743.1959160-2-romank@linux.microsoft.com
-Signed-off-by: Kees Cook <kees@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/coredump.c            | 43 +++++++++++++++-------------------------
- include/linux/coredump.h | 22 ++++++++++++++++++++
- 2 files changed, 38 insertions(+), 27 deletions(-)
-
-diff --git a/fs/coredump.c b/fs/coredump.c
-index 7f12ff6ad1d3e..87ff71a59fbe7 100644
---- a/fs/coredump.c
-+++ b/fs/coredump.c
-@@ -586,8 +586,7 @@ void do_coredump(const kernel_siginfo_t *siginfo)
-               struct subprocess_info *sub_info;
-               if (ispipe < 0) {
--                      printk(KERN_WARNING "format_corename failed\n");
--                      printk(KERN_WARNING "Aborting core\n");
-+                      coredump_report_failure("format_corename failed, aborting core");
-                       goto fail_unlock;
-               }
-@@ -607,27 +606,21 @@ void do_coredump(const kernel_siginfo_t *siginfo)
-                        * right pid if a thread in a multi-threaded
-                        * core_pattern process dies.
-                        */
--                      printk(KERN_WARNING
--                              "Process %d(%s) has RLIMIT_CORE set to 1\n",
--                              task_tgid_vnr(current), current->comm);
--                      printk(KERN_WARNING "Aborting core\n");
-+                      coredump_report_failure("RLIMIT_CORE is set to 1, aborting core");
-                       goto fail_unlock;
-               }
-               cprm.limit = RLIM_INFINITY;
-               dump_count = atomic_inc_return(&core_dump_count);
-               if (core_pipe_limit && (core_pipe_limit < dump_count)) {
--                      printk(KERN_WARNING "Pid %d(%s) over core_pipe_limit\n",
--                             task_tgid_vnr(current), current->comm);
--                      printk(KERN_WARNING "Skipping core dump\n");
-+                      coredump_report_failure("over core_pipe_limit, skipping core dump");
-                       goto fail_dropcount;
-               }
-               helper_argv = kmalloc_array(argc + 1, sizeof(*helper_argv),
-                                           GFP_KERNEL);
-               if (!helper_argv) {
--                      printk(KERN_WARNING "%s failed to allocate memory\n",
--                             __func__);
-+                      coredump_report_failure("%s failed to allocate memory", __func__);
-                       goto fail_dropcount;
-               }
-               for (argi = 0; argi < argc; argi++)
-@@ -644,8 +637,7 @@ void do_coredump(const kernel_siginfo_t *siginfo)
-               kfree(helper_argv);
-               if (retval) {
--                      printk(KERN_INFO "Core dump to |%s pipe failed\n",
--                             cn.corename);
-+                      coredump_report_failure("|%s pipe failed", cn.corename);
-                       goto close_fail;
-               }
-       } else {
-@@ -658,10 +650,8 @@ void do_coredump(const kernel_siginfo_t *siginfo)
-                       goto fail_unlock;
-               if (need_suid_safe && cn.corename[0] != '/') {
--                      printk(KERN_WARNING "Pid %d(%s) can only dump core "\
--                              "to fully qualified path!\n",
--                              task_tgid_vnr(current), current->comm);
--                      printk(KERN_WARNING "Skipping core dump\n");
-+                      coredump_report_failure(
-+                              "this process can only dump core to a fully qualified path, skipping core dump");
-                       goto fail_unlock;
-               }
-@@ -730,13 +720,13 @@ void do_coredump(const kernel_siginfo_t *siginfo)
-               idmap = file_mnt_idmap(cprm.file);
-               if (!vfsuid_eq_kuid(i_uid_into_vfsuid(idmap, inode),
-                                   current_fsuid())) {
--                      pr_info_ratelimited("Core dump to %s aborted: cannot preserve file owner\n",
--                                          cn.corename);
-+                      coredump_report_failure("Core dump to %s aborted: "
-+                              "cannot preserve file owner", cn.corename);
-                       goto close_fail;
-               }
-               if ((inode->i_mode & 0677) != 0600) {
--                      pr_info_ratelimited("Core dump to %s aborted: cannot preserve file permissions\n",
--                                          cn.corename);
-+                      coredump_report_failure("Core dump to %s aborted: "
-+                              "cannot preserve file permissions", cn.corename);
-                       goto close_fail;
-               }
-               if (!(cprm.file->f_mode & FMODE_CAN_WRITE))
-@@ -757,7 +747,7 @@ void do_coredump(const kernel_siginfo_t *siginfo)
-                * have this set to NULL.
-                */
-               if (!cprm.file) {
--                      pr_info("Core dump to |%s disabled\n", cn.corename);
-+                      coredump_report_failure("Core dump to |%s disabled", cn.corename);
-                       goto close_fail;
-               }
-               if (!dump_vma_snapshot(&cprm))
-@@ -983,11 +973,10 @@ void validate_coredump_safety(void)
- {
-       if (suid_dumpable == SUID_DUMP_ROOT &&
-           core_pattern[0] != '/' && core_pattern[0] != '|') {
--              pr_warn(
--"Unsafe core_pattern used with fs.suid_dumpable=2.\n"
--"Pipe handler or fully qualified core dump path required.\n"
--"Set kernel.core_pattern before fs.suid_dumpable.\n"
--              );
-+
-+              coredump_report_failure("Unsafe core_pattern used with fs.suid_dumpable=2: "
-+                      "pipe handler or fully qualified core dump path required. "
-+                      "Set kernel.core_pattern before fs.suid_dumpable.");
-       }
- }
-diff --git a/include/linux/coredump.h b/include/linux/coredump.h
-index 0904ba010341a..45e598fe34766 100644
---- a/include/linux/coredump.h
-+++ b/include/linux/coredump.h
-@@ -43,8 +43,30 @@ extern int dump_align(struct coredump_params *cprm, int align);
- int dump_user_range(struct coredump_params *cprm, unsigned long start,
-                   unsigned long len);
- extern void do_coredump(const kernel_siginfo_t *siginfo);
-+
-+/*
-+ * Logging for the coredump code, ratelimited.
-+ * The TGID and comm fields are added to the message.
-+ */
-+
-+#define __COREDUMP_PRINTK(Level, Format, ...) \
-+      do {    \
-+              char comm[TASK_COMM_LEN];       \
-+      \
-+              get_task_comm(comm, current);   \
-+              printk_ratelimited(Level "coredump: %d(%*pE): " Format "\n",    \
-+                      task_tgid_vnr(current), (int)strlen(comm), comm, ##__VA_ARGS__);        \
-+      } while (0)     \
-+
-+#define coredump_report(fmt, ...) __COREDUMP_PRINTK(KERN_INFO, fmt, ##__VA_ARGS__)
-+#define coredump_report_failure(fmt, ...) __COREDUMP_PRINTK(KERN_WARNING, fmt, ##__VA_ARGS__)
-+
- #else
- static inline void do_coredump(const kernel_siginfo_t *siginfo) {}
-+
-+#define coredump_report(...)
-+#define coredump_report_failure(...)
-+
- #endif
- #if defined(CONFIG_COREDUMP) && defined(CONFIG_SYSCTL)
--- 
-2.43.0
-
index c9ef0e27173dbdb00a888789f2e6a5ef06283a32..19194419f91f8f3c374b270c400c5af50a7fffac 100644 (file)
@@ -191,7 +191,6 @@ fbdev-efifb-register-sysfs-groups-through-driver-cor.patch
 fbdev-pxafb-fix-possible-use-after-free-in-pxafb_tas.patch
 pmdomain-core-don-t-hold-the-genpd-lock-when-calling.patch
 pmdomain-core-use-dev_name-instead-of-kobject_get_pa.patch
-coredump-standartize-and-fix-logging.patch
 rcuscale-provide-clear-error-when-async-specified-wi.patch
 power-reset-brcmstb-do-not-go-into-infinite-loop-if-.patch
 iommu-arm-smmu-v3-match-stall-behaviour-for-s2.patch
diff --git a/queue-6.6/coredump-standartize-and-fix-logging.patch b/queue-6.6/coredump-standartize-and-fix-logging.patch
deleted file mode 100644 (file)
index 2aed824..0000000
+++ /dev/null
@@ -1,178 +0,0 @@
-From b7acd4bcef84951322c7d77d02c69c29384e4d61 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 18 Jul 2024 11:27:24 -0700
-Subject: coredump: Standartize and fix logging
-
-From: Roman Kisel <romank@linux.microsoft.com>
-
-[ Upstream commit c114e9948c2b6a0b400266e59cc656b59e795bca ]
-
-The coredump code does not log the process ID and the comm
-consistently, logs unescaped comm when it does log it, and
-does not always use the ratelimited logging. That makes it
-harder to analyze logs and puts the system at the risk of
-spamming the system log incase something crashes many times
-over and over again.
-
-Fix that by logging TGID and comm (escaped) consistently and
-using the ratelimited logging always.
-
-Signed-off-by: Roman Kisel <romank@linux.microsoft.com>
-Tested-by: Allen Pais <apais@linux.microsoft.com>
-Link: https://lore.kernel.org/r/20240718182743.1959160-2-romank@linux.microsoft.com
-Signed-off-by: Kees Cook <kees@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/coredump.c            | 43 +++++++++++++++-------------------------
- include/linux/coredump.h | 22 ++++++++++++++++++++
- 2 files changed, 38 insertions(+), 27 deletions(-)
-
-diff --git a/fs/coredump.c b/fs/coredump.c
-index 9d235fa14ab98..9846b4d06c3dd 100644
---- a/fs/coredump.c
-+++ b/fs/coredump.c
-@@ -583,8 +583,7 @@ void do_coredump(const kernel_siginfo_t *siginfo)
-               struct subprocess_info *sub_info;
-               if (ispipe < 0) {
--                      printk(KERN_WARNING "format_corename failed\n");
--                      printk(KERN_WARNING "Aborting core\n");
-+                      coredump_report_failure("format_corename failed, aborting core");
-                       goto fail_unlock;
-               }
-@@ -604,27 +603,21 @@ void do_coredump(const kernel_siginfo_t *siginfo)
-                        * right pid if a thread in a multi-threaded
-                        * core_pattern process dies.
-                        */
--                      printk(KERN_WARNING
--                              "Process %d(%s) has RLIMIT_CORE set to 1\n",
--                              task_tgid_vnr(current), current->comm);
--                      printk(KERN_WARNING "Aborting core\n");
-+                      coredump_report_failure("RLIMIT_CORE is set to 1, aborting core");
-                       goto fail_unlock;
-               }
-               cprm.limit = RLIM_INFINITY;
-               dump_count = atomic_inc_return(&core_dump_count);
-               if (core_pipe_limit && (core_pipe_limit < dump_count)) {
--                      printk(KERN_WARNING "Pid %d(%s) over core_pipe_limit\n",
--                             task_tgid_vnr(current), current->comm);
--                      printk(KERN_WARNING "Skipping core dump\n");
-+                      coredump_report_failure("over core_pipe_limit, skipping core dump");
-                       goto fail_dropcount;
-               }
-               helper_argv = kmalloc_array(argc + 1, sizeof(*helper_argv),
-                                           GFP_KERNEL);
-               if (!helper_argv) {
--                      printk(KERN_WARNING "%s failed to allocate memory\n",
--                             __func__);
-+                      coredump_report_failure("%s failed to allocate memory", __func__);
-                       goto fail_dropcount;
-               }
-               for (argi = 0; argi < argc; argi++)
-@@ -641,8 +634,7 @@ void do_coredump(const kernel_siginfo_t *siginfo)
-               kfree(helper_argv);
-               if (retval) {
--                      printk(KERN_INFO "Core dump to |%s pipe failed\n",
--                             cn.corename);
-+                      coredump_report_failure("|%s pipe failed", cn.corename);
-                       goto close_fail;
-               }
-       } else {
-@@ -655,10 +647,8 @@ void do_coredump(const kernel_siginfo_t *siginfo)
-                       goto fail_unlock;
-               if (need_suid_safe && cn.corename[0] != '/') {
--                      printk(KERN_WARNING "Pid %d(%s) can only dump core "\
--                              "to fully qualified path!\n",
--                              task_tgid_vnr(current), current->comm);
--                      printk(KERN_WARNING "Skipping core dump\n");
-+                      coredump_report_failure(
-+                              "this process can only dump core to a fully qualified path, skipping core dump");
-                       goto fail_unlock;
-               }
-@@ -727,13 +717,13 @@ void do_coredump(const kernel_siginfo_t *siginfo)
-               idmap = file_mnt_idmap(cprm.file);
-               if (!vfsuid_eq_kuid(i_uid_into_vfsuid(idmap, inode),
-                                   current_fsuid())) {
--                      pr_info_ratelimited("Core dump to %s aborted: cannot preserve file owner\n",
--                                          cn.corename);
-+                      coredump_report_failure("Core dump to %s aborted: "
-+                              "cannot preserve file owner", cn.corename);
-                       goto close_fail;
-               }
-               if ((inode->i_mode & 0677) != 0600) {
--                      pr_info_ratelimited("Core dump to %s aborted: cannot preserve file permissions\n",
--                                          cn.corename);
-+                      coredump_report_failure("Core dump to %s aborted: "
-+                              "cannot preserve file permissions", cn.corename);
-                       goto close_fail;
-               }
-               if (!(cprm.file->f_mode & FMODE_CAN_WRITE))
-@@ -754,7 +744,7 @@ void do_coredump(const kernel_siginfo_t *siginfo)
-                * have this set to NULL.
-                */
-               if (!cprm.file) {
--                      pr_info("Core dump to |%s disabled\n", cn.corename);
-+                      coredump_report_failure("Core dump to |%s disabled", cn.corename);
-                       goto close_fail;
-               }
-               if (!dump_vma_snapshot(&cprm))
-@@ -941,11 +931,10 @@ void validate_coredump_safety(void)
- {
-       if (suid_dumpable == SUID_DUMP_ROOT &&
-           core_pattern[0] != '/' && core_pattern[0] != '|') {
--              pr_warn(
--"Unsafe core_pattern used with fs.suid_dumpable=2.\n"
--"Pipe handler or fully qualified core dump path required.\n"
--"Set kernel.core_pattern before fs.suid_dumpable.\n"
--              );
-+
-+              coredump_report_failure("Unsafe core_pattern used with fs.suid_dumpable=2: "
-+                      "pipe handler or fully qualified core dump path required. "
-+                      "Set kernel.core_pattern before fs.suid_dumpable.");
-       }
- }
-diff --git a/include/linux/coredump.h b/include/linux/coredump.h
-index d3eba43601508..f897de8ccea8c 100644
---- a/include/linux/coredump.h
-+++ b/include/linux/coredump.h
-@@ -41,8 +41,30 @@ extern int dump_align(struct coredump_params *cprm, int align);
- int dump_user_range(struct coredump_params *cprm, unsigned long start,
-                   unsigned long len);
- extern void do_coredump(const kernel_siginfo_t *siginfo);
-+
-+/*
-+ * Logging for the coredump code, ratelimited.
-+ * The TGID and comm fields are added to the message.
-+ */
-+
-+#define __COREDUMP_PRINTK(Level, Format, ...) \
-+      do {    \
-+              char comm[TASK_COMM_LEN];       \
-+      \
-+              get_task_comm(comm, current);   \
-+              printk_ratelimited(Level "coredump: %d(%*pE): " Format "\n",    \
-+                      task_tgid_vnr(current), (int)strlen(comm), comm, ##__VA_ARGS__);        \
-+      } while (0)     \
-+
-+#define coredump_report(fmt, ...) __COREDUMP_PRINTK(KERN_INFO, fmt, ##__VA_ARGS__)
-+#define coredump_report_failure(fmt, ...) __COREDUMP_PRINTK(KERN_WARNING, fmt, ##__VA_ARGS__)
-+
- #else
- static inline void do_coredump(const kernel_siginfo_t *siginfo) {}
-+
-+#define coredump_report(...)
-+#define coredump_report_failure(...)
-+
- #endif
- #if defined(CONFIG_COREDUMP) && defined(CONFIG_SYSCTL)
--- 
-2.43.0
-
index 360990134f0786f5bc08f8cea524e17da3b592e7..4c52328198598bbcad2835cd9071be1c72097d14 100644 (file)
@@ -123,7 +123,6 @@ x86-syscall-avoid-memcpy-for-ia32-syscall_get_argume.patch
 hwmon-nct6775-add-g15cf-to-asus-wmi-monitoring-list.patch
 fbdev-efifb-register-sysfs-groups-through-driver-cor.patch
 fbdev-pxafb-fix-possible-use-after-free-in-pxafb_tas.patch
-coredump-standartize-and-fix-logging.patch
 rcuscale-provide-clear-error-when-async-specified-wi.patch
 power-reset-brcmstb-do-not-go-into-infinite-loop-if-.patch
 iommu-vt-d-always-reserve-a-domain-id-for-identity-s.patch