This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug runtime/3079] New: deref macro cannot read 64-bit values on 32-bit x86


On 32-bit x86, this fails:

function deref64:long() %{
    int64_t a = 42;
    THIS->__retvalue = deref(sizeof(a), &a);
    if (0) {
deref_fault:
        CONTEXT->last_error = "bad stuff happened";
    }
%}
probe begin {
    printf("%d\n", deref64())
    exit()
}

Error messages:
...
{standard input}: Assembler messages:
{standard input}:8811: Error: suffix or operands invalid for `movq'
{standard input}:8815: Error: suffix or operands invalid for `xor'
...

This results from improper use of __get_user_asm().  In 32-bit mode, 'mov' and
'xor' cannot deal with 64-bit quantities.

Probably the fix will need to make two 32-bit calls to __get_user_asm to get the
whole 64-bit quantity (nothing says this needs to be atomic anyway).  There's
still a problem with the "return-value" of deref, an intptr_t, as it can't hold
a 64-bit value.  And we can't change the return type to int64_t, because that
won't cleanly typecast to pointers.

I imagine the semantics of deref will need to change a bit, perhaps to something
like this:

#define deref(var)  deref_ex(typeof(var), sizeof(var), &(var))
#define deref_ex(type, size, addr)  ... /* return type is (type) */

I will probably tackle this bug myself, but I wanted to solicit ideas/feedback
from others before I try it...

-- 
           Summary: deref macro cannot read 64-bit values on 32-bit x86
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: runtime
        AssignedTo: systemtap at sources dot redhat dot com
        ReportedBy: joshua dot i dot stone at intel dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=3079

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]