Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable coredump generation for aarch64 and arm #2571

Open
wants to merge 2 commits into
base: criu-dev
Choose a base branch
from

Conversation

ss141309
Copy link

@ss141309 ss141309 commented Jan 22, 2025

@rst0git can you please check this patch? Have I included all the relevant notes and registers? I was using the output of gcore to verify which notes need to be added. I will soon add the support for more architectures if this one is alright.
Thank you.

@avagin avagin requested a review from rst0git January 28, 2025 18:42
@ss141309 ss141309 marked this pull request as draft February 3, 2025 09:36
coredump/coredump Outdated Show resolved Hide resolved
coredump/coredump Outdated Show resolved Hide resolved
@ss141309 ss141309 force-pushed the enable-coredump-for-all-archs branch from 6732abe to 3447504 Compare February 6, 2025 15:51
@ss141309
Copy link
Author

ss141309 commented Feb 11, 2025

@rst0git I am stuck while working on the loongarch64 architecture. The stack of the program does not seem to get saved in the coredump.

I am generating the coredump of this program:

static void func_2(void) {
  int var_2 = 2;
  while (1);
}

static void func_1(void) {
  int var_1 = 1;
  func_2();
}

static void func_0(void) {
  int var_0 = 0;
  func_1();
}

int main() {
  int var_main = -1;

  func_0();

  return 0;
}

and I am compiling it like this gcc -g -no-pie loop.c -o loop

when I open this coredump in gdb and execute bt full, it says

loongarch@debian:~/loop$ gdb ./loop core.19373
GNU gdb (Debian 16.2-1) 16.2
Copyright (C) 2024 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "loongarch64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./loop...

warning: BFD: warning: /home/loongarch/loop/core.19373 has a segment extending past end of file

warning: malformed note - filename area is too big
[New LWP 19373]
Core was generated by `      '.
#0  func_2 () at loop.c:3
3         while (1);
(gdb) bt full
#0  func_2 () at loop.c:3
        var_2 = 0
#1  0x000000012000065c in func_1 () at loop.c:8
        var_1 = 0
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

the area of the memory where the stack pointer points is all 0s

(gdb) x/32x $sp
0x7ffffbfdc780: 0x00000000      0x00000000      0x00000000      0x00000000
0x7ffffbfdc790: 0x00000000      0x00000000      0x00000000      0x00000000
0x7ffffbfdc7a0: 0x00000000      0x00000000      0x00000000      0x00000000
0x7ffffbfdc7b0: 0x00000000      0x00000000      0x00000000      0x00000000
0x7ffffbfdc7c0: 0x00000000      0x00000000      0x00000000      0x00000000
0x7ffffbfdc7d0: 0x00000000      0x00000000      0x00000000      0x00000000
0x7ffffbfdc7e0: 0x00000000      0x00000000      0x00000000      0x00000000
0x7ffffbfdc7f0: 0x00000000      0x00000000      0x00000000      0x00000000

before dumping this program, I attached gdb to it, and examined the register values, all of the registers matched with the registers in the coredump, but there I could see the full backtrace, and the stack was not all zeroes.

what could be the problem here? I suspect it has to do something with the vmas, or is it something else?

Edit: also paging @avagin too for help with this issue

Thank You

Add relevant elf header constants and notes for the aarch64 platform
to enable coredump generation.

Signed-off-by: समीर सिंह Sameer Singh <[email protected]>
@ss141309 ss141309 force-pushed the enable-coredump-for-all-archs branch from 3447504 to 8e45ed7 Compare February 17, 2025 12:15
Add relevant elf header constants and notes for the arm platform
to enable coredump generation.

Signed-off-by: समीर सिंह Sameer Singh <[email protected]>
@ss141309 ss141309 requested a review from rst0git February 17, 2025 12:39
@rst0git
Copy link
Member

rst0git commented Feb 17, 2025

@ss141309 Thank you for working on this!

I am stuck while working on the loongarch64 architecture.

We can limit the scope of this pull request to aarch64 and armv7l. This will also make it easier for us to review and test the changes in the pull request.

@ss141309
Copy link
Author

@ss141309 Thank you for working on this!

I am stuck while working on the loongarch64 architecture.

We can limit the scope of this pull request to aarch64 and armv7l. This will also make it easier for us to review and test the changes in the pull request.

ok, then I should make separate PRs for the other architectures?

@ss141309 ss141309 marked this pull request as ready for review February 17, 2025 13:44
@ss141309 ss141309 changed the title Enable coredump generation for all supported architectures Enable coredump generation for aarch64 and arm Feb 17, 2025
@rst0git
Copy link
Member

rst0git commented Feb 17, 2025

I should make separate PRs for the other architectures?

Sure, we can add coredump support for other architectures in a separate pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants