[PATCH] scope: add ability to un-set scope
by John Pittman
Currently there is no way to un-set the scope without having to
exit and re-enter crash. The ability to un-set can come in very
useful when running automated pykdump scripts and needing scope to
be cleared between script runs. Add the ability by allowing
vaddr 0 to be passed through gdb_set_crash_scope() and
gdb_command_funnel(), taking advantage of the !req->addr check in
gdb_set_crash_block(), enabling 'set scope 0' as a viable command.
Signed-off-by: John Pittman <jpittman(a)redhat.com>
---
gdb_interface.c | 30 ++++++++++++++++--------------
help.c | 2 +-
2 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/gdb_interface.c b/gdb_interface.c
index 562d2ac..1172edd 100644
--- a/gdb_interface.c
+++ b/gdb_interface.c
@@ -1012,23 +1012,25 @@ gdb_set_crash_scope(ulong vaddr, char *arg)
char name[BUFSIZE];
struct load_module *lm;
- if (!is_kernel_text(vaddr)) {
- error(INFO, "invalid text address: %s\n", arg);
- return FALSE;
- }
+ if (vaddr) {
+ if (!is_kernel_text(vaddr)) {
+ error(INFO, "invalid text address: %s\n", arg);
+ return FALSE;
+ }
- if (module_symbol(vaddr, NULL, &lm, name, 0)) {
- if (!(lm->mod_flags & MOD_LOAD_SYMS)) {
- error(INFO, "attempting to find/load \"%s\" module debuginfo\n",
- lm->mod_name);
- if (!load_module_symbols_helper(lm->mod_name)) {
- error(INFO, "cannot find/load \"%s\" module debuginfo\n",
+ if (module_symbol(vaddr, NULL, &lm, name, 0)) {
+ if (!(lm->mod_flags & MOD_LOAD_SYMS)) {
+ error(INFO, "attempting to find/load \"%s\" module debuginfo\n",
lm->mod_name);
- return FALSE;
+ if (!load_module_symbols_helper(lm->mod_name)) {
+ error(INFO, "cannot find/load \"%s\" module debuginfo\n",
+ lm->mod_name);
+ return FALSE;
+ }
}
- }
- } else if (kt->flags2 & KASLR)
- vaddr -= (kt->relocate * -1);
+ } else if (kt->flags2 & KASLR)
+ vaddr -= (kt->relocate * -1);
+ }
req->command = GNU_SET_CRASH_BLOCK;
req->addr = vaddr;
diff --git a/help.c b/help.c
index d3427a3..7c9455f 100644
--- a/help.c
+++ b/help.c
@@ -1088,7 +1088,7 @@ char *help_set[] = {
" of data structures; the \"text-addr\" argument",
" must be a kernel or module text address, which",
" may be expressed symbolically or as a hexadecimal",
-" value.",
+" value; set scope 0 to un-set.",
" offline show | hide show or hide command output that is associated",
" with offline cpus.",
" redzone on | off if on, CONFIG_SLUB object addresses displayed by",
--
2.17.2
3 years, 10 months
Re: [Crash-utility] [PATCH] scope: add ability to un-set scope
by lijiang
在 2021年01月19日 01:00, crash-utility-request(a)redhat.com 写道:
> From: John Pittman <jpittman(a)redhat.com>
> To: k-hagio-ab(a)nec.com
> Cc: crash-utility(a)redhat.com
> Subject: [Crash-utility] [PATCH] scope: add ability to un-set scope
> Message-ID: <20210118144327.17554-1-jpittman(a)redhat.com>
>
> Currently there is no way to un-set the scope without having to
> exit and re-enter crash. The ability to un-set can come in very
> useful when running automated pykdump scripts and needing scope to
> be cleared between script runs. Add the ability by allowing
> vaddr 0 to be passed through gdb_set_crash_scope() and
> gdb_command_funnel(), taking advantage of the !req->addr check in
> gdb_set_crash_block(), enabling 'set scope 0' as a viable command.
>
This change looks good to me. Acked-by: Lianbo Jiang <lijiang(a)redhat.com>
> Signed-off-by: John Pittman <jpittman(a)redhat.com>
> ---
> gdb_interface.c | 30 ++++++++++++++++--------------
> help.c | 2 +-
> 2 files changed, 17 insertions(+), 15 deletions(-)
>
> diff --git a/gdb_interface.c b/gdb_interface.c
> index 562d2ac..1172edd 100644
> --- a/gdb_interface.c
> +++ b/gdb_interface.c
> @@ -1012,23 +1012,25 @@ gdb_set_crash_scope(ulong vaddr, char *arg)
> char name[BUFSIZE];
> struct load_module *lm;
>
> - if (!is_kernel_text(vaddr)) {
> - error(INFO, "invalid text address: %s\n", arg);
> - return FALSE;
> - }
> + if (vaddr) {
> + if (!is_kernel_text(vaddr)) {
> + error(INFO, "invalid text address: %s\n", arg);
> + return FALSE;
> + }
>
> - if (module_symbol(vaddr, NULL, &lm, name, 0)) {
> - if (!(lm->mod_flags & MOD_LOAD_SYMS)) {
> - error(INFO, "attempting to find/load \"%s\" module debuginfo\n",
> - lm->mod_name);
> - if (!load_module_symbols_helper(lm->mod_name)) {
> - error(INFO, "cannot find/load \"%s\" module debuginfo\n",
> + if (module_symbol(vaddr, NULL, &lm, name, 0)) {
> + if (!(lm->mod_flags & MOD_LOAD_SYMS)) {
> + error(INFO, "attempting to find/load \"%s\" module debuginfo\n",
> lm->mod_name);
> - return FALSE;
> + if (!load_module_symbols_helper(lm->mod_name)) {
> + error(INFO, "cannot find/load \"%s\" module debuginfo\n",
> + lm->mod_name);
> + return FALSE;
> + }
> }
> - }
> - } else if (kt->flags2 & KASLR)
> - vaddr -= (kt->relocate * -1);
> + } else if (kt->flags2 & KASLR)
> + vaddr -= (kt->relocate * -1);
> + }
>
> req->command = GNU_SET_CRASH_BLOCK;
> req->addr = vaddr;
> diff --git a/help.c b/help.c
> index d3427a3..7c9455f 100644
> --- a/help.c
> +++ b/help.c
> @@ -1088,7 +1088,7 @@ char *help_set[] = {
> " of data structures; the \"text-addr\" argument",
> " must be a kernel or module text address, which",
> " may be expressed symbolically or as a hexadecimal",
> -" value.",
> +" value; set scope 0 to un-set.",
> " offline show | hide show or hide command output that is associated",
> " with offline cpus.",
> " redzone on | off if on, CONFIG_SLUB object addresses displayed by",
> -- 2.17.2
3 years, 10 months
increase __PHYSICAL_MASK_SHIFT_XEN?
by Jiri Bohac
Hi,
I've just come across a situation where crash failed to open a
dump generated by a 4.12 XEN PV dom0 kernel, terminating with
this message:
crash: read error: physical address: ffffffffffffffff type: "pud page"
The problem is a failed machine-to-physical translation.
xen_m2p() returns an error (-1UL) and x86_64_pud_offset() than
uses that value as a physical address.
I debugged the problem by running crash inside gdb. The backtrace was:
#0 xen_m2p (machine=973135872) at kernel.c:9714
#1 0x000000000053ed4a in x86_64_pud_offset (pgd_pte=3299508019303, vaddr=18446744072642223552, verbose=0, IS_XEN=1)
at x86_64.c:1889
#2 0x0000000000540c8a in x86_64_kvtop_xen_wpt (tc=0x0, kvaddr=18446744072642223552, paddr=0x7fffffffdb30, verbose=0)
at x86_64.c:2523
#3 0x00000000005407d0 in x86_64_kvtop (tc=0x0, kvaddr=18446744072642223552, paddr=0x7fffffffdb30, verbose=0)
at x86_64.c:2413
#4 0x0000000000491a97 in kvtop (tc=0x0, kvaddr=18446744072642223552, paddr=0x7fffffffdb30, verbose=0) at memory.c:3062
#5 0x000000000048f3f0 in readmem (addr=18446744072642223552, memtype=1, buffer=0xba63a0 <shared_bufs>, size=832,
type=0x92e1f2 "module struct", error_handle=6) at memory.c:2314
#6 0x00000000005071e2 in module_init () at kernel.c:3699
....
I tracked the problem to a wrong value of
__PHYSICAL_MASK_SHIFT_XEN. The current value of 40 does not
correspond to the current kernel value of 52 since kernel commit
6f0e8bf16730a36ff6773802d8c8df56d10e60cd (xen: support 52 bit
physical addresses in pv guests).
The result is visible in the above backtrace:
x86_64_pud_offset() is called with pgd_pte=0x3003a00e067 and that
value is wrongly masked by "pud_paddr = pgd_pte &
PHYSICAL_PAGE_MASK" and passed to xen_m2p() as 0x3a00e000 instead
of 0x3003a00e000, causing the m2p translation to fail.
Setting __PHYSICAL_MASK_SHIFT_XEN to 52 fixes the problem with
this dump.
But I am not confident it's a safe change. My understanding is
that it should be safe, as all the unused bits of the physical
address inside the PTEs should be 0 and thus having the mask wider
than necessary should not hurt. But I am suspicious if my
reasoning is correct. Why does crash go into such trouble
differentiating between different kernels and sets
machdep->machspec->physical_mask_shift dynamically to one of
__PHYSICAL_MASK_SHIFT_XEN (40), __PHYSICAL_MASK_SHIFT_2_6 (46),
and __PHYSICAL_MASK_SHIFT_5LEVEL (52)? Would something break if
it were always set to 52? The commit adding the logic is
307e7f35.
Thanks,
--
Jiri Bohac <jbohac(a)suse.cz>
SUSE Labs, Prague, Czechia
3 years, 10 months
[PATCH 1/2] netdump: fix illegal read to already freed buffer
by HATAYAMA Daisuke
This issue was detected by valgrind as follows:
==1212== Invalid read of size 8
==1212== at 0x56C400: resize_elf_header (netdump.c:585)
==1212== by 0x56C400: is_netdump (netdump.c:363)
==1212== by 0x463571: main (main.c:561)
==1212== Address 0x4e8ec10 is 32 bytes inside a block of size 304 free'd
==1212== at 0x483BCE8: realloc (vg_replace_malloc.c:834)
==1212== by 0x56C393: resize_elf_header (netdump.c:547)
==1212== by 0x56C393: is_netdump (netdump.c:363)
==1212== by 0x463571: main (main.c:561)
==1212== Block was alloc'd at
==1212== at 0x4839809: malloc (vg_replace_malloc.c:307)
==1212== by 0x56C078: is_netdump (netdump.c:136)
==1212== by 0x463571: main (main.c:561)
==1212==
The issue was introduced by the commit
f42db6a33f0e0652df7cce8506352745b4794287 (Support core files with
"unusual" layout).
In resize_elf_header(), both elf32 and elf64 refer to the same address
as eheader, but when reallocating the address pointed at by eheader,
elf32 and elf64 are not updated, resulting in referring to the already
freed address.
To fix this issue, let's update elf32 and elf64 at the realloc().
Signed-off-by: HATAYAMA Daisuke <d.hatayama(a)fujitsu.com>
---
netdump.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/netdump.c b/netdump.c
index 2ca39e2..690f45e 100644
--- a/netdump.c
+++ b/netdump.c
@@ -550,6 +550,9 @@ resize_elf_header(int fd, char *file, char **eheader_ptr, char **sect0_ptr,
} else
*eheader_ptr = eheader;
+ elf32 = (Elf32_Ehdr *)&eheader[0];
+ elf64 = (Elf64_Ehdr *)&eheader[0];
+
if (FLAT_FORMAT()) {
if (!read_flattened_format(fd, 0, eheader, header_size))
return 0;
--
2.29.2
3 years, 10 months
[PATCH v2 0/7] zram related changes for zram support of crash gcore command
by HATAYAMA Daisuke
This patch set is to make changes I found necessary during development
of zram support for crash gcore command.
Here are tiny script and program I made to test the zram feature.
This may help your reviewing.
https://github.com/d-hatayama/some_stuff_for_crash_zram_devel
v2:
- Fix compilation error when without lzo library, which is fixed by
newly added 5-th patch to include zram even without lzo library.
- Add 6-th patch aiming to warn that given crash utility is built
without lzo library when encoutering zram pages.
HATAYAMA Daisuke (7):
diskdump, zram: cleanup try_zram_decompress()
diskdump, zram: initialize zram symbol information when needed
diskname, zram: fix fault error when reading zram disk with no symbol
information
diskname, zram: Notify necessity of loading zram module
zram: include zram code even without lzo library
zram: Add warning message when crash is built without lzo library
memory, zram: introduce and export readswap()
defs.h | 3 +-
diskdump.c | 234 ++++++++++++++++++++++++++++++++++++-------------------------
memory.c | 5 +-
3 files changed, 143 insertions(+), 99 deletions(-)
--
1.8.3.1
3 years, 10 months
Re: [Crash-utility] [PATCH 1/2] netdump: fix illegal read to already freed buffer
by lijiang
Hi, HATAYAMA
在 2021年01月01日 01:00, crash-utility-request(a)redhat.com 写道:
> Date: Thu, 31 Dec 2020 17:20:52 +0900
> From: HATAYAMA Daisuke <d.hatayama(a)fujitsu.com>
> To: crash-utility(a)redhat.com
> Cc: HATAYAMA Daisuke <d.hatayama(a)fujitsu.com>
> Subject: [Crash-utility] [PATCH 1/2] netdump: fix illegal read to
> already freed buffer
> Message-ID: <1609402853-11183-1-git-send-email-d.hatayama(a)fujitsu.com>
> Content-Type: text/plain; charset="US-ASCII"
>
> This issue was detected by valgrind as follows:
>
> ==1212== Invalid read of size 8
> ==1212== at 0x56C400: resize_elf_header (netdump.c:585)
> ==1212== by 0x56C400: is_netdump (netdump.c:363)
> ==1212== by 0x463571: main (main.c:561)
> ==1212== Address 0x4e8ec10 is 32 bytes inside a block of size 304 free'd
> ==1212== at 0x483BCE8: realloc (vg_replace_malloc.c:834)
> ==1212== by 0x56C393: resize_elf_header (netdump.c:547)
> ==1212== by 0x56C393: is_netdump (netdump.c:363)
> ==1212== by 0x463571: main (main.c:561)
> ==1212== Block was alloc'd at
> ==1212== at 0x4839809: malloc (vg_replace_malloc.c:307)
> ==1212== by 0x56C078: is_netdump (netdump.c:136)
> ==1212== by 0x463571: main (main.c:561)
> ==1212==
>
> The issue was introduced by the commit
> f42db6a33f0e0652df7cce8506352745b4794287 (Support core files with
> "unusual" layout).
>
> In resize_elf_header(), both elf32 and elf64 refer to the same address
> as eheader, but when reallocating the address pointed at by eheader,
> elf32 and elf64 are not updated, resulting in referring to the already
> freed address.
>
> To fix this issue, let's update elf32 and elf64 at the realloc().
>
Thanks for the fix and improvement:
[PATCH 1/2] netdump: fix illegal read to already freed buffer
[PATCH 2/2] tools: fix potential source anddestination overlap with strcpy()
Acked-by: Lianbo Jiang <lijiang(a)redhat.com>
> Signed-off-by: HATAYAMA Daisuke <d.hatayama(a)fujitsu.com>
> ---
> netdump.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/netdump.c b/netdump.c
> index 2ca39e2..690f45e 100644
> --- a/netdump.c
> +++ b/netdump.c
> @@ -550,6 +550,9 @@ resize_elf_header(int fd, char *file, char **eheader_ptr, char **sect0_ptr,
> } else
> *eheader_ptr = eheader;
>
> + elf32 = (Elf32_Ehdr *)&eheader[0];
> + elf64 = (Elf64_Ehdr *)&eheader[0];
> +
> if (FLAT_FORMAT()) {
> if (!read_flattened_format(fd, 0, eheader, header_size))
> return 0;
> -- 2.29.2
3 years, 10 months
[PATCH] Fix "sys [-t]|mod -S" after "mod -t" when crash runs with -s option
by HAGIO KAZUHITO(萩尾 一仁)
When crash runs with -s option, SIZE(taint_flag) and OFFSET(tnt_false)
are not set during initialization. If the "mod -t" option is executed,
it sets the former but does not set the latter. After that, the "sys"
command uses OFFSET(tnt_false) without setting it, because it checks
only if SIZE(taint_flag) is set.
Without the patch, the "sys [-t]" and "mod -S" options after "mod -t"
option fail with the error message:
sys: invalid structure member offset: tnt_false
FILE: kernel.c LINE: 11203 FUNCTION: show_kernel_taints_v4_10()
Signed-off-by: Kazuhito Hagio <k-hagio-ab(a)nec.com>
---
kernel.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel.c b/kernel.c
index 272e0d8751cf..5fcd86575be5 100644
--- a/kernel.c
+++ b/kernel.c
@@ -11160,7 +11160,8 @@ show_kernel_taints_v4_10(char *buf, int verbose)
ulong tainted_mask, *tainted_mask_ptr;
struct syment *sp;
- if (!VALID_STRUCT(taint_flag)) {
+ if (!(VALID_STRUCT(taint_flag) &&
+ VALID_MEMBER(tnt_true) && VALID_MEMBER(tnt_false))) {
STRUCT_SIZE_INIT(taint_flag, "taint_flag");
MEMBER_OFFSET_INIT(tnt_true, "taint_flag", "true");
MEMBER_OFFSET_INIT(tnt_false, "taint_flag", "false");
--
2.18.4
3 years, 10 months
[PATCH] Fix "kmem -v" option on Linux 5.11-rc1 and later kernels
by HAGIO KAZUHITO(萩尾 一仁)
Fix the "kmem -v" option on Linux 5.11-rc1 and later kernels
that contains commit 96e2db456135db0cf2476b6890f1e8b2fdcf21eb
("mm/vmalloc: rework the drain logic"). Without the patch,
the option will display nothing or fail with the error message
"kmem: invalid kernel virtual address: <address> type: "vmlist addr".
Signed-off-by: Kazuhito Hagio <k-hagio-ab(a)nec.com>
---
memory.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/memory.c b/memory.c
index 0848097eb4f5..33b0ca7af977 100644
--- a/memory.c
+++ b/memory.c
@@ -403,8 +403,6 @@ vm_init(void)
VALID_MEMBER(vmap_area_va_end) &&
VALID_MEMBER(vmap_area_list) &&
VALID_MEMBER(vmap_area_vm) &&
- (VALID_MEMBER(vmap_area_flags) ||
- (OFFSET(vmap_area_vm) == MEMBER_OFFSET("vmap_area", "purge_list"))) &&
kernel_symbol_exists("vmap_area_list"))
vt->flags |= USE_VMAP_AREA;
--
2.18.4
3 years, 10 months
[PATCH] Fix "dev -d" option on Linux 5.11-rc1 and later kernels
by HAGIO KAZUHITO(萩尾 一仁)
Fix the "dev -d" option on Linux 5.11-rc1 and later kernels that
contains commit 0d02129e76edf91cf04fabf1efbc3a9a1f1d729a
("block: merge struct block_device and struct hd_struct").
Without the patch, the option fails with the error message
"dev: invalid structure member offset: hd_struct_dev".
Signed-off-by: Kazuhito Hagio <k-hagio-ab(a)nec.com>
---
defs.h | 2 ++
dev.c | 29 +++++++++++++++++++++++++----
symbols.c | 4 ++++
3 files changed, 31 insertions(+), 4 deletions(-)
diff --git a/defs.h b/defs.h
index e468b1d99fcf..ffbe73bfb508 100644
--- a/defs.h
+++ b/defs.h
@@ -2128,6 +2128,8 @@ struct offset_table { /* stash of commonly-used offsets */
long prb_data_ring_size_bits;
long prb_data_ring_data;
long atomic_long_t_counter;
+ long block_device_bd_device;
+ long block_device_bd_stats;
};
struct size_table { /* stash of commonly-used sizes */
diff --git a/dev.c b/dev.c
index 56e84ab9007c..effe789f38d8 100644
--- a/dev.c
+++ b/dev.c
@@ -4067,13 +4067,22 @@ get_gendisk_5(unsigned long entry)
{
unsigned long device_address;
unsigned long device_private_address;
+ unsigned long gendisk;
device_private_address = entry - OFFSET(device_private_knode_class);
readmem(device_private_address + OFFSET(device_private_device),
KVADDR, &device_address, sizeof(device_address),
"device_private.device", FAULT_ON_ERROR);
- return device_address - OFFSET(hd_struct_dev) - OFFSET(gendisk_part0);
+ if (VALID_MEMBER(hd_struct_dev))
+ return device_address - OFFSET(hd_struct_dev) - OFFSET(gendisk_part0);
+
+ /* kernel version >= 5.11 */
+ readmem(device_address - OFFSET(block_device_bd_device) +
+ OFFSET(block_device_bd_disk), KVADDR, &gendisk,
+ sizeof(ulong), "block_device.bd_disk", FAULT_ON_ERROR);
+
+ return gendisk;
}
/* 2.6.24 < kernel version <= 2.6.27 */
@@ -4290,9 +4299,19 @@ get_diskio_1(unsigned long rq, unsigned long gendisk, struct diskio *io)
io->read = count[0];
io->write = count[1];
} else {
- readmem(gendisk + OFFSET(gendisk_part0) +
- OFFSET(hd_struct_dkstats), KVADDR, &dkstats,
- sizeof(ulong), "gendisk.part0.dkstats", FAULT_ON_ERROR);
+ if (VALID_MEMBER(hd_struct_dkstats))
+ readmem(gendisk + OFFSET(gendisk_part0) +
+ OFFSET(hd_struct_dkstats), KVADDR, &dkstats,
+ sizeof(ulong), "gendisk.part0.dkstats", FAULT_ON_ERROR);
+ else { /* kernel version >= 5.11 */
+ ulong block_device;
+ readmem(gendisk + OFFSET(gendisk_part0), KVADDR, &block_device,
+ sizeof(ulong), "gendisk.part0", FAULT_ON_ERROR);
+ readmem(block_device + OFFSET(block_device_bd_stats), KVADDR,
+ &dkstats, sizeof(ulong), "block_device.bd_stats",
+ FAULT_ON_ERROR);
+ }
+
get_one_diskio_from_dkstats(dkstats, io_counts);
io->read = io_counts[0];
@@ -4549,6 +4568,8 @@ void diskio_init(void)
MEMBER_OFFSET_INIT(gendisk_queue, "gendisk", "queue");
MEMBER_OFFSET_INIT(hd_struct_dev, "hd_struct", "__dev");
MEMBER_OFFSET_INIT(hd_struct_dkstats, "hd_struct", "dkstats");
+ MEMBER_OFFSET_INIT(block_device_bd_device, "block_device", "bd_device");
+ MEMBER_OFFSET_INIT(block_device_bd_stats, "block_device", "bd_stats");
MEMBER_OFFSET_INIT(klist_k_list, "klist", "k_list");
MEMBER_OFFSET_INIT(klist_node_n_klist, "klist_node", "n_klist");
MEMBER_OFFSET_INIT(klist_node_n_node, "klist_node", "n_node");
diff --git a/symbols.c b/symbols.c
index a51078d58e6b..ed5f731fa1b3 100644
--- a/symbols.c
+++ b/symbols.c
@@ -9291,6 +9291,10 @@ dump_offset_table(char *spec, ulong makestruct)
OFFSET(block_device_bd_list));
fprintf(fp, " block_device_bd_disk: %ld\n",
OFFSET(block_device_bd_disk));
+ fprintf(fp, " block_device_bd_device: %ld\n",
+ OFFSET(block_device_bd_device));
+ fprintf(fp, " block_device_bd_stats: %ld\n",
+ OFFSET(block_device_bd_stats));
fprintf(fp, " address_space_nrpages: %ld\n",
OFFSET(address_space_nrpages));
fprintf(fp, " address_space_page_tree: %ld\n",
--
2.18.4
3 years, 10 months
Re: [Crash-utility] [PATCH v3 1/2] Update gdb to 10.1
by lijiang
Hi, Alexey
Sorry for the late reply. And also thank you for the update.
At present, I'm looking at this patchset, but I have to say that this is a big one,
I will take some time to understand these changes and think more about this.
And I will provide feedback ASAP.
Thanks.
Lianbo
在 2020年12月29日 18:06, crash-utility-request(a)redhat.com 写道:
> Date: Tue, 29 Dec 2020 02:06:08 -0800
> From: Alexey Makhalov <amakhalov(a)vmware.com>
> To: <crash-utility(a)redhat.com>, <k-hagio-ab(a)nec.com>
> Subject: [Crash-utility] [PATCH v3 1/2] Update gdb to 10.1
> Message-ID: <20201229100609.83147-2-amakhalov(a)vmware.com>
> Content-Type: text/plain
>
> Fully redone gdb-7.6.patch to gdb-10.1.patch to keep all
> functionality. Changes which were dropped are saved in
> dropped-gdb-7.6-to-10.1.patch
>
> Main difference between gdb-7.6 and gdb-10.1 is the last
> one was rewritten in C++.
> I continue to keep crash code in C. Mark transition
> functions as extern "C" to resolve linking issues.
>
> Eliminated error_hook() and SJLJ while running in C++ code
> (after gdb_command_funnel()) use try-catch mechanism instead.
>
> request_types() was redone to do not call
> GNU_GET_NEXT_DATATYPE multiple times but single usage of
> GNU_ITERATE_DATATYPES with proper callback instead.
> Complete iteration happens on C++ side now.
> Removed "struct global_iterator" from request structure,
> but added several fields (including callback pointer) to
> be able to perform iteration on C++ side.
>
> Type of "linux_banner" symbol is reported as 'D' by new
> gdb as its section ".rodata" marked as writable in vmlinux.
>
> BFD API has changed.
>
> deprecated_command_loop_hook got deprecated. So, call crash
> main_loop() directly from gdb captured_main().
>
> Added symbol file (vmlinux) rebase in gdb by kaslr_offset.
> by using new function: objfile_rebase().
> As result, we do not need kernel symbol patching as well as
> bait_and_switch hook anymore.
>
> Added crash_target for gdb to provide target operations
> such as xfer_partial to read and write crash dump memory.
> Removed previously used hooks for that in target.c.
> Keep crash_target.c as a file in crash folder instead of
> in gdb-10.1.patch for easier development and history
> tracking.
> crash_target can be enhanced in future to provide access
> to CPU registers, so backtrace and frame related commands
> from gdb can be used.
>
> Removed gdb-7.6-proc_service.h.patch is not required as
> gdb-10.1 already has this change.
>
> Extra: add VMware copyright to the version info.
>
> TODO:
> 1) gdb-10.1-ppc64le-support.patch has to be updated with
> following commits.
> 2) deprecate #if defined(GDB_X_Y) code as crash really
> supports only the latest gdb (only one patch).
> 3) move gdb_funnel_command() and subfunctions to separate
> file, similar to crash_target.c
> 4) remove legacy kernel patching and bait_and_switch hook.
>
> Signed-off-by: Alexey Makhalov <amakhalov(a)vmware.com>
> ---
> Makefile | 11 +-
> configure.c | 20 +-
> crash_target.c | 104 +
> defs.h | 35 +-
> dropped-gdb-7.6-to-10.1.patch | 303 +++
> ...support.patch => gdb-10.1-ppc64le-support.patch | 0
> gdb-10.1.patch | 1577 ++++++++++++
> gdb-7.6-proc_service.h.patch | 67 -
> gdb-7.6.patch | 2503 --------------------
> gdb_interface.c | 85 +-
> help.c | 1 +
> kernel.c | 2 +-
> main.c | 1 -
> symbols.c | 125 +-
> x86_64.c | 14 +-
> 15 files changed, 2141 insertions(+), 2707 deletions(-)
> create mode 100644 crash_target.c
> create mode 100644 dropped-gdb-7.6-to-10.1.patch
> rename gdb-7.6-ppc64le-support.patch => gdb-10.1-ppc64le-support.patch (100%)
> create mode 100644 gdb-10.1.patch
> delete mode 100644 gdb-7.6-proc_service.h.patch
> delete mode 100644 gdb-7.6.patch
3 years, 10 months