--- zzzz-none-000/linux-4.9.279/arch/x86/kernel/dumpstack_32.c 2021-08-08 06:38:54.000000000 +0000 +++ puma7-atom-6591-750/linux-4.9.279/arch/x86/kernel/dumpstack_32.c 2023-02-08 11:43:42.000000000 +0000 @@ -15,6 +15,9 @@ #include #include +#if defined(CONFIG_AVM_ENHANCED) +#include +#endif/*--- #if defined(CONFIG_AVM_ENHANCED) ---*/ void stack_type_str(enum stack_type type, const char **begin, const char **end) { @@ -30,9 +33,9 @@ } } -static bool in_hardirq_stack(unsigned long *stack, struct stack_info *info) +static bool in_hardirq_stack(int cpu, unsigned long *stack, struct stack_info *info) { - unsigned long *begin = (unsigned long *)this_cpu_read(hardirq_stack); + unsigned long *begin = (unsigned long *)per_cpu(hardirq_stack, cpu); unsigned long *end = begin + (THREAD_SIZE / sizeof(long)); /* @@ -55,9 +58,9 @@ return true; } -static bool in_softirq_stack(unsigned long *stack, struct stack_info *info) +static bool in_softirq_stack(int cpu, unsigned long *stack, struct stack_info *info) { - unsigned long *begin = (unsigned long *)this_cpu_read(softirq_stack); + unsigned long *begin = (unsigned long *)per_cpu(softirq_stack, cpu); unsigned long *end = begin + (THREAD_SIZE / sizeof(long)); /* @@ -83,21 +86,24 @@ int get_stack_info(unsigned long *stack, struct task_struct *task, struct stack_info *info, unsigned long *visit_mask) { + int cpu; + if (!stack) goto unknown; task = task ? : current; + cpu = task_cpu(task); if (in_task_stack(stack, task, info)) goto recursion_check; - if (task != current) + if (cpu == smp_processor_id() && task != current) goto unknown; - if (in_hardirq_stack(stack, info)) + if (in_hardirq_stack(cpu, stack, info)) goto recursion_check; - if (in_softirq_stack(stack, info)) + if (in_softirq_stack(cpu, stack, info)) goto recursion_check; goto unknown; @@ -145,17 +151,25 @@ touch_nmi_watchdog(); } pr_cont("\n"); +#if defined(CONFIG_AVM_ENHANCED) + show_stacktrace_memoryclassifier(regs); +#endif/*--- #if defined(CONFIG_AVM_ENHANCED) ---*/ show_trace_log_lvl(task, regs, sp, log_lvl); put_task_stack(task); } - -void show_regs(struct pt_regs *regs) +void show_task_regs(struct task_struct *task, struct pt_regs *regs) { int i; - show_regs_print_info(KERN_EMERG); + if (!task) + task = current; + + show_regs_print_info(KERN_EMERG, task); +#if defined(CONFIG_AVM_ENHANCED) + show_register_memoryclassifier(regs); +#endif/*--- #if defined(CONFIG_AVM_ENHANCED) ---*/ __show_regs(regs, !user_mode(regs)); /* @@ -169,7 +183,7 @@ u8 *ip; pr_emerg("Stack:\n"); - show_stack_log_lvl(current, regs, NULL, KERN_EMERG); + show_stack_log_lvl(task, regs, NULL, KERN_EMERG); pr_emerg("Code:"); @@ -194,11 +208,16 @@ pr_cont("\n"); } +void show_regs(struct pt_regs *regs) +{ + show_task_regs(NULL, regs); +} + int is_valid_bugaddr(unsigned long ip) { unsigned short ud2; - if (ip < PAGE_OFFSET) + if (!__kernel_text_address(ip)) return 0; if (probe_kernel_address((unsigned short *)ip, ud2)) return 0;