Bug 61421

Summary: Wrong usage of sigaction in dhcpcd
Product: [Retired] Red Hat Linux Reporter: mehdi.farhat <mehdi.farhat>
Component: dhcpcdAssignee: Elliot Lee <sopwith>
Status: CLOSED WONTFIX QA Contact:
Severity: low Docs Contact:
Priority: medium    
Version: 7.2   
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2002-03-19 14:28:01 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
signals.c.patch for avoid a strange syslog message... none

Description mehdi.farhat 2002-03-19 14:27:56 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)

Description of problem:
in dhcpcd-1.3.18pl8-10 the prog try to make a sigaction on SIGKILL
and report a error on syslog.
like: "dhcpcd[1975]: dhcpConfig: ioctl SIOCADDRT: Invalid argument"

Version-Release number of selected component (if applicable):
dhcpcd-1.3.18pl8-10 

How reproducible:
Always

Steps to Reproduce:
1. just start dhcpcd with some debug
2. strace /sbin/dhcpcd -d -n -H eth0 2>&1 |grep rt_sigaction


Actual Results:  .
.
rt_sigaction(SIGBUS, {0x80494b0, [], 0x4000000}, NULL, 8) = 0
rt_sigaction(SIGFPE, {0x80494b0, [], 0x4000000}, NULL, 8) = 0
rt_sigaction(SIGKILL, {0x80494b0, [], 0x4000000}, NULL, 8) = -1 EINVAL 
(Invalid argument)
rt_sigaction(SIGUSR1, {0x80494b0, [], 0x4000000}, NULL, 8) = 0
rt_sigaction(SIGSEGV, {0x80494b0, [], 0x4000000}, NULL, 8) = 0
.
.

Expected Results:  when read the man of sigaction we see:
       signum  specifies  the  signal and can be any valid signal
       except SIGKILL and SIGSTOP.


Additional info:

Just do a report to the dhcpcd maintener.
or just patch the source code for avoid this stupid message.

Have a nice day.
    Mehdi Farhat.

Comment 1 Elliot Lee 2002-04-15 15:37:22 UTC
The slightly broken sigaction usage is not causing the ioctl to fail. (dhcpcd's
signalSetup() function is doing a loop over all the signal numbers from 1
through 15 to set the sigHandler for them. Not great, but forgiveable).

Comment 2 mehdi.farhat 2002-05-02 12:40:59 UTC
Here a sample patch to avoid message in the syslog...

Have a nice day :)
 
____________________
diff -Naur dhcpcd-1.3.22-pl1/signals.c dhcpcd-1.3.22-pl1.new/signals.c
--- dhcpcd-1.3.22-pl1/signals.c	Sun Jan 20 23:51:46 2002
+++ dhcpcd-1.3.22-pl1.new/signals.c	Thu May  2 14:30:03 2002
@@ -129,11 +129,11 @@
 /*****************************************************************************/
 void signalSetup()
 {
-  int i;
+  int signum[]={1,2,3,4,5,6,7,8,10,11,12,13,14,15,17,0};
+  int i=0;
   struct sigaction action;
   sigaction(SIGHUP,NULL,&action);
   action.sa_handler= &sigHandler;
   action.sa_flags = 0;
-  for (i=1;i<16;i++) sigaction(i,&action,NULL);
-  sigaction(SIGCHLD,&action,NULL);
+  while(signum[i]>0){sigaction(signum[i++],&action,NULL);}
 }


Comment 3 mehdi.farhat 2002-05-03 11:35:48 UTC
Created attachment 56285 [details]
signals.c.patch for avoid a strange syslog message...