public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Michael Kerrisk" <mtk.manpages@googlemail.com>
To: "Davide Libenzi" <davidel@xmailserver.org>
Cc: lkml <linux-kernel@vger.kernel.org>
Subject: Re: signalfd() not handling sigqueue() sigval data correctly
Date: Thu, 10 Apr 2008 07:03:18 +0200	[thread overview]
Message-ID: <cfd18e0f0804092203s33f0ca5as92f47c4db0b0220f@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0804091256490.6235@alien.or.mcafeemobile.com>

Hi Davide,

> > I was doing some playing about with signalfd(), and seem to have encountered a
> > bug: when a signalfd read() fetches data for a signal that was sent by
> > sigqueue(), the data accompanying the signal is not returned.  Instead
> > ssi_int/ssi_ptr is zero.
>
> Michael, can you give the patch below a spin? I tested it on my x86_64 box
> and seems to be working fine:
>
> Got signal 44
>   ssi_code= -1
>   ssi_pid = 6314
>   ssi_uid = 1000
>   ssi_int = 123
>   ssi_ptr = 7b

This works for me on x86-32.  Thanks Davide!

Cheers,

Michael

> ---
>  fs/signalfd.c |    7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> Index: linux-2.6.mod/fs/signalfd.c
> ===================================================================
> --- linux-2.6.mod.orig/fs/signalfd.c    2008-04-09 11:53:37.000000000 -0700
> +++ linux-2.6.mod/fs/signalfd.c 2008-04-09 12:05:46.000000000 -0700
> @@ -111,9 +111,14 @@
>                err |= __put_user(kinfo->si_uid, &uinfo->ssi_uid);
>                err |= __put_user((long) kinfo->si_ptr, &uinfo->ssi_ptr);
>                break;
> -       default: /* this is just in case for now ... */
> +       default:
> +               /*
> +                * This case catches also the signals queued by sigqueue().
> +                */
>                err |= __put_user(kinfo->si_pid, &uinfo->ssi_pid);
>                err |= __put_user(kinfo->si_uid, &uinfo->ssi_uid);
> +               err |= __put_user((long) kinfo->si_ptr, &uinfo->ssi_ptr);
> +               err |= __put_user(kinfo->si_int, &uinfo->ssi_int);
>                break;
>        }
>
>



-- 
Michael Kerrisk
Maintainer of the Linux man-pages project: http://www.kernel.org/doc/man-pages/
Want to report a man-pages bug? Look here:
http://www.kernel.org/doc/man-pages/reporting_bugs.html

  reply	other threads:[~2008-04-10  5:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-08 21:09 signalfd() not handling sigqueue() sigval data correctly Michael Kerrisk
2008-04-08 23:37 ` Davide Libenzi
2008-04-09  6:31   ` Michael Kerrisk
2008-04-09  7:06     ` Davide Libenzi
2008-04-09 19:59 ` Davide Libenzi
2008-04-10  5:03   ` Michael Kerrisk [this message]
2008-04-10 10:32     ` Michael Kerrisk
2008-04-10 17:21       ` Davide Libenzi

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=cfd18e0f0804092203s33f0ca5as92f47c4db0b0220f@mail.gmail.com \
    --to=mtk.manpages@googlemail.com \
    --cc=davidel@xmailserver.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox