From d63b059e2343f44308a161f3ca9a7ce3cb6a5a2f Mon Sep 17 00:00:00 2001 From: openeuler-ci-bot <80474298@qq.com> Date: Mon, 9 Nov 2020 14:30:13 +0800 Subject: [PATCH 1/3] [patch tracking] 20201109143007621375 - https://github.com/crash-utility/crash/commit/138b6752fd39182f960488139bd8003b26bd09e7 --- ...6752fd39182f960488139bd8003b26bd09e7.patch | 90 +++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 138b6752fd39182f960488139bd8003b26bd09e7.patch diff --git a/138b6752fd39182f960488139bd8003b26bd09e7.patch b/138b6752fd39182f960488139bd8003b26bd09e7.patch new file mode 100644 index 0000000..c4bbe43 --- /dev/null +++ b/138b6752fd39182f960488139bd8003b26bd09e7.patch @@ -0,0 +1,90 @@ +diff --git a/memory_driver/crash.c b/memory_driver/crash.c +index 8d990e1..81bd0e5 100644 +--- a/memory_driver/crash.c ++++ b/memory_driver/crash.c +@@ -25,6 +25,7 @@ + *****************************************************************************/ + + #include ++#include + #include + #include + #include +@@ -37,6 +38,22 @@ + + extern int page_is_ram(unsigned long); + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0) ++ ++#define CAN_WRITE_KERNEL 1 ++ ++static inline long copy_from_kernel_nofault(void *dst, const void *src, size_t size) ++{ ++ return probe_kernel_read(dst, src, size); ++} ++ ++static inline long copy_to_kernel_nofault(void *dst, const void *src, size_t size) ++{ ++ return probe_kernel_write(dst, src, size); ++} ++ ++#endif ++ + #ifdef CONFIG_S390 + /* + * For swapped prefix pages get bounce buffer using xlate_dev_mem_ptr() +@@ -138,7 +155,7 @@ static inline void unmap_virtual(struct page *page) + #endif + + +-#define CRASH_VERSION "1.4" ++#define CRASH_VERSION "1.5" + + /* + * These are the file operation functions that allow crash utility +@@ -160,6 +177,8 @@ crash_llseek(struct file * file, loff_t offset, int orig) + } + } + ++#ifdef CAN_WRITE_KERNEL ++ + static ssize_t + crash_write(struct file *file, const char *buf, size_t count, loff_t *poff) + { +@@ -186,7 +205,7 @@ crash_write(struct file *file, const char *buf, size_t count, loff_t *poff) + return -EFAULT; + } + +- if (probe_kernel_write(vaddr, buffer, count)) { ++ if (copy_to_kernel_nofault(vaddr, buffer, count)) { + unmap_virtual(page); + return -EFAULT; + } +@@ -197,6 +216,8 @@ crash_write(struct file *file, const char *buf, size_t count, loff_t *poff) + return written; + } + ++#endif ++ + /* + * Determine the page address for an address offset value, + * get a virtual address for it, and copy it out. +@@ -222,7 +243,7 @@ crash_read(struct file *file, char *buf, size_t count, loff_t *poff) + * Use bounce buffer to bypass the CONFIG_HARDENED_USERCOPY + * kernel text restriction. + */ +- if (probe_kernel_read(buffer, vaddr, count)) { ++ if (copy_from_kernel_nofault(buffer, vaddr, count)) { + unmap_virtual(page); + return -EFAULT; + } +@@ -294,7 +315,9 @@ static struct file_operations crash_fops = { + .owner = THIS_MODULE, + .llseek = crash_llseek, + .read = crash_read, ++#ifdef CAN_WRITE_KERNEL + .write = crash_write, ++#endif + .unlocked_ioctl = crash_ioctl, + .open = crash_open, + .release = crash_release, -- Gitee From a322936c71625ccfb132e7fd8dc8666452d305de Mon Sep 17 00:00:00 2001 From: openeuler-ci-bot <80474298@qq.com> Date: Mon, 9 Nov 2020 14:30:13 +0800 Subject: [PATCH 2/3] [patch tracking] 20201109143007621375 - https://github.com/crash-utility/crash/commit/cf421616241d06160a42552e9f43ed443be5858d --- cf421616241d06160a42552e9f43ed443be5858d.patch | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 cf421616241d06160a42552e9f43ed443be5858d.patch diff --git a/cf421616241d06160a42552e9f43ed443be5858d.patch b/cf421616241d06160a42552e9f43ed443be5858d.patch new file mode 100644 index 0000000..8855c10 --- /dev/null +++ b/cf421616241d06160a42552e9f43ed443be5858d.patch @@ -0,0 +1,12 @@ +diff --git a/memory_driver/Makefile b/memory_driver/Makefile +index e84afe9..b494aa3 100644 +--- a/memory_driver/Makefile ++++ b/memory_driver/Makefile +@@ -10,6 +10,6 @@ + # + obj-m := crash.o + all: +- make -C /lib/modules/`uname -r`/build SUBDIRS=${PWD} modules ++ make -C /lib/modules/`uname -r`/build M=${PWD} SUBDIRS=${PWD} modules + clean: + rm -f *.mod.c *.ko *.o Module.* -- Gitee From 0cdc9b45e6afc8782fb9019c01615579de5b417b Mon Sep 17 00:00:00 2001 From: openeuler-ci-bot <80474298@qq.com> Date: Mon, 9 Nov 2020 14:30:14 +0800 Subject: [PATCH 3/3] [patch tracking] 20201109143007621375 - update spec file --- crash.spec | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crash.spec b/crash.spec index 56316c6..35f4d5c 100644 --- a/crash.spec +++ b/crash.spec @@ -1,6 +1,6 @@ Name: crash Version: 7.2.8 -Release: 3 +Release: 4 Summary: Linux kernel crash utility. License: GPLv3 URL: http://people.redhat.com/anderson @@ -11,6 +11,8 @@ Patch1: use_system_readline_v3.patch Patch9000: add-SDEI-stack-resolution.patch Patch9001: fix-bitmap_len-calculation-overflow-problem-in-large.patch +Patch9002: 138b6752fd39182f960488139bd8003b26bd09e7.patch +Patch9003: cf421616241d06160a42552e9f43ed443be5858d.patch BuildRequires: ncurses-devel zlib-devel lzo-devel snappy-devel BuildRequires: gcc gcc-c++ bison readline-devel @@ -75,6 +77,9 @@ install -D -m 0644 defs.h %{buildroot}%{_includedir}/%{name}/defs.h %{_mandir}/man8/crash.8* %changelog +* 20201109143007621375 patch-tracking 7.2.8-4 +- append patch file of upstream repository from <138b6752fd39182f960488139bd8003b26bd09e7> to + * Tue Sep 8 2020 shixuantong - 7.2.8-3 - Restore Source0 and URL @@ -91,4 +96,4 @@ install -D -m 0644 defs.h %{buildroot}%{_includedir}/%{name}/defs.h - Package rebuild. * Fri Aug 30 2019 openEuler Buildteam - 7.2.6-1 -- Package init. +- Package init. \ No newline at end of file -- Gitee