[patch] get_scno should test TCB_INSYSCALL at the beginning

Michael Holzheu HOLZHEU at de.ibm.com
Mon Nov 17 04:30:20 UTC 2003


Hi,

strace-2.5  does not work correctly for s390(x) on 2.4 Kernels.

I think we made an error in implementing Jochen's patch for s390. In case
of the old style passing the scno via the SVC instruction, we leave the
function 'get_scno()', if we are not in a syscall. I think it should be the
other way round. We should leave the get_scno(), if we are already in the
syscall (tcp->flags & TCP_INSYSCALL).

This is the code wich causes the problem:

                /*
                 * Old style of "passing" the scno via the SVC instruction.
                 */

      < snip>

                /* Bail out since if we stopped for a signal after the last
                   system call return, we might not be looking at the kind
                   of instruction stream we expect.  */
                if (!(tcp->flags & TCB_INSYSCALL))
                        return 1;

--> should be (???):

            if (tcp->flags & TCB_INSYSCALL)
                        return 1;


Here is the corresponding patch against strace-2.5:

(See attached file: get_scno2.patch)

Or even better, why not put

if (tcp->flags & TCB_INSYSCALL)
                return 1;

at the beginning of get_scno() as Jochen suggested?

Regards

       Michael

------------------------------------------------------------------------
Linux for E-Server Development
Phone: +49-7031-16-2360,  Bld 71032-03-U09
Email: holzheu at de.ibm.com

----- Forwarded by Michael Holzheu/Germany/IBM on 14.11.2003 10:59 -----
|---------+---------------------------------------->
|         |           jochen at penguin-breeder.org   |
|         |           Sent by:                     |
|         |           strace-devel-admin at lists.sour|
|         |           ceforge.net                  |
|         |                                        |
|         |                                        |
|         |           11.09.2003 09:50             |
|         |                                        |
|---------+---------------------------------------->
  >-----------------------------------------------------------------------------------------------------------------------------|
  |                                                                                                                             |
  |       To:       strace-devel at lists.sourceforge.net                                                                          |
  |       cc:                                                                                                                   |
  |       Subject:  [patch] get_scno should test TCB_INSYSCALL at the beginning                                                 |
  |                                                                                                                             |
  |                                                                                                                             |
  >-----------------------------------------------------------------------------------------------------------------------------|



get_scno should test TCB_INSYSCALL at the beginning
the function get_scno in signal.c should test whether
the scno needs to be updated at the beginning, instead
of just determining it anyway and deciding at the end
whether it needs to be updated or not.

get_scno is invoked when a syscall is entered and when
it's left. When it's entered, we need the scno anyway,
but when it's left we don't need. Even more, when it's
left we might be already in some other context (signal
handler or similar), so we cannot determine it anyway.
Now on some architectures (s390) this may result in a
(failing) attempt to access memory of the traced
process to determine the scno.

and it's more efficient anyway.

see attached patch.

regards
-- jochen

ps: i also filed this as bug 803946 at your sf.net site
(See attached file: get_scno.patch)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: get_scno2.patch
Type: application/octet-stream
Size: 422 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20031117/56fca8aa/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: get_scno.patch
Type: application/octet-stream
Size: 536 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20031117/56fca8aa/attachment-0001.obj>


More information about the Strace-devel mailing list