this fixes decoding of struct sigaction for arm32 binaries traced by
an arm64 strace for me. arm32-arm32 and arm64-arm64 continue to work.

On Thu, Feb 27, 2014 at 1:45 PM, Dmitry V. Levin <[email protected]> wrote:
> On Thu, Feb 27, 2014 at 11:06:09AM -0800, enh wrote:
>> On Wed, Feb 26, 2014 at 3:42 PM, Dmitry V. Levin <[email protected]> wrote:
>> > I've posted a patch that reimplements signal mask decoding without use of
>> > sigset_t.  It fixes this issue, but may introduce new bugs.  Please check
>> > whether it builds and passes sigaction.test in your environment.
>>
>> works for me on arm strace tracing an arm binary and arm64 strace
>> tracing an arm64 binary, so please commit.
>
> Thanks.
>
>> (it doesn't work on arm64 when tracing a 32-bit process, but that's a
>> separate issue. do you want me to send you patches in the style of
>> your stack_t patch from yesterday, or do you prefer to write the
>> patches yourself and just want me to let you know when i hit a struct
>> that differs between LP32 and LP64?)
>
> If you've stumbled upon a bug and made a patch that fixes it, please do
> not hesitate and send the fix to this list.  Of course I prefer patches
> that are ready to be applied. :)
>
>
> --
> ldv
>
> ------------------------------------------------------------------------------
> Flow-based real-time traffic analytics software. Cisco certified tool.
> Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
> Customize your own dashboards, set traffic alerts and generate reports.
> Network behavioral analysis & security monitoring. All-in-one tool.
> http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
> _______________________________________________
> Strace-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/strace-devel
>



-- 
Elliott Hughes - http://who/enh - http://jessies.org/~enh/
Java i18n/JNI/NIO, or bionic questions? Mail me/drop by/add me as a reviewer.
diff --git a/signal.c b/signal.c
index 436039b..cf27dc9 100644
--- a/signal.c
+++ b/signal.c
@@ -691,10 +691,19 @@ struct old_sigaction {
 #endif /* !MIPS */
 };
 
+struct old_sigaction32 {
+       /* sa_handler may be a libc #define, need to use other name: */
+       uint32_t __sa_handler;
+       uint32_t sa_mask;
+       uint32_t sa_flags;
+       uint32_t sa_restorer;
+};
+
 static void
 decode_old_sigaction(struct tcb *tcp, long addr)
 {
        struct old_sigaction sa;
+       int r;
 
        if (!addr) {
                tprints("NULL");
@@ -704,7 +713,25 @@ decode_old_sigaction(struct tcb *tcp, long addr)
                tprintf("%#lx", addr);
                return;
        }
-       if (umove(tcp, addr, &sa) < 0) {
+
+
+#if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4
+       if (current_wordsize != sizeof(sa.__sa_handler) && current_wordsize == 
4) {
+               struct old_sigaction32 sa32;
+               r = umove(tcp, addr, &sa32);
+               if (r >= 0) {
+                       memset(&sa, 0, sizeof(sa));
+                       sa.__sa_handler = (void*)(uintptr_t)sa32.__sa_handler;
+                       sa.sa_flags = sa32.sa_flags;
+                       sa.sa_restorer = (void*)(uintptr_t)sa32.sa_restorer;
+                       sa.sa_mask = sa32.sa_mask;
+               }
+       } else
+#endif
+       {
+               r = umove(tcp, addr, &sa);
+       }
+       if (r < 0) {
                tprints("{...}");
                return;
        }
------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
_______________________________________________
Strace-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to