Bug 27030 - bpf: user_long_error() leads to assertion failures in the translator
Summary: bpf: user_long_error() leads to assertion failures in the translator
Status: UNCONFIRMED
Alias: None
Product: systemtap
Classification: Unclassified
Component: bpf (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Serhei Makarov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-12-07 20:13 UTC by agentzh
Modified: 2021-03-01 15:31 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description agentzh 2020-12-07 20:13:40 UTC
I tried using the `user_long_error()` tapset function with the bpf runtime but it fails with an assertion failure in the translator. Tested the latest master branch on Fedora 32 x86_64.


```
[agentzh@fed32-min ~/git/systemtap 134 (master)]$ cat a.c
long a = 0xdeadbeef;

int main (void) {
    return 0;
}

[agentzh@fed32-min ~/git/systemtap 0 (master)]$ gcc -g a.c -o /tmp/a.out

[agentzh@fed32-min ~/git/systemtap 0 (master)]$ nm /tmp/a.out|grep ' a'
0000000000404020 D a

[agentzh@fed32-min ~/git/systemtap 0 (master)]$ /opt/stap/bin/stap --bpf -c ./a.out -e 'probe process("/tmp/a.out").function("main") { println("a: ", user_long_error(0x601020)) exit() }'
stap: staptree.h:1349: virtual update_visitor::~update_visitor(): Assertion `values.empty()' failed.
Aborted (core dumped)

[agentzh@fed32-min ~/git/systemtap 130 (master)]$ /opt/stap/bin/stap -V
Systemtap translator/driver (version 4.5/0.182, commit release-4.4-24-g3e0d449fe427 + changes)
Copyright (C) 2005-2020 Red Hat, Inc. and others
This is free software; see the source for copying conditions.
tested kernel versions: 2.6.32 ... 5.10.0-rc
enabled features: BPF NLS
```
Comment 1 agentzh 2020-12-07 20:27:49 UTC
BTW, I'm using the stock kernel provided by Fedora 32:

```
[agentzh@fed32-min ~/git/systemtap 0 (master)]$ cat /proc/version
Linux version 5.9.11-100.fc32.x86_64 (mockbuild@bkernel01.iad2.fedoraproject.org) (gcc (GCC) 10.2.1 20201016 (Red Hat 10.2.1-6), GNU ld version 2.34-6.fc32) #1 SMP Tue Nov 24 19:16:53 UTC 2020
```
Comment 2 agentzh 2020-12-07 20:29:37 UTC
Tried the same example on an older kernel on Fedora 28 x86_64. Same thing:

```
[agentzh@glass ~/git/systemtap.new 1 (master)]$ /opt/stap/bin/stap --bpf -c /tmp/a.out -e 'probe process("/tmp/a.out").function("main") { println("a: ", user_long_error(0x601020)) exit() }'
stap: staptree.h:1349: virtual update_visitor::~update_visitor(): Assertion `values.empty()' failed.
Aborted (core dumped)

[agentzh@glass ~/git/systemtap.new 134 (master)]$ cat /proc/version
Linux version 5.0.16-100.fc28.x86_64 (mockbuild@bkernel04.phx2.fedoraproject.org) (gcc version 8.3.1 20190223 (Red Hat 8.3.1-2) (GCC)) #1 SMP Tue May 14 18:22:28 UTC 2019

[agentzh@glass ~/git/systemtap.new 0 (master)]$ /opt/stap/bin/stap -V
Systemtap translator/driver (version 4.5/0.177, commit release-4.4-24-g3e0d449fe427 + changes)
Copyright (C) 2005-2020 Red Hat, Inc. and others
This is free software; see the source for copying conditions.
tested kernel versions: 2.6.32 ... 5.10.0-rc
enabled features: BOOST_STRING_REF DYNINST BPF LIBSQLITE3 LIBXML2 NLS READLINE
```