| Summary: | SA_NOCLDWAIT not cleared on exec | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | ambrisko <ambrisko> | ||||
| Component: | kern | Assignee: | freebsd-bugs (Nobody) <bugs> | ||||
| Status: | Closed FIXED | ||||||
| Severity: | Affects Only Me | ||||||
| Priority: | Normal | ||||||
| Version: | Unspecified | ||||||
| Hardware: | Any | ||||||
| OS: | Any | ||||||
| Attachments: |
|
||||||
State Changed From-To: open->closed Patch applied in rev 1.58 of kern_sig.c, thanks! (BTW; please use diff -c or diff -u for patches) |
I found a bug in FreeBSB with an old perl script that sets $SIG{"CHLD"}="IGNORE". It seems to have broke ever since SA_NOCLDWAIT has been implemented. The issue seems that SA_NOCLDWAIT should be reset after exec so some /bin/sh commands then hang. This is was Solaris apparently does so everything works fine on Solaris even with pthread. Note this is still broken for libc_r, however, on Solaris it works fine with pthreads. I will investigate that later. How-To-Repeat: Sample bug: perl -e '$SIG{"CHLD"}="IGNORE"; system ("echo hello | echo hang");' C version: begin 664 bug.tgz M'XL(`&%6CS<``^V6;6_:,!"`^9K\BA-;:6`4DD#3:8Q)#*JN6E\FJ+8OE9"; M.(E%2!`V;=':_[YS0J!TZSIM@NZ#'REQ?&??G<_QRRD949]%M+!!+--TG"84 M`&S3=F2)F(L2L4P+P#EH-IQ]V[(:*+`<:[\`YB:#RIEQ0:8`!3*^FC(^2IYJ M=Q-2&FTCH.VBZ]UN.W!=72=1]$[7IF/8\T%P(1];UUX;IYW/AV596ZN@JE:7 MPI<>@.*?P"FLN1OV\<SZMQN.F:]_RS8/Y/JWG`.U_K?!*Q:[T<RC\)[/>5W, M)Y37P@_Z2CR+&1?>NHRS(":1E.ECPF*C_%W7)LP;"AC/A_C1#JC`PBBW<CF^ M\9O%`N<;$RYFO*7KFAO*U%>XF+(X0$'60EI/VH/CH^ZGDQ[V0O7,3<7$%2R) M`8LJ)/A&Y77"/*B$)/8B.I6=AL='9RT==`WU-4Z&"Q6T8?$E+;*`CB=BSJDP M2HMV8\)',MY%U8](P+&3^5ATUX9!9]@_'%QT^A<MJ%=@\+7?K$*SUGCS<="# M2AU],Q^,=!C0QN;92*!4@F4PJ52&6M:U_!C\A9NS\^Y)[UOG^**UM)GE(+-> MA5*:BY),1EE:W;/0H#;!?`K?*![VS_N7<1&'M7"QU'PA4XJIQ@F(`[KFZ5+` MC@<[;V_S!PU4LVFM/HRP]+#3FJ:ZGM$G7%]1/YG^N>OD:=]KJF5MX5WFS;A& M5R.C+']3[;<I7$;[4[C$%SAOTL[&0]:T&\+PQ\S6B13<TXC3OPF^&[+(RU-- M;ZF[A>#I+09OIF'+%9VN7US>[2)UPP1"&D4)W(%+1+&UTJ5W"5M*\M`'N"T+ MV,5=2=`Q[/!=&5S67-K.Y,9*D/?K)3'-N^UF/_\JI'MU77F$3/NF+P#/G/]6 M>N?/SG^S83:EQ&Y:ZOS?!B]Y_JOS?F/G_6H_O!39(;#IC5]MK0J%0J%0*!0* 7A4*A4"@4"H5"H5#\-_P`7^B?80`H``#G ` end Machine without patch for resetting SA_NOCLDWAIT after exec. 770z% gmake rm -f tst tst2 gmake tst gmake[1]: Entering directory `/usr/home/ambrisko' gcc tst.c -o tst gmake[1]: Leaving directory `/usr/home/ambrisko' gmake tst2 gmake[1]: Entering directory `/usr/home/ambrisko' gcc tst2.c -o tst2 gmake[1]: Leaving directory `/usr/home/ambrisko' ./tst Parent change SA_NOCLDWAIT 988 20 22 0 Parent before SA_NOCLDWAIT 988 0 2 0 Child before exec SA_NOCLDWAIT 988 20 22 0 Parent after fork SA_NOCLDWAIT 988 20 22 0 Start 'system ./tst2' Child SA_NOCLDWAIT 991 20 22 0 [Then hangs] Machine with patch for resetting SA_NOCLDWAIT after exec. dhcp2% make rm -f tst tst2 make tst gcc -O -pipe tst.c -o tst make tst2 gcc -O -pipe tst2.c -o tst2 ./tst Parent change SA_NOCLDWAIT 284 20 22 0 Parent before SA_NOCLDWAIT 284 0 2 0 Child before exec SA_NOCLDWAIT 284 20 22 0 Parent after fork SA_NOCLDWAIT 284 20 22 0 Start 'system ./tst2' Child SA_NOCLDWAIT 287 0 2 0 Done 'system' dhcp2% On Solaris 5.7 % make rm -f tst tst2 make tst make[1]: Entering directory `/a/207.76.205.244/root/usr/home/ambrisko' gcc tst.c -o tst make[1]: Leaving directory `/a/207.76.205.244/root/usr/home/ambrisko' make tst2 make[1]: Entering directory `/a/207.76.205.244/root/usr/home/ambrisko' gcc tst2.c -o tst2 make[1]: Leaving directory `/a/207.76.205.244/root/usr/home/ambrisko' ./tst Parent change SA_NOCLDWAIT 26241 10000 10004 effffb30 Parent before SA_NOCLDWAIT 26241 0 20000 effffb30 Child before exec SA_NOCLDWAIT 26241 10000 10000 effffb30 Parent after fork SA_NOCLDWAIT 26241 10000 10000 effffb30 Start 'system ./tst2' Child SA_NOCLDWAIT 26244 0 20000 effffb38 Done 'system' %