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

content: linux coredumps #545

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

bahildebrand
Copy link
Member

Summary

Add an article covering the cause, layout, and use
of Linux coredumps in memfaultd.

Copy link

cloudflare-workers-and-pages bot commented Jan 14, 2025

Deploying interrupt with  Cloudflare Pages  Cloudflare Pages

Latest commit: cf79987
Status: ✅  Deploy successful!
Preview URL: https://81a3bc5b.interrupt.pages.dev
Branch Preview URL: https://blake-linux-coredumps.interrupt.pages.dev

View logs

 ### Summary

Add an article covering the cause, layout, and use
of Linux coredumps in `memfaultd`.
@bahildebrand bahildebrand marked this pull request as ready for review February 11, 2025 15:34
@bahildebrand bahildebrand requested a review from a team as a code owner February 11, 2025 15:34
Copy link
Member

@gminn gminn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First pass!

Comment on lines +90 to +91
expands to the PID of the crashing process. More information on the available
expansions can be found in the `man core`[^man_core] page.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any other expansions that you think are useful, or are these basically the only two you use?


![]({% img_url linux-coredump/elf-core-layout.png %})

The above image gives us a very high level view of the layout of a coredump. The
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you have a good chunk of info on the header, lets give it its own section:

Suggested change
The above image gives us a very high level view of the layout of a coredump. The
### ELF Header
The above image gives us a very high level view of the layout of a coredump. To start, the

} Elf32_Phdr;
```

Here is a brief breakdown of the fields in the program header:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since p_flags is omitted:

Suggested change
Here is a brief breakdown of the fields in the program header:
Here is a brief breakdown of the fields we care about in the program header:

The first two fields of the segment are fairly self explanatory, they represent
the size of both the name and the descriptor. The `name` field is a string that
represents the type of note. The `desc` field is a structure that contains the
actual data of the note. The type field tells us what type of note we are
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
actual data of the note. The type field tells us what type of note we are
actual data of the note. The `type` field tells us what type of note we are

represent either the stack, heap, or any other segment of memory that was loaded
into the process.

## `procfs` Shallow Dive
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking this section would fit better after core_pattern, or within core_pattern? Feels slightly out of place here

Comment on lines +275 to +279
Now you're probably wondering, why did we go through all of this trouble to end
up with a file that's largely the same as what the kernel would have produced?
Well for one it allows us to add metadata to the coredump, but it also sets the
stage for more advanced coredump handling in the future that we'll cover in the
the next article.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really great, I like the anticipation of reader questions a lot

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