Browse Source

* fixed checking the address of installed signal handlers on aix and
linux/ppc64 (have to look past the function descriptors)

git-svn-id: trunk@20820 -

Jonas Maebe 13 years ago
parent
commit
9a1cd0ec4c
1 changed files with 11 additions and 0 deletions
  1. 11 0
      rtl/unix/sysutils.pp

+ 11 - 0
rtl/unix/sysutils.pp

@@ -106,7 +106,14 @@ function InternalInquireSignal(RtlSigNum: Integer; out act: SigActionRec; fromin
             if not frominit then
             if not frominit then
               begin
               begin
                 { check whether the installed signal handler is still ours }
                 { check whether the installed signal handler is still ours }
+{$if not defined(aix) and (not defined(linux) or not defined(cpupowerpc64))}
                 if (pointer(act.sa_handler)=pointer(@defaultsighandler)) then
                 if (pointer(act.sa_handler)=pointer(@defaultsighandler)) then
+{$else}
+                { on aix and linux/ppc64, procedure addresses are actually
+                  descriptors -> check whether the code addresses inside the
+                  descriptors match, rather than the descriptors themselves }
+                if (ppointer(act.sa_handler)^=ppointer(@defaultsighandler)^) then
+{$endif}
                   result:=ssHooked
                   result:=ssHooked
                 else
                 else
                   result:=ssOverridden;
                   result:=ssOverridden;
@@ -121,7 +128,11 @@ function InternalInquireSignal(RtlSigNum: Integer; out act: SigActionRec; fromin
                 { program -> signals have been hooked by system init code }
                 { program -> signals have been hooked by system init code }
                 if (byte(RtlSigNum) in [RTL_SIGFPE,RTL_SIGSEGV,RTL_SIGILL,RTL_SIGBUS]) then
                 if (byte(RtlSigNum) in [RTL_SIGFPE,RTL_SIGSEGV,RTL_SIGILL,RTL_SIGBUS]) then
                   begin
                   begin
+{$if not defined(aix) and (not defined(linux) or not defined(cpupowerpc64))}
                     if (pointer(act.sa_handler)=pointer(@defaultsighandler)) then
                     if (pointer(act.sa_handler)=pointer(@defaultsighandler)) then
+{$else}
+                    if (ppointer(act.sa_handler)^=ppointer(@defaultsighandler)^) then
+{$endif}
                       result:=ssHooked
                       result:=ssHooked
                     else
                     else
                       result:=ssOverridden;
                       result:=ssOverridden;