!52 Handle task_struct cpu member changes for kernels >= 5.16-rc1
From: @wangbin224 Reviewed-by: @hanxinke Signed-off-by: @hanxinke
This commit is contained in:
commit
cd51f25ab6
56
Handle-task_struct-cpu-member-changes-for-kernels-5..patch
Normal file
56
Handle-task_struct-cpu-member-changes-for-kernels-5..patch
Normal file
@ -0,0 +1,56 @@
|
||||
From 68870c83d299603c07785e3530e33c13045c87ef Mon Sep 17 00:00:00 2001
|
||||
From: Alexander Egorenkov <egorenar@linux.ibm.com>
|
||||
Date: Wed, 13 Oct 2021 10:56:39 +0200
|
||||
Subject: [PATCH] Handle task_struct cpu member changes for kernels >= 5.16-rc1
|
||||
|
||||
Kernel commit bcf9033e5449bdcaa9bed46467a7141a8049dadb
|
||||
("sched: move CPU field back into thread_info if THREAD_INFO_IN_TASK=y")
|
||||
moved the member cpu of task_struct back into thread_info.
|
||||
Without the patch, crash fails with the following error message
|
||||
during session initialization:
|
||||
|
||||
crash: invalid structure member offset: task_struct_cpu
|
||||
FILE: task.c LINE: 2904 FUNCTION: add_context()
|
||||
|
||||
Signed-off-by: Alexander Egorenkov <egorenar@linux.ibm.com>
|
||||
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||||
---
|
||||
task.c | 7 ++++---
|
||||
1 file changed, 4 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/task.c b/task.c
|
||||
index 672b416..bb6a5da 100644
|
||||
--- a/task.c
|
||||
+++ b/task.c
|
||||
@@ -278,8 +278,10 @@ task_init(void)
|
||||
} else if (VALID_MEMBER(task_struct_stack))
|
||||
MEMBER_OFFSET_INIT(task_struct_thread_info, "task_struct", "stack");
|
||||
|
||||
+ MEMBER_OFFSET_INIT(task_struct_cpu, "task_struct", "cpu");
|
||||
+
|
||||
if (VALID_MEMBER(task_struct_thread_info)) {
|
||||
- if (tt->flags & THREAD_INFO_IN_TASK) {
|
||||
+ if (tt->flags & THREAD_INFO_IN_TASK && VALID_MEMBER(task_struct_cpu)) {
|
||||
MEMBER_OFFSET_INIT(thread_info_flags, "thread_info", "flags");
|
||||
/* (unnecessary) reminders */
|
||||
ASSIGN_OFFSET(thread_info_task) = INVALID_OFFSET;
|
||||
@@ -315,7 +317,6 @@ task_init(void)
|
||||
MEMBER_OFFSET_INIT(task_struct_has_cpu, "task_struct", "has_cpu");
|
||||
MEMBER_OFFSET_INIT(task_struct_cpus_runnable,
|
||||
"task_struct", "cpus_runnable");
|
||||
- MEMBER_OFFSET_INIT(task_struct_cpu, "task_struct", "cpu");
|
||||
MEMBER_OFFSET_INIT(task_struct_active_mm, "task_struct", "active_mm");
|
||||
MEMBER_OFFSET_INIT(task_struct_next_run, "task_struct", "next_run");
|
||||
MEMBER_OFFSET_INIT(task_struct_flags, "task_struct", "flags");
|
||||
@@ -2900,7 +2901,7 @@ add_context(ulong task, char *tp)
|
||||
else
|
||||
tc->thread_info = ULONG(tp + OFFSET(task_struct_thread_info));
|
||||
fill_thread_info(tc->thread_info);
|
||||
- if (tt->flags & THREAD_INFO_IN_TASK)
|
||||
+ if (tt->flags & THREAD_INFO_IN_TASK && VALID_MEMBER(task_struct_cpu))
|
||||
processor_addr = (int *) (tp + OFFSET(task_struct_cpu));
|
||||
else
|
||||
processor_addr = (int *) (tt->thread_info +
|
||||
--
|
||||
2.23.0
|
||||
|
||||
12
crash.spec
12
crash.spec
@ -1,22 +1,22 @@
|
||||
Name: crash
|
||||
Version: 7.3.0
|
||||
Release: 4
|
||||
Release: 5
|
||||
Summary: Linux kernel crash utility.
|
||||
License: GPLv3
|
||||
URL: https://crash-utility.github.io
|
||||
Source0: https://github.com/crash-utility/crash/archive/%{version}.tar.gz
|
||||
Source1: http://ftp.gnu.org/gnu/gdb/gdb-7.6.tar.gz
|
||||
|
||||
Patch0: lzo_snappy.patch
|
||||
Patch1: use_system_readline_v3.patch
|
||||
Patch1: lzo_snappy.patch
|
||||
Patch2: 0001-arm64-rename-ARM64_PAGE_OFFSET_ACTUAL-to-ARM64_FLIP_.patch
|
||||
Patch3: 0002-arm64-assign-page_offset-with-VA_BITS-kernel-configu.patch
|
||||
Patch4: 0003-arm64-use-dedicated-bits-to-record-the-VA-space-layo.patch
|
||||
Patch5: 0004-arm64-implement-switchable-PTOV-VTOP-for-kernels-5.1.patch
|
||||
Patch6: add-SDEI-stack-resolution.patch
|
||||
Patch7: Handle-task_struct-cpu-member-changes-for-kernels-5..patch
|
||||
|
||||
BuildRequires: ncurses-devel zlib-devel lzo-devel snappy-devel
|
||||
BuildRequires: gcc gcc-c++ bison readline-devel m4
|
||||
BuildRequires: gcc gcc-c++ bison m4
|
||||
Requires: binutils
|
||||
|
||||
Provides: bundled(libiberty) bundled(gdb) = 7.6
|
||||
@ -79,6 +79,10 @@ install -D -m 0644 defs.h %{buildroot}%{_includedir}/%{name}/defs.h
|
||||
%{_mandir}/man8/crash.8*
|
||||
|
||||
%changelog
|
||||
* Wed Feb 23 2022 wangbin <wangbin224@huawei.com> - 7.3.0-5
|
||||
- Handle task_struct cpu member changes for kernels >= 5.16-rc1
|
||||
and delete use_system_readline_v3.patch
|
||||
|
||||
* Tue Feb 8 2022 zhouwenpei <zhouwenpei1@h-partners.com> - 7.3.0-4
|
||||
- revert to fix null pointer reference when CONFIG_KASAN is open
|
||||
|
||||
|
||||
@ -1,32 +0,0 @@
|
||||
--- crash-7.0.7/cmdline.c.orig
|
||||
+++ crash-7.0.7/cmdline.c
|
||||
@@ -44,7 +44,8 @@ static int verify_args_input_file(char *
|
||||
#define READLINE_LIBRARY
|
||||
|
||||
#include <readline.h>
|
||||
-#include <rldefs.h>
|
||||
+#define vi_mode 0
|
||||
+#define emacs_mode 1
|
||||
#include <history.h>
|
||||
|
||||
static void readline_init(void);
|
||||
--- crash-7.0.7/Makefile.orig
|
||||
+++ crash-7.0.7/Makefile
|
||||
@@ -205,7 +205,7 @@ TAR_FILES=${SOURCE_FILES} Makefile ${GPL
|
||||
${EXTENSION_SOURCE_FILES} ${MEMORY_DRIVER_FILES}
|
||||
CSCOPE_FILES=${SOURCE_FILES}
|
||||
|
||||
-READLINE_DIRECTORY=./${GDB}/readline
|
||||
+READLINE_DIRECTORY=/usr/include/readline
|
||||
BFD_DIRECTORY=./${GDB}/bfd
|
||||
GDB_INCLUDE_DIRECTORY=./${GDB}/include
|
||||
|
||||
@@ -233,7 +233,7 @@ gdb_merge: force
|
||||
@rm -f ${PROGRAM}
|
||||
@if [ ! -f ${GDB}/config.status ]; then \
|
||||
(cd ${GDB}; ./configure ${GDB_CONF_FLAGS} --with-separate-debug-dir=/usr/lib/debug \
|
||||
- --with-bugurl="" --with-expat=no --with-python=no --disable-sim; \
|
||||
+ --with-bugurl="" --with-expat=no --with-python=no --disable-sim --with-system-readline; \
|
||||
make --no-print-directory CRASH_TARGET=${TARGET}; echo ${TARGET} > crash.target) \
|
||||
else make --no-print-directory rebuild; fi
|
||||
@if [ ! -f ${PROGRAM} ]; then \
|
||||
Loading…
x
Reference in New Issue
Block a user