[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120913153615.GB32128@redhat.com>
Date: Thu, 13 Sep 2012 17:36:15 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Denys Vlasenko <vda.linux@...glemail.com>
Cc: linux-kernel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>,
Amerigo Wang <amwang@...hat.com>,
Roland McGrath <roland@...k.frob.com>
Subject: Re: [PATCH 2/2] coredump: add a new elf note with siginfo fields
of the signal
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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists