[Devel] [PATCH RHEL COMMIT] ve: use ve_printk() to print VMA address in case of segfault

Konstantin Khorenko khorenko at virtuozzo.com
Fri Oct 1 18:25:40 MSK 2021


The commit is pushed to "branch-rh9-5.14.vz9.1.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after ark-5.14
------>
commit fb8b870bba7648515cdfb2d502c727673d9d6468
Author: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
Date:   Tue Dec 19 16:05:14 2017 +0300

    ve: use ve_printk() to print VMA address in case of segfault
    
    Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
    Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
    
    (cherry picked from vz8 commit fc58fa6a49f636037c1873537d282fbf8849104c)
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 arch/x86/mm/fault.c | 4 ++--
 include/linux/mm.h  | 6 ++++--
 mm/memory.c         | 4 ++--
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index 47e7a2e55e7c..9efd3c0abb59 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -775,9 +775,9 @@ show_signal_msg(struct pt_regs *regs, unsigned long error_code,
 		loglvl, tsk->comm, task_pid_nr(tsk), address,
 		(void *)regs->ip, (void *)regs->sp, error_code);
 
-	print_vma_addr(KERN_CONT " in ", regs->ip);
+	ve_print_vma_addr(VE_LOG, KERN_CONT " in ", regs->ip);
 
-	printk(KERN_CONT "\n");
+	ve_printk(VE_LOG, KERN_CONT "\n");
 
 	show_opcodes(regs, loglvl);
 }
diff --git a/include/linux/mm.h b/include/linux/mm.h
index e59e27f4a528..3a8c369c4cf3 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -3078,12 +3078,14 @@ extern int _randomize_va_space;
 
 const char * arch_vma_name(struct vm_area_struct *vma);
 #ifdef CONFIG_MMU
-void print_vma_addr(char *prefix, unsigned long rip);
+void ve_print_vma_addr(int dst, char *prefix, unsigned long rip);
 #else
-static inline void print_vma_addr(char *prefix, unsigned long rip)
+static inline void ve_print_vma_addr(char *prefix, unsigned long rip)
 {
 }
 #endif
+#define print_vma_addr(prefix, rip) \
+	ve_print_vma_addr(VE0_LOG, (prefix), (rip))
 
 int vmemmap_remap_free(unsigned long start, unsigned long end,
 		       unsigned long reuse);
diff --git a/mm/memory.c b/mm/memory.c
index cb0ccb6af693..2d0bc5ab5884 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -5215,7 +5215,7 @@ EXPORT_SYMBOL_GPL(access_process_vm);
 /*
  * Print the name of a VMA.
  */
-void print_vma_addr(char *prefix, unsigned long ip)
+void ve_print_vma_addr(int dst, char *prefix, unsigned long ip)
 {
 	struct mm_struct *mm = current->mm;
 	struct vm_area_struct *vma;
@@ -5236,7 +5236,7 @@ void print_vma_addr(char *prefix, unsigned long ip)
 			p = file_path(f, buf, PAGE_SIZE);
 			if (IS_ERR(p))
 				p = "?";
-			printk("%s%s[%lx+%lx]", prefix, kbasename(p),
+			ve_printk(dst, "%s%s[%lx+%lx]", prefix, kbasename(p),
 					vma->vm_start,
 					vma->vm_end - vma->vm_start);
 			free_page((unsigned long)buf);


More information about the Devel mailing list