bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Passing invalid signal number to sighold() causes segfault


From: Searty, Salwan
Subject: Passing invalid signal number to sighold() causes segfault
Date: Mon, 14 Apr 2003 18:36:14 -0700

Greetings,

On the version of glibc that comes with RedHat 9.0 (glibc version
2.3.2-11.9) and also on glibc that I built from glibc source that I checked
out last Friday (from the cvs repository on sources.redhat.com:/cvs/glibc),
passing a negative signal number to the interfaces sighold(), sigrelse() and
sigpause() cause a segmentation fault.

Issue 6 of the POSIX System Interfaces document specifies that these three
interfaces shall fail if and set errno to [EINVAL] if the sig argument is an
illegal signal number.

I don't know what it would take make these functions check for invalid
signal numbers that are passed to them. Could someone tell me if that's an
easy task or if it is too complicated to implement such a check?

How to reproduce:
Compile the simple appended test using glibc on a machine with the latest
glibc code, and run it. I was running on linux version 2.5.67-bk1.

Best regards,
-Salwan.

      This email message solely contains my own personal views, and
      not necessarily those of my employer.


/*
 * Copyright (c) 2003, Intel Corporation. All rights reserved.
 * Created by:  salwan.searty REMOVE-THIS AT intel DOT com
 * This file is licensed under the GPL license.  For the full content
 * of this license, see the COPYING file at the top level of this
 * source tree.
 */

#define _XOPEN_SOURCE 600

#include <stdio.h>
#include <signal.h>
#include <errno.h>

int main(void)
{
        printf("Calling sighold\n");
        if (sighold(-1) == -1) {
                if (EINVAL == errno) {
                        printf ("Test PASSED: errno set to EINVAL\n");
                        return 0;
                } else {
                        printf ("Test FAILED: errno not set to EINVAL");
                        return 1;
                }
        }

        printf("Test FAILED: sighold did not return -1\n");
        return 1;
}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]