All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Brauner <brauner@kernel.org>
To: Emanuele Rocca <emanuele.rocca@arm.com>
Cc: linux-kernel@vger.kernel.org,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	 Jan Kara <jack@suse.cz>,
	linux-fsdevel@vger.kernel.org, Mark Brown <broonie@kernel.org>,
	 Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] coredump: add core_pattern specifier for si_code
Date: Wed, 18 Mar 2026 10:45:42 +0100	[thread overview]
Message-ID: <20260318-lanze-dachwohnung-d04d1ff63e12@brauner> (raw)
In-Reply-To: <ablsdmLsMKm0z5wt@NH27D9T0LF>

On Tue, Mar 17, 2026 at 04:00:06PM +0100, Emanuele Rocca wrote:
> The specifiers supported by core_pattern include the option to indicate the
> signal number si_signo by using %s. Other than identifying which signal
> generated a core dump (eg: 11 for SIGSEGV), it is useful to know the reason why
> a certain signal was sent. The signal code si_code (eg: 2 for SEGV_ACCERR)
> provides this information.
> 
> Adding the signal code to core_pattern can benefit in particular sysadmins who
> pipe core dumps to user-space programs for later analysis. systemd-coredump(8)
> is a notable example of such programs.
> 
> Signed-off-by: Emanuele Rocca <emanuele.rocca@arm.com>
> ---
>  Documentation/admin-guide/sysctl/kernel.rst | 1 +
>  fs/coredump.c                               | 5 +++++
>  2 files changed, 6 insertions(+)
> 
> diff --git a/Documentation/admin-guide/sysctl/kernel.rst b/Documentation/admin-guide/sysctl/kernel.rst
> index 9aed74e65cf4..20177bd94514 100644
> --- a/Documentation/admin-guide/sysctl/kernel.rst
> +++ b/Documentation/admin-guide/sysctl/kernel.rst
> @@ -170,6 +170,7 @@ core_pattern
>  	%d		dump mode, matches ``PR_SET_DUMPABLE`` and
>  			``/proc/sys/fs/suid_dumpable``
>  	%s		signal number
> +	%n		signal code

Request %F which installs pidfd for the coredumping process into the
coredump helper then use the pidfd info ioctl in you binary with
PIDFD_INFO_EXIT | PIDFD_INFO_COREDUMP and you can retrieve the exit
status including the signal that was sent to the process.

  reply	other threads:[~2026-03-18  9:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-17 15:00 [PATCH] coredump: add core_pattern specifier for si_code Emanuele Rocca
2026-03-18  9:45 ` Christian Brauner [this message]
2026-03-18 13:17   ` Emanuele Rocca
2026-03-19 10:31     ` Christian Brauner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260318-lanze-dachwohnung-d04d1ff63e12@brauner \
    --to=brauner@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=broonie@kernel.org \
    --cc=emanuele.rocca@arm.com \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.