All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Denys Vlasenko <vda.linux@googlemail.com>
Cc: linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Amerigo Wang <amwang@redhat.com>,
	Roland McGrath <roland@hack.frob.com>
Subject: Re: [PATCH 2/2] coredump: add a new elf note with siginfo fields of the signal
Date: Thu, 13 Sep 2012 17:36:15 +0200	[thread overview]
Message-ID: <20120913153615.GB32128@redhat.com> (raw)
In-Reply-To: <1347493124-10661-2-git-send-email-vda.linux@googlemail.com>

On 09/13, Denys Vlasenko wrote:
>
> This patch adds a new elf note, NT_SIGINFO, which contains
> the remaining fields of siginfo_t.

I can't really comment this patch, but...

> +struct coredump_siginfo {
> +/*	int	csi_signo;	in prstatus.pr_info.si_signo instead */
> +/*	int	csi_errno;	in prstatus.pr_info.si_errno */
> +/*	int	csi_code;	in prstatus.pr_info.si_code */
> +	int	csi_pid;	/* PID of sending process */
> +	int	csi_uid;	/* Real UID of sending process */
> +/*	int	csi_status;	SIGCHLD never kills, field isn't meaningful */
> +/*	clock_t	csi_utime;	SIGCHLD never kills, field isn't meaningful */
> +/*	clock_t	csi_stime;	SIGCHLD never kills, field isn't meaningful */
> +	void	*csi_ptr;	/* union with si_int */
> +	int	csi_tid;	/* POSIX.1b timers */
> +	int	csi_overrun;	/* POSIX.1b timers */
> +	long	csi_band;	/* SIGIO/POLL: band event */
> +	int	csi_fd;		/* SIGIO/POLL: file descriptor */
> +	void	*csi_addr;	/* SEGV/BUS: address which caused fault */
> +	int	csi_trapno;	/* SEGV/BUS */
> +	int	csi_addr_lsb;	/* SEGV/BUS: least significant bit of address */
> +	/* Can be extended in the future, if siginfo_t is extended */
> +};
> +
> +static void fill_siginfo_note(struct memelfnote *note, struct coredump_siginfo *data, siginfo_t *siginfo)
> +{
> +	data->csi_pid      = siginfo->si_pid;
> +	data->csi_uid      = siginfo->si_uid;
> +	data->csi_ptr      = siginfo->si_ptr;
> +	data->csi_overrun  = siginfo->si_overrun;
> +	data->csi_tid      = siginfo->si_tid;
> +	data->csi_band     = siginfo->si_band;
> +	data->csi_fd       = siginfo->si_fd;
> +	data->csi_addr     = siginfo->si_addr;
> +#ifdef __ARCH_SI_TRAPNO
> +	data->csi_trapno   = siginfo->si_trapno;
> +#endif
> +	/* Prevent signed short->int expansion: */
> +	data->csi_addr_lsb = (unsigned short)siginfo->si_addr_lsb;
> +
> +	fill_note(note, "CORE", NT_SIGINFO, sizeof(*data), data);
> +}

I can't understand the layout. struct siginfo is union, for example
si_overrun only makes sense if si_code = SI_TIMER.

Not sure this is right. I think fill_siginfo_note() should either do
memcpy() and let userspace to decode this (raw) info, or this layout
should be unified with copy_siginfo_to_user().

Note also that we do not expose the upper bits of si_code to user-space,
probably coredump should do the same, I dunno.

Oleg.


  reply	other threads:[~2012-09-13 15:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-12 23:38 [PATCH 1/2] coredump: pass siginfo_t* to do_coredump() and below, not merely signr Denys Vlasenko
2012-09-12 23:38 ` [PATCH 2/2] coredump: add a new elf note with siginfo fields of the signal Denys Vlasenko
2012-09-13 15:36   ` Oleg Nesterov [this message]
2012-09-13 15:52     ` Oleg Nesterov
2012-09-13 17:25       ` Roland McGrath
2012-09-17 10:39         ` Pedro Alves
2012-09-14 12:27     ` Denys Vlasenko
2012-09-14 16:38       ` Roland McGrath
2012-09-13 15:08 ` [PATCH 1/2] coredump: pass siginfo_t* to do_coredump() and below, not merely signr Oleg Nesterov
  -- strict thread matches above, loose matches on Subject: below --
2012-09-13 14:31 [PATCH 2/2] coredump: add a new elf note with siginfo fields of the signal Jonathan M. Foote

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=20120913153615.GB32128@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=amwang@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roland@hack.frob.com \
    --cc=vda.linux@googlemail.com \
    /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.