public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug runtime/5648] New: Unaligned access to memory in _stp_vsnprintf() on ia64
@ 2008-01-19  0:07 mhiramat at redhat dot com
  2008-03-21  3:10 ` [Bug runtime/5648] " shaohua dot li at intel dot com
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: mhiramat at redhat dot com @ 2008-01-19  0:07 UTC (permalink / raw)
  To: systemtap

When I ran testsuite/systemtap.printf/bin4.stp and bin5.stp on ia64, I got
"kernel unaligned access" messages as below;

---(bin4.stp)
bin4: systemtap: 0.6/Red Hat elfutils 0.125, base: a0000002083b4000, memory:
167908+71616+13696+14000+696673 data+text+ctx+io+glob, probes: 1
kernel unaligned access to 0xe0000007914b4026, ip=0xa0000002083bd4c1
kernel unaligned access to 0xe0000007914b402d, ip=0xa0000002083bd4c1
---

---(bin5.stp)
bin5: systemtap: 0.6/Red Hat elfutils 0.125, base: a0000002083b4000, memory:
167908+71616+13696+14000+696673 data+text+ctx+io+glob, probes: 1
kernel unaligned access to 0xe0000007a29a0004, ip=0xa0000002083bd631
kernel unaligned access to 0xe0000007a29a000c, ip=0xa0000002083bd631
kernel unaligned access to 0xe0000007a29a0014, ip=0xa0000002083bd631
kernel unaligned access to 0xe0000007a29a001c, ip=0xa0000002083bd631
kernel unaligned access to 0xe0000007a29a0024, ip=0xa0000002083bd631
---

And both ip was in _stp_vsnprintf().
---
$ nm bin4.ko | sort
...
0000000000008560 T _stp_vsnprintf
0000000000009720 T _stp_vscnprintf
...
$ nm bin5.ko | sort
...
0000000000008540 T _stp_vsnprintf
0000000000009700 T _stp_vscnprintf
---

-- 
           Summary: Unaligned access to memory in _stp_vsnprintf() on ia64
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: minor
          Priority: P3
         Component: runtime
        AssignedTo: systemtap at sources dot redhat dot com
        ReportedBy: mhiramat at redhat dot com


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

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug runtime/5648] Unaligned access to memory in _stp_vsnprintf() on ia64
  2008-01-19  0:07 [Bug runtime/5648] New: Unaligned access to memory in _stp_vsnprintf() on ia64 mhiramat at redhat dot com
@ 2008-03-21  3:10 ` shaohua dot li at intel dot com
  2008-03-28 23:06 ` mhiramat at redhat dot com
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: shaohua dot li at intel dot com @ 2008-03-21  3:10 UTC (permalink / raw)
  To: systemtap


------- Additional Comments From shaohua dot li at intel dot com  2008-03-21 03:10 -------
Created an attachment (id=2333)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=2333&action=view)
fix the unalignment

This patch should fix the issue on IA64, please merge.

-- 


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

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug runtime/5648] Unaligned access to memory in _stp_vsnprintf() on ia64
  2008-01-19  0:07 [Bug runtime/5648] New: Unaligned access to memory in _stp_vsnprintf() on ia64 mhiramat at redhat dot com
  2008-03-21  3:10 ` [Bug runtime/5648] " shaohua dot li at intel dot com
@ 2008-03-28 23:06 ` mhiramat at redhat dot com
  2008-04-30 17:27 ` joshua dot i dot stone at intel dot com
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: mhiramat at redhat dot com @ 2008-03-28 23:06 UTC (permalink / raw)
  To: systemtap


------- Additional Comments From mhiramat at redhat dot com  2008-03-28 23:05 -------
(In reply to comment #1)
> Created an attachment (id=2333)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=2333&action=view)
> fix the unalignment
> 
> This patch should fix the issue on IA64, please merge.

I checked your patch fixed this problem, thank you.

-- 


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

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug runtime/5648] Unaligned access to memory in _stp_vsnprintf() on ia64
  2008-01-19  0:07 [Bug runtime/5648] New: Unaligned access to memory in _stp_vsnprintf() on ia64 mhiramat at redhat dot com
                   ` (2 preceding siblings ...)
  2008-04-30 17:27 ` joshua dot i dot stone at intel dot com
@ 2008-04-30 17:27 ` mhiramat at redhat dot com
  2008-04-30 21:13 ` joshua dot i dot stone at intel dot com
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: mhiramat at redhat dot com @ 2008-04-30 17:27 UTC (permalink / raw)
  To: systemtap


------- Additional Comments From mhiramat at redhat dot com  2008-04-30 16:23 -------
Thanks, the patch was committed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug runtime/5648] Unaligned access to memory in _stp_vsnprintf() on ia64
  2008-01-19  0:07 [Bug runtime/5648] New: Unaligned access to memory in _stp_vsnprintf() on ia64 mhiramat at redhat dot com
  2008-03-21  3:10 ` [Bug runtime/5648] " shaohua dot li at intel dot com
  2008-03-28 23:06 ` mhiramat at redhat dot com
@ 2008-04-30 17:27 ` joshua dot i dot stone at intel dot com
  2008-04-30 17:27 ` mhiramat at redhat dot com
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: joshua dot i dot stone at intel dot com @ 2008-04-30 17:27 UTC (permalink / raw)
  To: systemtap


------- Additional Comments From joshua dot i dot stone at intel dot com  2008-04-30 17:13 -------
(In reply to comment #3)
> Thanks, the patch was committed.

Was the patch tested on any big-endian machines?  I think that the memcpys are
assuming little-endian layout...

-- 


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

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug runtime/5648] Unaligned access to memory in _stp_vsnprintf() on ia64
  2008-01-19  0:07 [Bug runtime/5648] New: Unaligned access to memory in _stp_vsnprintf() on ia64 mhiramat at redhat dot com
                   ` (3 preceding siblings ...)
  2008-04-30 17:27 ` mhiramat at redhat dot com
@ 2008-04-30 21:13 ` joshua dot i dot stone at intel dot com
  2008-04-30 21:13 ` mhiramat at redhat dot com
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: joshua dot i dot stone at intel dot com @ 2008-04-30 21:13 UTC (permalink / raw)
  To: systemtap


------- Additional Comments From joshua dot i dot stone at intel dot com  2008-04-30 20:58 -------
(In reply to comment #5)
> (In reply to comment #4)
> > (In reply to comment #3)
> > > Thanks, the patch was committed.
> > 
> > Was the patch tested on any big-endian machines?
> 
> No, unfortunately, I don't have any big-endian machines.

Neither do I, but maybe some of the IBM folks can try this out on PowerPC...

> > I think that the memcpys are assuming little-endian layout...
> 
> Really? as far as I know, memcpy() is defined on each architecture. So I think
> it can work correctly on those machines.

I mean the way we're calling memcpy with &num.  For size=8 this is ok, but on
smaller sizes I think this will fail.  On a big-endian machine, this will copy
the most-significant bytes instead of the least.  That's a much different result
than casting an uint64_t to a smaller size.

Or put another way, (uint32_t)num != *(uint32_t *)&num on a big-endian machine.


-- 


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

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug runtime/5648] Unaligned access to memory in _stp_vsnprintf() on ia64
  2008-01-19  0:07 [Bug runtime/5648] New: Unaligned access to memory in _stp_vsnprintf() on ia64 mhiramat at redhat dot com
                   ` (4 preceding siblings ...)
  2008-04-30 21:13 ` joshua dot i dot stone at intel dot com
@ 2008-04-30 21:13 ` mhiramat at redhat dot com
  2008-05-01  0:06 ` mhiramat at redhat dot com
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: mhiramat at redhat dot com @ 2008-04-30 21:13 UTC (permalink / raw)
  To: systemtap


------- Additional Comments From mhiramat at redhat dot com  2008-04-30 19:02 -------
(In reply to comment #4)
> (In reply to comment #3)
> > Thanks, the patch was committed.
> 
> Was the patch tested on any big-endian machines?

No, unfortunately, I don't have any big-endian machines.

> I think that the memcpys are assuming little-endian layout...

Really? as far as I know, memcpy() is defined on each architecture. So I think
it can work correctly on those machines.


-- 


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

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug runtime/5648] Unaligned access to memory in _stp_vsnprintf() on ia64
  2008-01-19  0:07 [Bug runtime/5648] New: Unaligned access to memory in _stp_vsnprintf() on ia64 mhiramat at redhat dot com
                   ` (5 preceding siblings ...)
  2008-04-30 21:13 ` mhiramat at redhat dot com
@ 2008-05-01  0:06 ` mhiramat at redhat dot com
  2008-05-01 19:32 ` joshua dot i dot stone at intel dot com
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: mhiramat at redhat dot com @ 2008-05-01  0:06 UTC (permalink / raw)
  To: systemtap


------- Additional Comments From mhiramat at redhat dot com  2008-04-30 21:19 -------
(In reply to comment #6)
> > > I think that the memcpys are assuming little-endian layout...
> > 
> > Really? as far as I know, memcpy() is defined on each architecture. So I think
> > it can work correctly on those machines.
> 
> I mean the way we're calling memcpy with &num.  For size=8 this is ok, but on
> smaller sizes I think this will fail.  On a big-endian machine, this will copy
> the most-significant bytes instead of the least.  That's a much different result
> than casting an uint64_t to a smaller size.

Oh, I got it. 

num(=0x12345678) contains data as:
Little-endian:
[8][7][6][5][4][3][2][1]
Big-endian:
[1][2][3][4][5][6][7][8]
on memory. thus we have to add some offsets on big-endian system when copying it.

Thanks,


-- 


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

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug runtime/5648] Unaligned access to memory in _stp_vsnprintf() on ia64
  2008-01-19  0:07 [Bug runtime/5648] New: Unaligned access to memory in _stp_vsnprintf() on ia64 mhiramat at redhat dot com
                   ` (6 preceding siblings ...)
  2008-05-01  0:06 ` mhiramat at redhat dot com
@ 2008-05-01 19:32 ` joshua dot i dot stone at intel dot com
  2008-05-01 21:33 ` mhiramat at redhat dot com
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: joshua dot i dot stone at intel dot com @ 2008-05-01 19:32 UTC (permalink / raw)
  To: systemtap


------- Additional Comments From joshua dot i dot stone at intel dot com  2008-04-30 21:25 -------
(In reply to comment #7)
> thus we have to add some offsets on big-endian system when copying it.

Yes, or type-cast it into a temp value and point to that, so you don't have to
worry about endianness.

-- 


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

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug runtime/5648] Unaligned access to memory in _stp_vsnprintf() on ia64
  2008-01-19  0:07 [Bug runtime/5648] New: Unaligned access to memory in _stp_vsnprintf() on ia64 mhiramat at redhat dot com
                   ` (7 preceding siblings ...)
  2008-05-01 19:32 ` joshua dot i dot stone at intel dot com
@ 2008-05-01 21:33 ` mhiramat at redhat dot com
  2008-05-02 16:16 ` mhiramat at redhat dot com
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: mhiramat at redhat dot com @ 2008-05-01 21:33 UTC (permalink / raw)
  To: systemtap


------- Additional Comments From mhiramat at redhat dot com  2008-04-30 21:34 -------
(In reply to comment #8)
> (In reply to comment #7)
> > thus we have to add some offsets on big-endian system when copying it.
> 
> Yes, or type-cast it into a temp value and point to that, so you don't have to
> worry about endianness.

It might add additional memory copying. So, I'd like to use memcpy only on ia64.

-- 


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

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug runtime/5648] Unaligned access to memory in _stp_vsnprintf() on ia64
  2008-01-19  0:07 [Bug runtime/5648] New: Unaligned access to memory in _stp_vsnprintf() on ia64 mhiramat at redhat dot com
                   ` (8 preceding siblings ...)
  2008-05-01 21:33 ` mhiramat at redhat dot com
@ 2008-05-02 16:16 ` mhiramat at redhat dot com
  2008-05-07 14:34 ` mhiramat at redhat dot com
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: mhiramat at redhat dot com @ 2008-05-02 16:16 UTC (permalink / raw)
  To: systemtap


------- Additional Comments From mhiramat at redhat dot com  2008-05-01 00:05 -------
I've found that another code causes unaligned access on ia64...

$ sudo stap -m end1b -bv end1.stp  -o /dev/null
$ dmesg 
...
end1b: systemtap: 0.7/0.131, base: a000000204a20000, memory:
633752+71360+384+14000 data+text+ctx+net, probes: 2
kernel unaligned access to 0xa000000204ad5fee, ip=0xa000000204a23761
kernel unaligned access to 0xa000000204ad9fbe, ip=0xa000000204a23760
kernel unaligned access to 0xa000000204addf96, ip=0xa000000204a23761
kernel unaligned access to 0xa000000204ae1f66, ip=0xa000000204a23760
kernel unaligned access to 0xa000000204ae5f3e, ip=0xa000000204a23761

$nm end1b.ko | sort
...
00000000000035c0 T stp_print_flush
0000000000003800 t probe_1059

This time, ip was in stap_print_flush()...

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |


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

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug runtime/5648] Unaligned access to memory in _stp_vsnprintf() on ia64
  2008-01-19  0:07 [Bug runtime/5648] New: Unaligned access to memory in _stp_vsnprintf() on ia64 mhiramat at redhat dot com
                   ` (9 preceding siblings ...)
  2008-05-02 16:16 ` mhiramat at redhat dot com
@ 2008-05-07 14:34 ` mhiramat at redhat dot com
  2008-05-07 15:40 ` mhiramat at redhat dot com
  2008-05-08 17:50 ` mhiramat at redhat dot com
  12 siblings, 0 replies; 14+ messages in thread
From: mhiramat at redhat dot com @ 2008-05-07 14:34 UTC (permalink / raw)
  To: systemtap


------- Additional Comments From mhiramat at redhat dot com  2008-05-06 21:07 -------
Created an attachment (id=2722)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=2722&action=view)
fix endianess issue

Fix _stp_vsnprintf to use memcpy only on ia64.

I think the original code had resolved endianess issue. So I just recovered it
and changed code to use memcpy only on ia64.


-- 


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

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug runtime/5648] Unaligned access to memory in _stp_vsnprintf() on ia64
  2008-01-19  0:07 [Bug runtime/5648] New: Unaligned access to memory in _stp_vsnprintf() on ia64 mhiramat at redhat dot com
                   ` (10 preceding siblings ...)
  2008-05-07 14:34 ` mhiramat at redhat dot com
@ 2008-05-07 15:40 ` mhiramat at redhat dot com
  2008-05-08 17:50 ` mhiramat at redhat dot com
  12 siblings, 0 replies; 14+ messages in thread
From: mhiramat at redhat dot com @ 2008-05-07 15:40 UTC (permalink / raw)
  To: systemtap


------- Additional Comments From mhiramat at redhat dot com  2008-05-06 21:09 -------
Created an attachment (id=2723)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=2723&action=view)
fix unaligned access error in stp_print_flush

This patch fixes an unaligned access bug in stp_print_flush.


-- 


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

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug runtime/5648] Unaligned access to memory in _stp_vsnprintf() on ia64
  2008-01-19  0:07 [Bug runtime/5648] New: Unaligned access to memory in _stp_vsnprintf() on ia64 mhiramat at redhat dot com
                   ` (11 preceding siblings ...)
  2008-05-07 15:40 ` mhiramat at redhat dot com
@ 2008-05-08 17:50 ` mhiramat at redhat dot com
  12 siblings, 0 replies; 14+ messages in thread
From: mhiramat at redhat dot com @ 2008-05-08 17:50 UTC (permalink / raw)
  To: systemtap


------- Additional Comments From mhiramat at redhat dot com  2008-05-07 23:47 -------
Patches were committed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED


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

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2008-05-07 23:48 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-19  0:07 [Bug runtime/5648] New: Unaligned access to memory in _stp_vsnprintf() on ia64 mhiramat at redhat dot com
2008-03-21  3:10 ` [Bug runtime/5648] " shaohua dot li at intel dot com
2008-03-28 23:06 ` mhiramat at redhat dot com
2008-04-30 17:27 ` joshua dot i dot stone at intel dot com
2008-04-30 17:27 ` mhiramat at redhat dot com
2008-04-30 21:13 ` joshua dot i dot stone at intel dot com
2008-04-30 21:13 ` mhiramat at redhat dot com
2008-05-01  0:06 ` mhiramat at redhat dot com
2008-05-01 19:32 ` joshua dot i dot stone at intel dot com
2008-05-01 21:33 ` mhiramat at redhat dot com
2008-05-02 16:16 ` mhiramat at redhat dot com
2008-05-07 14:34 ` mhiramat at redhat dot com
2008-05-07 15:40 ` mhiramat at redhat dot com
2008-05-08 17:50 ` mhiramat at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).