public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] hurd: '_hurd_raise_signal' checks signal number is valid
       [not found] <20201013135744.mpizainhz43e5vkl@function>
@ 2020-10-13 21:16 ` Ludovic Courtès
  2020-10-13 21:20   ` Jessica Clarke
  2020-10-14 10:54   ` Andreas Schwab
  0 siblings, 2 replies; 5+ messages in thread
From: Ludovic Courtès @ 2020-10-13 21:16 UTC (permalink / raw)
  To: libc-alpha
  Cc: bug-hurd, Samuel Thibault, Jan Nieuwenhuizen, Ludovic Courtès

Previously, 'pthread_kill (pthread_self (), -1)' would wrongfully
succeed:

  https://lists.gnu.org/archive/html/guix-devel/2020-10/msg00152.html

Reported-by: Jan Nieuwenhuizen <janneke@gnu.org>
---
 hurd/hurd-raise.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hurd/hurd-raise.c b/hurd/hurd-raise.c
index d53fd417d2..58b4ffcc83 100644
--- a/hurd/hurd-raise.c
+++ b/hurd/hurd-raise.c
@@ -28,6 +28,9 @@ int
 _hurd_raise_signal (struct hurd_sigstate *ss,
 		    int signo, const struct hurd_signal_detail *detail)
 {
+  if (signo < 1 || signo >= _NSIG)
+    return EINVAL;
+
   if (ss == NULL)
     {
       ss = _hurd_self_sigstate ();
-- 
2.28.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] hurd: '_hurd_raise_signal' checks signal number is valid
  2020-10-13 21:16 ` [PATCH] hurd: '_hurd_raise_signal' checks signal number is valid Ludovic Courtès
@ 2020-10-13 21:20   ` Jessica Clarke
  2020-10-14 10:43     ` Samuel Thibault
  2020-10-14 10:54   ` Andreas Schwab
  1 sibling, 1 reply; 5+ messages in thread
From: Jessica Clarke @ 2020-10-13 21:20 UTC (permalink / raw)
  To: Ludovic Courtès
  Cc: libc-alpha, bug-hurd, Samuel Thibault, Jan Nieuwenhuizen

On 13 Oct 2020, at 22:16, Ludovic Courtès <ludo@gnu.org> wrote:
> 
> Previously, 'pthread_kill (pthread_self (), -1)' would wrongfully
> succeed:
> 
>  https://lists.gnu.org/archive/html/guix-devel/2020-10/msg00152.html
> 
> Reported-by: Jan Nieuwenhuizen <janneke@gnu.org>
> ---
> hurd/hurd-raise.c | 3 +++
> 1 file changed, 3 insertions(+)
> 
> diff --git a/hurd/hurd-raise.c b/hurd/hurd-raise.c
> index d53fd417d2..58b4ffcc83 100644
> --- a/hurd/hurd-raise.c
> +++ b/hurd/hurd-raise.c
> @@ -28,6 +28,9 @@ int
> _hurd_raise_signal (struct hurd_sigstate *ss,
> 		    int signo, const struct hurd_signal_detail *detail)
> {
> +  if (signo < 1 || signo >= _NSIG)
> +    return EINVAL;
> +

From pthread_kill(3):

    If sig is 0, then no signal is sent, but error checking is still performed.

I interpret that as meaning it validates thread but ignores sig.

Jess


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] hurd: '_hurd_raise_signal' checks signal number is valid
  2020-10-13 21:20   ` Jessica Clarke
@ 2020-10-14 10:43     ` Samuel Thibault
  0 siblings, 0 replies; 5+ messages in thread
From: Samuel Thibault @ 2020-10-14 10:43 UTC (permalink / raw)
  To: Jessica Clarke
  Cc: Ludovic Courtès, libc-alpha, bug-hurd, Jan Nieuwenhuizen

Hello,

Jessica Clarke, le mar. 13 oct. 2020 22:20:15 +0100, a ecrit:
> On 13 Oct 2020, at 22:16, Ludovic Courtès <ludo@gnu.org> wrote:
> > Previously, 'pthread_kill (pthread_self (), -1)' would wrongfully
> > succeed:
> > 
> >  https://lists.gnu.org/archive/html/guix-devel/2020-10/msg00152.html

> > --- a/hurd/hurd-raise.c
> > +++ b/hurd/hurd-raise.c
> > @@ -28,6 +28,9 @@ int
> > _hurd_raise_signal (struct hurd_sigstate *ss,
> > 		    int signo, const struct hurd_signal_detail *detail)
> > {
> > +  if (signo < 1 || signo >= _NSIG)
> > +    return EINVAL;
> > +
> 
> From pthread_kill(3):
> 
>     If sig is 0, then no signal is sent, but error checking is still performed.
> 
> I interpret that as meaning it validates thread but ignores sig.

__pthread_kill actually already check for sig == 0, _hurd_raise_signal
is really not supposed to be called with sig == 0.

But thanks for making sure we don't miss that case :)

Samuel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] hurd: '_hurd_raise_signal' checks signal number is valid
  2020-10-13 21:16 ` [PATCH] hurd: '_hurd_raise_signal' checks signal number is valid Ludovic Courtès
  2020-10-13 21:20   ` Jessica Clarke
@ 2020-10-14 10:54   ` Andreas Schwab
  2020-10-14 16:55     ` Ludovic Courtès
  1 sibling, 1 reply; 5+ messages in thread
From: Andreas Schwab @ 2020-10-14 10:54 UTC (permalink / raw)
  To: Ludovic Courtès via Libc-alpha
  Cc: Ludovic Courtès, bug-hurd, Samuel Thibault

https://sourceware.org/git/?p=glibc.git;a=commit;h=785ec62dbd

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] hurd: '_hurd_raise_signal' checks signal number is valid
  2020-10-14 10:54   ` Andreas Schwab
@ 2020-10-14 16:55     ` Ludovic Courtès
  0 siblings, 0 replies; 5+ messages in thread
From: Ludovic Courtès @ 2020-10-14 16:55 UTC (permalink / raw)
  To: Andreas Schwab
  Cc: Ludovic Courtès via Libc-alpha, bug-hurd, Samuel Thibault

Andreas Schwab <schwab@linux-m68k.org> skribis:

> https://sourceware.org/git/?p=glibc.git;a=commit;h=785ec62dbd

Thanks, I guess I was looking at a stale checkout, apologies!

Ludo’.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-10-14 16:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20201013135744.mpizainhz43e5vkl@function>
2020-10-13 21:16 ` [PATCH] hurd: '_hurd_raise_signal' checks signal number is valid Ludovic Courtès
2020-10-13 21:20   ` Jessica Clarke
2020-10-14 10:43     ` Samuel Thibault
2020-10-14 10:54   ` Andreas Schwab
2020-10-14 16:55     ` Ludovic Courtès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).