From: Oleg Nesterov <oleg@redhat.com>
To: Andrey Wagin <avagin@gmail.com>
Cc: linux-kernel@vger.kernel.org, criu@openvz.org,
linux-fsdevel@vger.kernel.org,
Alexander Viro <viro@zeniv.linux.org.uk>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
David Howells <dhowells@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>,
Michael Kerrisk <mtk.manpages@gmail.com>,
Pavel Emelyanov <xemul@parallels.com>,
Cyrill Gorcunov <gorcunov@openvz.org>
Subject: Re: [PATCH 1/4] signalfd: add ability to return siginfo in a raw format
Date: Tue, 25 Dec 2012 15:30:43 +0100 [thread overview]
Message-ID: <20121225143043.GA1813@redhat.com> (raw)
In-Reply-To: <CANaxB-x=fQROdwD1OyU8=Ai9tXWm9QTSsGgfKvPbjn57ER6aZg@mail.gmail.com>
On 12/25, Andrey Wagin wrote:
>
> 2012/12/24 Oleg Nesterov <oleg@redhat.com>:
> > On 12/24, Andrey Vagin wrote:
> >>
> >> signalfd should be called with the flag SFD_RAW for that.
> >>
> >> signalfd_siginfo is not full for siginfo with a negative si_code.
> >> copy_siginfo_to_user() is copied a full siginfo to user-space, if
> >> si_code is negative. signalfd_copyinfo() doesn't do that and can't be
> >> expanded, because it has not compatiable format with siginfo_t.
> >
> > Yes, but otoh perhaps we should change (fix) signalfd_siginfo/copyinfo,
> > its "default" case makes no sense if si_code < 0.
>
> Its "default" case makes sense if a signal is sent by sigqueue(pid,sig,ptr).
But it doesn't really work, that is what I was trying to say. And that
is why you want copy_siginfo_to_user ;)
> I'm afraid, we can change (fix) signalfd_copyinfo, because for
> negative si_code a whole siginfo should be copied to userspace.
Exactly, this is what I meant. We simply do not know what this info
contains if it was sent by sigqueueinfo().
> Currently if si_code is unknown, signalfd_copyinfo sets only ssi_ptr
> and that can't be changed due to backward compatibility. ssi_ptr is in
> the midle of signalfd_siginfo and a sizeof(signalfd_siginfo) is equal
> to sizeof(siginfo_t). We don't have space to copied siginfo into
> signalfd_siginfo.
Yes, I understand.
> If we want to have another format with SFD_RAW, I prefer to have
> siginfo_t instead of signalfd_siginfo. Because if si_code is negative,
> it should be siginfo_t in any case. A minor thing is that it can be
> sent back without modifications.
"without modifications" is not actually true, your patch changes the
meaning of ->si_code. Yes, I understand why do you do this, and I am
not going to argue. But it looks a bit sad that, say, sigtimedwait()
and read(SFD_RAW) will return the "same" siginfo_t except the subtle
difference in ->si_code.
What I am trying to say, is that SFD_RAW should be named
SFD_signalfd_siginfo_SUCKS_BUT_WE_CANT_CHANGE_IT_FOR_COMPATIBILITY ;) So
you need another format. And if we add another format we should think
twice. For example, if it is _RAW, why we can't simply do memcpy()
instead of copy_siginfo_to_user() ? Not that I really suggest this.
And if we change the meaning of ->si_code then, perhaps, we should
think what else we should change to avoid SFD_RAW_RAW in future.
Just for example, we can set MSB in ->si_signo if the signal was
private.
Oleg.
next prev parent reply other threads:[~2012-12-25 14:30 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-24 8:13 [PATCH 0/4] signalfd: a kernel interface for dumping/restoring pending signals Andrey Vagin
2012-12-24 8:13 ` Andrey Vagin
2012-12-24 8:13 ` [PATCH 1/4] signalfd: add ability to return siginfo in a raw format Andrey Vagin
2012-12-24 16:53 ` Oleg Nesterov
2012-12-25 8:29 ` Andrey Wagin
2012-12-25 14:30 ` Oleg Nesterov [this message]
2012-12-25 15:27 ` Oleg Nesterov
2012-12-25 15:40 ` Pavel Emelyanov
2012-12-25 16:58 ` Oleg Nesterov
2012-12-26 14:47 ` [CRIU] " Andrew Vagin
2012-12-26 16:31 ` Oleg Nesterov
2012-12-27 14:36 ` Andrey Wagin
2012-12-27 15:30 ` Oleg Nesterov
2012-12-27 18:40 ` Andrey Wagin
2012-12-28 14:12 ` Oleg Nesterov
2012-12-28 14:28 ` Andrey Wagin
2012-12-28 14:46 ` Oleg Nesterov
2012-12-28 14:48 ` Andrey Wagin
2012-12-28 14:56 ` Oleg Nesterov
2012-12-24 8:13 ` [PATCH 2/4] signal: add a helper for dequeuing signals from a specified queue Andrey Vagin
[not found] ` <1356336807-5517-3-git-send-email-avagin-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2012-12-24 20:52 ` Michael Kerrisk
2012-12-24 20:52 ` Michael Kerrisk
2012-12-24 8:13 ` [PATCH 3/4] signalfd: add ability to choose a private or shared queue Andrey Vagin
2012-12-24 17:05 ` Oleg Nesterov
2012-12-24 20:53 ` Michael Kerrisk
2012-12-24 8:13 ` [PATCH 4/4] signal: allow to send any siginfo to itself Andrey Vagin
[not found] ` <1356336807-5517-1-git-send-email-avagin-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2012-12-24 20:51 ` [PATCH 0/4] signalfd: a kernel interface for dumping/restoring pending signals Michael Kerrisk
2012-12-24 20:51 ` Michael Kerrisk
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=20121225143043.GA1813@redhat.com \
--to=oleg@redhat.com \
--cc=avagin@gmail.com \
--cc=criu@openvz.org \
--cc=dhowells@redhat.com \
--cc=gorcunov@openvz.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mtk.manpages@gmail.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=tglx@linutronix.de \
--cc=viro@zeniv.linux.org.uk \
--cc=xemul@parallels.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.