diff options
| author | Khem Raj <raj.khem@gmail.com> | 2023-02-04 16:58:22 -0800 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2023-02-04 16:59:40 -0800 |
| commit | 5c43f2b9a15bc21d1532233b958cbf5abd29ad14 (patch) | |
| tree | cb91ace66b19a9e5f07574e287b6f66f2357b4fe | |
| parent | 5da852a616209288470708da6f5ddb5647ab69c1 (diff) | |
| download | meta-openembedded-5c43f2b9a15bc21d1532233b958cbf5abd29ad14.tar.gz | |
minicoredumper: Upgrade to 2.0.2 release
Drop patches already upstreamed.
Add patch to fix tests with clang compiler
Signed-off-by: Khem Raj <raj.khem@gmail.com>
| -rw-r--r-- | meta-oe/recipes-kernel/minicoredumper/files/0001-minicoredumper-retry-elf-parsing-as-long-as-needed.patch | 128 | ||||
| -rw-r--r-- | meta-oe/recipes-kernel/minicoredumper/files/0001-minicoredumper_demo-Use-optnone-attribute-with-clang.patch | 37 | ||||
| -rw-r--r-- | meta-oe/recipes-kernel/minicoredumper/files/0001-replace-pthread_mutexattr_setrobust_np-with-pthread_.patch | 33 | ||||
| -rw-r--r-- | meta-oe/recipes-kernel/minicoredumper/minicoredumper_2.0.2.bb (renamed from meta-oe/recipes-kernel/minicoredumper/minicoredumper_2.0.1.bb) | 7 |
4 files changed, 39 insertions, 166 deletions
diff --git a/meta-oe/recipes-kernel/minicoredumper/files/0001-minicoredumper-retry-elf-parsing-as-long-as-needed.patch b/meta-oe/recipes-kernel/minicoredumper/files/0001-minicoredumper-retry-elf-parsing-as-long-as-needed.patch deleted file mode 100644 index 8d5b8b6cbb..0000000000 --- a/meta-oe/recipes-kernel/minicoredumper/files/0001-minicoredumper-retry-elf-parsing-as-long-as-needed.patch +++ /dev/null | |||
| @@ -1,128 +0,0 @@ | |||
| 1 | From 7a8c6a06c86e133e4346b1dc66483bd8d0d3c716 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: John Ogness <john.ogness@linutronix.de> | ||
| 3 | Date: Tue, 24 Aug 2021 21:10:43 +0200 | ||
| 4 | Subject: [PATCH] minicoredumper: retry elf parsing as long as needed | ||
| 5 | |||
| 6 | As was reported in github issue #2 ("maximum number of tries | ||
| 7 | insufficient, in rare cases, for elf parse"), the number of retries | ||
| 8 | for parsing a process may be insufficient. Rather than setting an | ||
| 9 | upper limit on the maximum number of retries, track the number of | ||
| 10 | headers seen. As long as the number of seen headers is greater than | ||
| 11 | the previous try, try again. | ||
| 12 | |||
| 13 | In order to avoid introducing any new issues, preserve the behavior | ||
| 14 | of retrying at least 10 times, even if no new headers are seen. | ||
| 15 | |||
| 16 | Reported-by: github.com/ssajal-wr | ||
| 17 | Signed-off-by: John Ogness <john.ogness@linutronix.de> | ||
| 18 | |||
| 19 | Upstream-Status: Backport [7a8c6a06c86e133e4346b1dc66483bd8d0d3c716] | ||
| 20 | |||
| 21 | Signed-off-by: Sakib Sajal <sakib.sajal@windriver.com> | ||
| 22 | --- | ||
| 23 | src/minicoredumper/corestripper.c | 30 +++++++++++++++++++++++------- | ||
| 24 | 1 file changed, 23 insertions(+), 7 deletions(-) | ||
| 25 | |||
| 26 | diff --git a/src/minicoredumper/corestripper.c b/src/minicoredumper/corestripper.c | ||
| 27 | index d96d1df..c96b350 100644 | ||
| 28 | --- a/src/minicoredumper/corestripper.c | ||
| 29 | +++ b/src/minicoredumper/corestripper.c | ||
| 30 | @@ -761,7 +761,7 @@ static int init_log(struct dump_info *di) | ||
| 31 | typedef int elf_parse_cb(struct dump_info *di, Elf *elf, GElf_Phdr *phdr); | ||
| 32 | |||
| 33 | static int do_elf_ph_parse(struct dump_info *di, GElf_Phdr *type, | ||
| 34 | - elf_parse_cb *callback) | ||
| 35 | + elf_parse_cb *callback, size_t *phnum_found) | ||
| 36 | { | ||
| 37 | GElf_Ehdr ehdr_mem; | ||
| 38 | GElf_Ehdr *ehdr; | ||
| 39 | @@ -770,6 +770,9 @@ static int do_elf_ph_parse(struct dump_info *di, GElf_Phdr *type, | ||
| 40 | size_t phnum; | ||
| 41 | size_t cnt; | ||
| 42 | |||
| 43 | + if (phnum_found) | ||
| 44 | + *phnum_found = 0; | ||
| 45 | + | ||
| 46 | /* start from beginning of core */ | ||
| 47 | if (lseek64(di->elf_fd, 0, SEEK_SET) == -1) { | ||
| 48 | info("lseek failed: %s", strerror(errno)); | ||
| 49 | @@ -809,6 +812,9 @@ static int do_elf_ph_parse(struct dump_info *di, GElf_Phdr *type, | ||
| 50 | goto out; | ||
| 51 | } | ||
| 52 | |||
| 53 | + if (phnum_found) | ||
| 54 | + *phnum_found = phnum; | ||
| 55 | + | ||
| 56 | for (cnt = 0; cnt < phnum; cnt++) { | ||
| 57 | GElf_Phdr phdr_mem; | ||
| 58 | GElf_Phdr *phdr; | ||
| 59 | @@ -891,7 +897,7 @@ static int vma_cb(struct dump_info *di, Elf *elf, GElf_Phdr *phdr) | ||
| 60 | /* | ||
| 61 | * Tries to parse the found ELF headers and reads all vmas from it. | ||
| 62 | */ | ||
| 63 | -static int parse_vma_info(struct dump_info *di) | ||
| 64 | +static int parse_vma_info(struct dump_info *di, size_t *phnum_found) | ||
| 65 | { | ||
| 66 | unsigned long min_off = ULONG_MAX; | ||
| 67 | unsigned long max_len = 0; | ||
| 68 | @@ -911,7 +917,7 @@ static int parse_vma_info(struct dump_info *di) | ||
| 69 | memset(&type, 0, sizeof(type)); | ||
| 70 | type.p_type = PT_LOAD; | ||
| 71 | type.p_flags = PF_R; | ||
| 72 | - if (do_elf_ph_parse(di, &type, vma_cb) != 0) | ||
| 73 | + if (do_elf_ph_parse(di, &type, vma_cb, phnum_found) != 0) | ||
| 74 | return -1; | ||
| 75 | |||
| 76 | for (v = di->vma; v; v = v->next) { | ||
| 77 | @@ -1614,8 +1620,10 @@ int add_core_data(struct dump_info *di, off64_t dest_offset, size_t len, | ||
| 78 | */ | ||
| 79 | static int init_src_core(struct dump_info *di, int src) | ||
| 80 | { | ||
| 81 | + size_t last_phnum = 0; | ||
| 82 | int tries = 0; | ||
| 83 | int ret = -1; | ||
| 84 | + size_t phnum; | ||
| 85 | size_t len; | ||
| 86 | char *buf; | ||
| 87 | long pos; | ||
| 88 | @@ -1642,7 +1650,7 @@ again: | ||
| 89 | goto out; | ||
| 90 | |||
| 91 | /* try to elf-parse the core to read vma info */ | ||
| 92 | - ret = parse_vma_info(di); | ||
| 93 | + ret = parse_vma_info(di, &phnum); | ||
| 94 | |||
| 95 | /* restore our position */ | ||
| 96 | if (lseek64(di->elf_fd, pos, SEEK_SET) == -1) | ||
| 97 | @@ -1653,9 +1661,17 @@ again: | ||
| 98 | |||
| 99 | tries++; | ||
| 100 | |||
| 101 | - /* maybe try again */ | ||
| 102 | - if (tries < 10) | ||
| 103 | + if (phnum > last_phnum) { | ||
| 104 | + /* new headers found, keep trying */ | ||
| 105 | + last_phnum = phnum; | ||
| 106 | goto again; | ||
| 107 | + } else if (tries < 10) { | ||
| 108 | + /* | ||
| 109 | + * even if no new headers are found, | ||
| 110 | + * retry at least 10 times | ||
| 111 | + */ | ||
| 112 | + goto again; | ||
| 113 | + } | ||
| 114 | |||
| 115 | goto out; | ||
| 116 | } | ||
| 117 | @@ -2106,7 +2122,7 @@ static int dump_stacks(struct dump_info *di) | ||
| 118 | /* find and set the first task */ | ||
| 119 | memset(&type, 0, sizeof(type)); | ||
| 120 | type.p_type = PT_NOTE; | ||
| 121 | - do_elf_ph_parse(di, &type, note_cb); | ||
| 122 | + do_elf_ph_parse(di, &type, note_cb, NULL); | ||
| 123 | } | ||
| 124 | |||
| 125 | if (di->first_pid) | ||
| 126 | -- | ||
| 127 | 2.25.1 | ||
| 128 | |||
diff --git a/meta-oe/recipes-kernel/minicoredumper/files/0001-minicoredumper_demo-Use-optnone-attribute-with-clang.patch b/meta-oe/recipes-kernel/minicoredumper/files/0001-minicoredumper_demo-Use-optnone-attribute-with-clang.patch new file mode 100644 index 0000000000..05371e5cd6 --- /dev/null +++ b/meta-oe/recipes-kernel/minicoredumper/files/0001-minicoredumper_demo-Use-optnone-attribute-with-clang.patch | |||
| @@ -0,0 +1,37 @@ | |||
| 1 | From abaac31d1cb4d0ba0e8e9ef7f344e62de3b150de Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Sat, 4 Feb 2023 16:50:46 -0800 | ||
| 4 | Subject: [PATCH] minicoredumper_demo: Use 'optnone' attribute with clang | ||
| 5 | |||
| 6 | clang does not support optimize("On") yet, therefore use optnone which | ||
| 7 | should give intended results with clang compiler | ||
| 8 | |||
| 9 | Upstream-Status: Submitted [https://github.com/diamon/minicoredumper/pull/7] | ||
| 10 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 11 | --- | ||
| 12 | src/minicoredumper_demo/main.c | 9 +++++++-- | ||
| 13 | 1 file changed, 7 insertions(+), 2 deletions(-) | ||
| 14 | |||
| 15 | diff --git a/src/minicoredumper_demo/main.c b/src/minicoredumper_demo/main.c | ||
| 16 | index 65aac46..e60eb82 100644 | ||
| 17 | --- a/src/minicoredumper_demo/main.c | ||
| 18 | +++ b/src/minicoredumper_demo/main.c | ||
| 19 | @@ -11,8 +11,13 @@ | ||
| 20 | #include <sys/types.h> | ||
| 21 | |||
| 22 | #include "minicoredumper.h" | ||
| 23 | - | ||
| 24 | -int __attribute__((optimize("O0"))) main(int argc, char *argv[]) | ||
| 25 | +int | ||
| 26 | +#ifdef __clang__ | ||
| 27 | +__attribute__((optnone)) | ||
| 28 | +#else | ||
| 29 | +__attribute__((optimize("O0"))) | ||
| 30 | +#endif | ||
| 31 | +main(int argc, char *argv[]) | ||
| 32 | { | ||
| 33 | char *str1 = "This is string 1."; | ||
| 34 | unsigned long val1 = 0x1abc123f; | ||
| 35 | -- | ||
| 36 | 2.39.1 | ||
| 37 | |||
diff --git a/meta-oe/recipes-kernel/minicoredumper/files/0001-replace-pthread_mutexattr_setrobust_np-with-pthread_.patch b/meta-oe/recipes-kernel/minicoredumper/files/0001-replace-pthread_mutexattr_setrobust_np-with-pthread_.patch deleted file mode 100644 index 455e6f3181..0000000000 --- a/meta-oe/recipes-kernel/minicoredumper/files/0001-replace-pthread_mutexattr_setrobust_np-with-pthread_.patch +++ /dev/null | |||
| @@ -1,33 +0,0 @@ | |||
| 1 | From 5895caba6573e84f73f159d9e84cd1aa7e969f18 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Sun, 9 May 2021 14:37:00 -0700 | ||
| 4 | Subject: [PATCH] replace pthread_mutexattr_setrobust_np with | ||
| 5 | pthread_mutexattr_setrobust | ||
| 6 | |||
| 7 | This is now part of standard POSIX function [1] | ||
| 8 | |||
| 9 | Upstream-Status: Submitted [https://github.com/diamon/minicoredumper/pull/3] | ||
| 10 | |||
| 11 | [1] https://man7.org/linux/man-pages/man3/pthread_mutexattr_setrobust_np.3.html | ||
| 12 | |||
| 13 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 14 | --- | ||
| 15 | src/minicoredumper_regd/daemon.c | 2 +- | ||
| 16 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 17 | |||
| 18 | diff --git a/src/minicoredumper_regd/daemon.c b/src/minicoredumper_regd/daemon.c | ||
| 19 | index 115ec92..b9ad1ea 100644 | ||
| 20 | --- a/src/minicoredumper_regd/daemon.c | ||
| 21 | +++ b/src/minicoredumper_regd/daemon.c | ||
| 22 | @@ -224,7 +224,7 @@ static int setup_shm(void) | ||
| 23 | |||
| 24 | pthread_mutexattr_init(&attr); | ||
| 25 | pthread_mutexattr_setprotocol(&attr, PTHREAD_PRIO_INHERIT); | ||
| 26 | - pthread_mutexattr_setrobust_np(&attr, PTHREAD_MUTEX_ROBUST_NP); | ||
| 27 | + pthread_mutexattr_setrobust(&attr, PTHREAD_MUTEX_ROBUST); | ||
| 28 | pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED); | ||
| 29 | pthread_mutex_init(&sh->m, &attr); | ||
| 30 | |||
| 31 | -- | ||
| 32 | 2.31.1 | ||
| 33 | |||
diff --git a/meta-oe/recipes-kernel/minicoredumper/minicoredumper_2.0.1.bb b/meta-oe/recipes-kernel/minicoredumper/minicoredumper_2.0.2.bb index 992de014f4..5763f845a6 100644 --- a/meta-oe/recipes-kernel/minicoredumper/minicoredumper_2.0.1.bb +++ b/meta-oe/recipes-kernel/minicoredumper/minicoredumper_2.0.2.bb | |||
| @@ -9,15 +9,12 @@ DEPENDS = "elfutils dbus dbus-glib-native glib-2.0 dbus-glib util-linux json-c" | |||
| 9 | 9 | ||
| 10 | inherit autotools pkgconfig ptest systemd update-rc.d | 10 | inherit autotools pkgconfig ptest systemd update-rc.d |
| 11 | 11 | ||
| 12 | SRCREV = "16a0d44f1725eaa93096eaa0e086f42ef4c2712c" | 12 | SRCREV = "0bed11b3d69877ce59b1a71359349af60f2009ff" |
| 13 | |||
| 14 | PR .= "+git${SRCPV}" | ||
| 15 | 13 | ||
| 16 | SRC_URI = "git://github.com/diamon/minicoredumper;protocol=https;branch=master \ | 14 | SRC_URI = "git://github.com/diamon/minicoredumper;protocol=https;branch=master \ |
| 17 | file://0001-replace-pthread_mutexattr_setrobust_np-with-pthread_.patch \ | 15 | file://0001-minicoredumper_demo-Use-optnone-attribute-with-clang.patch \ |
| 18 | file://minicoredumper.service \ | 16 | file://minicoredumper.service \ |
| 19 | file://minicoredumper.init \ | 17 | file://minicoredumper.init \ |
| 20 | file://0001-minicoredumper-retry-elf-parsing-as-long-as-needed.patch \ | ||
| 21 | file://run-ptest \ | 18 | file://run-ptest \ |
| 22 | " | 19 | " |
| 23 | 20 | ||
