[Devel] [PATCH rh9 09/11] ve: use ve_printk() to print VMA address in case of segfault

Konstantin Khorenko khorenko at virtuozzo.com
Wed Sep 29 22:24:45 MSK 2021


From: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>

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 41e81911cd9a..1f118e0152ef 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -3075,12 +3075,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 4a687ad646b9..63fd0b938cc7 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -5213,7 +5213,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;
@@ -5234,7 +5234,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);
-- 
2.28.0



More information about the Devel mailing list