Re: [PATCH 0/5] coredump: allow for flexible coredump handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2025-05-30 at 13:09 +0200, Christian Brauner wrote:
> In addition to the extensive selftests I've already written a
> (non-production ready) simple Rust coredump server for this in
> userspace:
> 
> https://github.com/brauner/dumdum.git
> 
> Extend the coredump socket to allow the coredump server to tell the
> kernel how to process individual coredumps. This allows for fine-grained
> coredump management allowing choose how to process individual coredump
> requests. Userspace can decide to just let the kernel write out the
> coredump, or generate the coredump itself, or just reject it.
> 
> When the crashing task connects to the coredump socket the kernel will
> send a struct coredump_req to the coredump server. The kernel will set
> the size member of struct coredump_req allowing the coredump server how
> much data can be read.
> 
> The coredump server uses MSG_PEEK to peek the size of struct
> coredump_req. If the kernel uses a newer struct coredump_req the
> coredump server just reads the size it knows and discard any remaining
> bytes in the buffer. If the kernel uses an older struct coredump_req
> the coredump server just reads the size the kernel knows.
> 
> The returned struct coredump_req will inform the coredump server what
> features the kernel supports. The coredump_req->mask member is set to
> the currently know features.
> 
> The coredump server may only use features whose bits were raised by the
> kernel in coredump_req->mask.
> 
> In response to a coredump_req from the kernel the coredump server sends
> a struct coredump_ack to the kernel. The kernel informs the coredump
> server what version of struct coredump_ack it supports by setting struct
> coredump_req->size_ack to the size it knows about. The coredump server
> may only send as many bytes as coredump_req->size_ack indicates (a
> smaller size is fine of course). The coredump server must set
> coredump_ack->size accordingly.
> 
> The coredump server sets the features it wants to use in struct
> coredump_ack->mask. Only bits returned in struct coredump_req->mask may
> be used.
> 
> In case an invalid struct coredump_ack is sent to the kernel an
> out-of-band byte will be sent by the kernel indicating the reason why
> the coredump_ack was rejected.
> 
> If the coredump server sent a valid struct coredump_ack the kernel will
> place an out-of-band byte indicating that the request was successful. If
> the kernel is generating the coredump and sending the coredump data on
> the socket the success out-of-band marker can be used as an indicator
> when coredump data starts.
> 
> The out-of-band markers allow advanced userspace to infer failure. They
> are optional and can be ignored by not listening for POLLPRI events and
> aren't necessary for the coredump server to function correctly.
> 
> In the initial version the following features are supported in
> coredump_{req,ack}->mask:
> 
> * COREDUMP_KERNEL
>   The kernel will write the coredump data to the socket after the
>   req-ack sequence has concluded successfully.
> 
> * COREDUMP_USERSPACE
>   The kernel will not write coredump data but will indicate to the
>   parent that a coredump has been generated. This is used when userspace
>   generates its own coredumps.
> 
> * COREDUMP_REJECT
>   The kernel will skip generating a coredump for this task.
> 
> * COREDUMP_WAIT
>   The kernel will prevent the task from exiting until the coredump
>   server has shutdown the socket connection.
> 
> Signed-off-by: Christian Brauner <brauner@xxxxxxxxxx>
> ---
> Christian Brauner (5):
>       coredump: allow for flexible coredump handling
>       selftests/coredump: fix build
>       selftests/coredump: cleanup coredump tests
>       tools: add coredump.h header
>       selftests/coredump: add coredump server selftests
> 
>  fs/coredump.c                                     |  151 +-
>  include/uapi/linux/coredump.h                     |  104 ++
>  tools/include/uapi/linux/coredump.h               |  104 ++
>  tools/testing/selftests/coredump/Makefile         |    2 +-
>  tools/testing/selftests/coredump/config           |    4 +
>  tools/testing/selftests/coredump/stackdump_test.c | 1524 +++++++++++++++++----
>  6 files changed, 1639 insertions(+), 250 deletions(-)
> ---
> base-commit: 3e406741b19890c3d8a2ed126aa7c23b106ca9e1
> change-id: 20250520-work-coredump-socket-protocol-6980d1f54c2f

Has anyone discussed adding this support to abrt? I imagine they'd like
to plumb this support in.

In any case, this all looks good. You can add this to all 5:

Reviewed-by: Jeff Layton <jlayton@xxxxxxxxxx>





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux