Bug 91569 - sigprocmask sets mask with invalid how
Summary: sigprocmask sets mask with invalid how
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: kernel
Version: 9
Hardware: i586
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Arjan van de Ven
QA Contact: Brian Brock
URL: http://www.opengroup.org/onlinepubs/0...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-05-24 15:33 UTC by Steve Grubb
Modified: 2007-04-18 16:53 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-08-20 14:07:47 UTC
Embargoed:


Attachments (Terms of Use)
Patch to fix the problem (409 bytes, patch)
2003-05-25 11:44 UTC, Steve Grubb
no flags Details | Diff

Description Steve Grubb 2003-05-24 15:33:58 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.2.1) Gecko/20030225

Description of problem:
sigprocmask is setting the signal mask even though an invalid how is sent to the
kernel. Most programs do not use invalid how parameters, but setting the mask is
unexpected. I read through the glibc code and it looks like a straight pass
through to the kernel.

Version-Release number of selected component (if applicable):
kernel-2.4.20-13.9

How reproducible:
Always

Steps to Reproduce:
1. Compile and run the following program:

#include <stdio.h>
#include <signal.h>
 
int main(void)
{
        sigset_t actl, oactl;
        sigemptyset(&actl);
        sigemptyset(&oactl);
 
        sigaddset(&actl, SIGABRT);
        sigprocmask(SIG_SETMASK, &actl, NULL); // init mask to just SIGABRT
                                                                                
        sigaddset(&actl, SIGALRM);
        if (sigprocmask(20000, &actl, NULL) != -1) {
                perror("sigprocmask() did not fail even though invalid how
parameter was passed to it.\n");
                return 1;
        }
                                                                                
        sigprocmask(SIG_SETMASK, NULL, &oactl); // read mask
        if (sigismember(&oactl, SIGALRM) == 1) {
                printf("FAIL: SIGALRM was set even though how is bad. \n");
                return 1;
        }
 
        return 0;
}


Actual Results:  FAIL: SIGALRM was set even though how is bad.

Expected Results:  No printout from program

Comment 1 Arjan van de Ven 2003-05-24 16:21:50 UTC
Hmm
indeed the SUS spec says it needs to return -EINVAL; investigating


Comment 2 Steve Grubb 2003-05-25 11:44:20 UTC
Created attachment 91956 [details]
Patch to fix the problem

I also sent this patch to Linus.


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