Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 7950 - POSIX.1/SUS conformance bug: sigprocmask() incorrectly mods sig-mask
Summary: POSIX.1/SUS conformance bug: sigprocmask() incorrectly mods sig-mask
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: kernel
Version: 6.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Michael K. Johnson
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 1999-12-22 18:06 UTC by Jay Turner
Modified: 2015-01-07 23:40 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2000-01-04 22:20:40 UTC


Attachments (Terms of Use)
Proposed patch for sigprocmask(2) defect (deleted)
1999-12-22 18:45 UTC, Glen Foster
no flags Details | Diff

Description Glen Foster 1999-12-22 18:06:10 UTC
PCTS tests for sigprocmask() have uncovered a defect in the way signal
masks are managed.  The test-case below specifically provides an "invalid"
*how* argument and expects the resulting signal mask to NOT change.  But
upon execution of the code below, the signal mask *is* modified.

Cristian Gafton has analyzed this and concurs about it being a kernel bug.

[snip]
#include <stdio.h>
#include <signal.h>
#include <errno.h>

#define INVALID_HOW (SIG_SETMASK + SIG_BLOCK + SIG_UNBLOCK)

main()
{
        int pid, x;
        sigset_t set, oset;
        void dumpset();

printf("**** Start *****\n");
        sigemptyset(&set);
        sigemptyset(&oset);
        dumpset(set, " set");
        dumpset(oset, "oset");

        printf("\nCalling sigprocmask(SIG_SETMASK, &set, &oset)\n");
        x = sigprocmask(SIG_SETMASK, &set, &oset);
        printf("sigprocmask(SIG_SETMASK) returns %d, errno %d\n", x,
		errno);
        if (errno) perror("sigprocmask");
	dumpset(set, " set");
        dumpset(oset, "oset");

printf("\t... adding SIGHUP to signal set\n");
        sigaddset(&set, SIGHUP);
        dumpset(set, " set");

        printf("\nCalling sigprocmask(INVALID_HOW, &set, &oset)\n");
        x = sigprocmask(INVALID_HOW, &set, &oset);
        printf("sigprocmask returns %d, errno %d\n", x, errno);
        if (errno) perror("sigprocmask");
        dumpset(set, " set");
        dumpset(oset, "oset");

        sigprocmask(SIG_SETMASK, (sigset_t *)0, &oset);
        if (sigismember(&oset, SIGHUP))
                printf("\n\t\tOOPS: signal mask altered!\n\n");
        exit(0);
}
char *n;
{
        int i = 0, *ip = (int *) &s;

        printf("%s = ", n);
        while (i < sizeof(s) / sizeof(int)) {
                /*printf("[0x%08x]", *ip++);*/
                printf("%1d", *ip++);
                if (++i % 105 == 0)
                        printf("\n");
        }
        printf("\n");
        return;
}
void
dumpset(s, n)
sigset_t s;
     dumpset(set, " set");

Comment 1 Glen Foster 1999-12-22 18:45:59 UTC
Created attachment 42 [details]
Proposed patch for sigprocmask(2) defect

Comment 2 Cristian Gafton 2000-01-04 22:20:59 UTC
Assigned to dledford

Comment 3 Alan Cox 2000-08-08 18:03:22 UTC
This should be ok since 2.2.14 kernels (6.2)



Note You need to log in before you can comment on or make changes to this bug.