* [Bug runtime/26844] New: off-by-one error in the output of sprint_ubacktrace()
@ 2020-11-04 21:59 agentzh at gmail dot com
2020-11-04 22:00 ` [Bug runtime/26844] " agentzh at gmail dot com
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: agentzh at gmail dot com @ 2020-11-04 21:59 UTC (permalink / raw)
To: systemtap
https://sourceware.org/bugzilla/show_bug.cgi?id=26844
Bug ID: 26844
Summary: off-by-one error in the output of sprint_ubacktrace()
Product: systemtap
Version: unspecified
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: runtime
Assignee: systemtap at sourceware dot org
Reporter: agentzh at gmail dot com
Target Milestone: ---
Consider the following C program for the target program:
```
int foo(void) {
return 3;
}
int bar(void) {
return foo();
}
int main(void) {
bar();
return 0;
}
```
Compile it to generate the executable file `./a.out`:
```
gcc -g a.c
```
And then run the following stap oneliner:
```
$ stap -e 'probe oneshot { printf("{%s}\n", sprint_ubacktrace()) }'
{foo+0x4 [a.out]
bar+0x9 [a.out]
main+0x9 [a.out]
0x7ffff7a3b11b [libc-2.27.so+0x2311b]}
WARNING: Missing unwind data for a module, rerun with 'stap -d
/usr/lib64/libc-2.27.so'
```
The warning can be safely ignored. What's unexpected here is the lack of
newline at the end of the last frame in the generated backtrace (between the
bytes `]` and `}` in the output above).
The current master of the upstream systemtap git repo also has the same
problem. We should commit any fixes to the upstream as well for this.
--
You are receiving this mail because:
You are the assignee for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug runtime/26844] off-by-one error in the output of sprint_ubacktrace()
2020-11-04 21:59 [Bug runtime/26844] New: off-by-one error in the output of sprint_ubacktrace() agentzh at gmail dot com
@ 2020-11-04 22:00 ` agentzh at gmail dot com
2020-11-05 0:29 ` agentzh at gmail dot com
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: agentzh at gmail dot com @ 2020-11-04 22:00 UTC (permalink / raw)
To: systemtap
https://sourceware.org/bugzilla/show_bug.cgi?id=26844
--- Comment #1 from agentzh <agentzh at gmail dot com> ---
According to the code, it indeed appends a newline to each frame, but the
buffer only copies the N - 1 bytes where N is the total byte count (excluding
`\0`).
--
You are receiving this mail because:
You are the assignee for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug runtime/26844] off-by-one error in the output of sprint_ubacktrace()
2020-11-04 21:59 [Bug runtime/26844] New: off-by-one error in the output of sprint_ubacktrace() agentzh at gmail dot com
2020-11-04 22:00 ` [Bug runtime/26844] " agentzh at gmail dot com
@ 2020-11-05 0:29 ` agentzh at gmail dot com
2020-12-09 18:24 ` demonsingur at gmail dot com
2020-12-12 14:16 ` fche at redhat dot com
3 siblings, 0 replies; 5+ messages in thread
From: agentzh at gmail dot com @ 2020-11-05 0:29 UTC (permalink / raw)
To: systemtap
https://sourceware.org/bugzilla/show_bug.cgi?id=26844
--- Comment #2 from agentzh <agentzh at gmail dot com> ---
Using `sprint_backtrace()` is the same thing:
```
$ stap -d kernel -e 'probe oneshot { printf("{\%s}\n", sprint_backtrace()) }'
{0xffffffffc1d8994b [stap_f56de473ef304e53bfb082b091cabf8_15711+0x894b]
0xffffffffc1d898ca [stap_f56de473ef304e53bfb082b091cabf8_15711+0x88ca]
(inexact)}
```
--
You are receiving this mail because:
You are the assignee for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug runtime/26844] off-by-one error in the output of sprint_ubacktrace()
2020-11-04 21:59 [Bug runtime/26844] New: off-by-one error in the output of sprint_ubacktrace() agentzh at gmail dot com
2020-11-04 22:00 ` [Bug runtime/26844] " agentzh at gmail dot com
2020-11-05 0:29 ` agentzh at gmail dot com
@ 2020-12-09 18:24 ` demonsingur at gmail dot com
2020-12-12 14:16 ` fche at redhat dot com
3 siblings, 0 replies; 5+ messages in thread
From: demonsingur at gmail dot com @ 2020-12-09 18:24 UTC (permalink / raw)
To: systemtap
https://sourceware.org/bugzilla/show_bug.cgi?id=26844
Cosmin Tanislav <demonsingur at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |demonsingur at gmail dot com
--- Comment #3 from Cosmin Tanislav <demonsingur at gmail dot com> ---
Created attachment 13032
--> https://sourceware.org/bugzilla/attachment.cgi?id=13032&action=edit
Off-by-one fix
--
You are receiving this mail because:
You are the assignee for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug runtime/26844] off-by-one error in the output of sprint_ubacktrace()
2020-11-04 21:59 [Bug runtime/26844] New: off-by-one error in the output of sprint_ubacktrace() agentzh at gmail dot com
` (2 preceding siblings ...)
2020-12-09 18:24 ` demonsingur at gmail dot com
@ 2020-12-12 14:16 ` fche at redhat dot com
3 siblings, 0 replies; 5+ messages in thread
From: fche at redhat dot com @ 2020-12-12 14:16 UTC (permalink / raw)
To: systemtap
https://sourceware.org/bugzilla/show_bug.cgi?id=26844
Frank Ch. Eigler <fche at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |fche at redhat dot com
Resolution|--- |FIXED
Status|UNCONFIRMED |RESOLVED
--- Comment #4 from Frank Ch. Eigler <fche at redhat dot com> ---
commit fd93cf71df80f
--
You are receiving this mail because:
You are the assignee for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-12-12 14:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-04 21:59 [Bug runtime/26844] New: off-by-one error in the output of sprint_ubacktrace() agentzh at gmail dot com
2020-11-04 22:00 ` [Bug runtime/26844] " agentzh at gmail dot com
2020-11-05 0:29 ` agentzh at gmail dot com
2020-12-09 18:24 ` demonsingur at gmail dot com
2020-12-12 14:16 ` fche 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).