Bug 91569

Summary: sigprocmask sets mask with invalid how
Product: [Retired] Red Hat Linux Reporter: Steve Grubb <linux_4ever>
Component: kernelAssignee: Arjan van de Ven <arjanv>
Status: CLOSED UPSTREAM QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 9   
Target Milestone: ---   
Target Release: ---   
Hardware: i586   
OS: Linux   
URL: http://www.opengroup.org/onlinepubs/007908799/xsh/sigprocmask.html
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-08-20 14:07:47 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Patch to fix the problem none

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.