summaryrefslogtreecommitdiff
path: root/tools/lib/python
diff options
context:
space:
mode:
authorChristian Brauner <brauner@kernel.org>2026-09-22 13:25:03 +0200
committerChristian Brauner <brauner@kernel.org>2026-09-22 13:25:03 +0200
commit9e46a55ed1e782e2cba3a9d906d350eca2877b1d (patch)
treef4d1d77025c69dc989e75cc0e4de5fdce00c7ecc /tools/lib/python
parentcee9395acd8043be0644b25c34bfa86623f2b935 (diff)
parent5ffde62520c17e079a3f61c42b46c655fe0cb942 (diff)
downloadlinux-next-9e46a55ed1e782e2cba3a9d906d350eca2877b1d.tar.gz
linux-next-9e46a55ed1e782e2cba3a9d906d350eca2877b1d.zip
Merge patch series "coredump: allow to create sparse coredumps on the coredump socket"
Christian Brauner <brauner@kernel.org> says: A coredump generated via the coredump socket ends up transferring zeroed data when a mapping contains holes. For a large process that maps a bunch of data that's wasting a ton of work. Jacob ran into this and Josef has bitched^wcomplained about this to me before. I dislike the coredump_filter bit solution in [1] which stops each PT_LOAD at the last populated page. The problem is real though. I don't think coredump_filter is where we need to solve this. That mask says which kinds of memory to include and it propagates across fork and exec, whereas what is being selected here is an encoding mechanism. I also think that the usermodehelper - may it swiftly die - isn't really salvagable for this and it's not the future anyway. The coredump socket already has a handshake for stuff like this. I always had an idea how this would look like but punted on it back then. So here it is. A server that raises COREDUMP_RECORDS in coredump_ack->mask doesn't get the coredump as a plain byte stream but as a sequence of records. Each one a struct coredump_record_header followed by what it describes. A data record carries its bytes. If a server also raises COREDUMP_SPARSE, zero records are sent for unpopulated mappings. They only indicate how many zero bytes need to be written and do not include data. Reassembling the records gives back the same coredump. A debugger and everything else still see an ordinary core file and nothing outside the coredump server has to learn anything. Numbers from the selftests, on a kernel built from this series: - a process with 128 threads: 1424153 bytes on the socket for a coredump of 1075150848 bytes - a 256MB mapping with the first and last page touched: 188793 bytes on the socket for a coredump of 268890112 bytes - the same 256MB mapping with COREDUMP_RECORDS alone: 271009312 bytes on the socket, so the record overhead itself is under one percent The first one is the interesting case. Almost all of it is thread stacks. All stacks are 8MB reservations that are nearly all holes. And they are holes in the middle of the dump rather than at the end. Link: https://lore.kernel.org/all/20260731171336.2255844-1-jalalonde@meta.com [1] * patches from https://patch.msgid.link/20260820-work-coredump-sparse-v2-0-ba32dd718c51@kernel.org: (21 commits) selftests/coredump: show how to inspect the task to decide how the coredump should be sent selftests/coredump: simulate a blob store selftests/coredump: put a hole in the middle of a sparse mapping selftests/coredump: hand the record stream to a sink selftests/coredump: test COREDUMP_RECORDS and COREDUMP_SPARSE coredump: describe the holes when COREDUMP_SPARSE is negotiated coredump: send the coredump in records if requested tools: sync coredump.h header coredump: add COREDUMP_SPARSE to the coredump socket protocol coredump: add COREDUMP_RECORDS to the coredump socket protocol coredump: clean up coredump state handling coredump: always chunk writes coredump: make the dump helper return bool coredump: deduplicate the to_skip flush coredump: move the negotiated mask into struct coredump_params coredump: pin the protocol struct sizes selftests/coredump: add a separate helper header selftests/coredump: collapse the expected request check into the helper selftests/coredump: discard the right amount after the coredump request coredump: set the minimum send buffer size ... Link: https://patch.msgid.link/20260820-work-coredump-sparse-v2-0-ba32dd718c51@kernel.org Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions