public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug bpf/23829] New: Bug introduced in bpf -base.cxx in git master
@ 2018-10-26  5:38 gmoreira at gmail dot com
  2018-10-26  5:47 ` [Bug bpf/23829] " gmoreira at gmail dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: gmoreira at gmail dot com @ 2018-10-26  5:38 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=23829

            Bug ID: 23829
           Summary: Bug introduced in bpf -base.cxx in git master
           Product: systemtap
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: bpf
          Assignee: systemtap at sourceware dot org
          Reporter: gmoreira at gmail dot com
  Target Milestone: ---

Created attachment 11366
  --> https://sourceware.org/bugzilla/attachment.cgi?id=11366&action=edit
Patch for bpf-base.cxx

Compiling SystemTap from git master:
...
bpf-base.cxx: In function ‘void bpf::init_bpf_helper_tables()’:
bpf-base.cxx:148:21: error: ‘__BPF_SET_FUNC_NAME’ was not declared in this
scope
   __BPF_FUNC_MAPPER(__BPF_SET_FUNC_NAME)
                     ^~~~~~~~~~~~~~~~~~~
bpf-base.cxx:148:40: error: ‘__BPF_FUNC_MAPPER’ was not declared in this scope
   __BPF_FUNC_MAPPER(__BPF_SET_FUNC_NAME)
                                        ^
Makefile:1669: recipe for target 'stap-bpf-base.o' failed

The bug was introduced here:
https://sourceware.org/git/gitweb.cgi?p=systemtap.git;a=commitdiff;h=c009fe88de8a91b11a19e36c332bd096cb72b8b0


Patch attached.

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

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

* [Bug bpf/23829] Bug introduced in bpf -base.cxx in git master
  2018-10-26  5:38 [Bug bpf/23829] New: Bug introduced in bpf -base.cxx in git master gmoreira at gmail dot com
@ 2018-10-26  5:47 ` gmoreira at gmail dot com
  2018-10-29 17:54 ` me at serhei dot io
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: gmoreira at gmail dot com @ 2018-10-26  5:47 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=23829

--- Comment #1 from Gustavo Moreira <gmoreira at gmail dot com> ---
Other errors related to the same merge:

bpf-translate.cxx: In member function ‘size_t
bpf::bpf_unparser::parse_asm_stmt(embeddedcode*, size_t, bpf::asm_stmt&)’:
util.h:62:59: error: format ‘%lu’ expects argument of type ‘long unsigned int’,
but argument 2 has type ‘std::vector<std::__cxx11::basic_string<char>
>::size_type {aka unsigned int}’ [-Werror=format=]
 #define _F(format, ...) autosprintf(_(format), __VA_ARGS__)
                                                           ^
util.h:68:53: note: in definition of macro ‘SEMANTIC_ERROR’
 #define SEMANTIC_ERROR(...) semantic_error(ERR_SRC, __VA_ARGS__)
                                                     ^~~~~~~~~~~
bpf-translate.cxx:839:31: note: in expansion of macro ‘_F’
         throw SEMANTIC_ERROR (_F("invalid bpf embeddedcode syntax (label
expects 1 arg, found %lu)", args.size()-1), stmt.tok);
                               ^~
util.h:62:59: error: format ‘%lu’ expects argument of type ‘long unsigned int’,
but argument 2 has type ‘std::vector<std::__cxx11::basic_string<char>
>::size_type {aka unsigned int}’ [-Werror=format=]
 #define _F(format, ...) autosprintf(_(format), __VA_ARGS__)
                                                           ^
util.h:68:53: note: in definition of macro ‘SEMANTIC_ERROR’
 #define SEMANTIC_ERROR(...) semantic_error(ERR_SRC, __VA_ARGS__)
                                                     ^~~~~~~~~~~
bpf-translate.cxx:846:31: note: in expansion of macro ‘_F’
         throw SEMANTIC_ERROR (_F("invalid bpf embeddedcode syntax (alloc
expects 2 args, found %lu)", args.size()-1), stmt.tok);
                               ^~
util.h:62:59: error: format ‘%lu’ expects argument of type ‘long unsigned int’,
but argument 2 has type ‘std::vector<std::__cxx11::basic_string<char>
>::size_type {aka unsigned int}’ [-Werror=format=]
 #define _F(format, ...) autosprintf(_(format), __VA_ARGS__)
                                                           ^
util.h:68:53: note: in definition of macro ‘SEMANTIC_ERROR’
 #define SEMANTIC_ERROR(...) semantic_error(ERR_SRC, __VA_ARGS__)
                                                     ^~~~~~~~~~~
bpf-translate.cxx:854:31: note: in expansion of macro ‘_F’
         throw SEMANTIC_ERROR (_F("invalid bpf embeddedcode syntax (call
expects at least 2 args, found %lu)", args.size()-1), stmt.tok);
                               ^~
util.h:62:59: error: format ‘%lu’ expects argument of type ‘long unsigned int’,
but argument 2 has type ‘std::vector<std::__cxx11::basic_string<char>
>::size_type {aka unsigned int}’ [-Werror=format=]
 #define _F(format, ...) autosprintf(_(format), __VA_ARGS__)
                                                           ^
util.h:68:53: note: in definition of macro ‘SEMANTIC_ERROR’
 #define SEMANTIC_ERROR(...) semantic_error(ERR_SRC, __VA_ARGS__)
                                                     ^~~~~~~~~~~
bpf-translate.cxx:864:31: note: in expansion of macro ‘_F’
         throw SEMANTIC_ERROR (_F("invalid bpf embeddedcode syntax (opcode
expects 4 args, found %lu)", args.size()-1), stmt.tok);
                               ^~
bpf-translate.cxx: In member function ‘void
bpf::bpf_unparser::emit_asm_opcode(const bpf::asm_stmt&,
std::map<std::__cxx11::basic_string<char>, bpf::block*>)’:
bpf-translate.cxx:1084:14: error: ‘BPF_JLT’ was not declared in this scope
         case BPF_JLT: c = LTU; break;
              ^~~~~~~
bpf-translate.cxx:1085:14: error: ‘BPF_JLE’ was not declared in this scope
         case BPF_JLE: c = LEU; break;
              ^~~~~~~
bpf-translate.cxx:1088:14: error: ‘BPF_JSLT’ was not declared in this scope
         case BPF_JSLT: c = LT; break;
              ^~~~~~~~
bpf-translate.cxx:1089:14: error: ‘BPF_JSLE’ was not declared in this scope
         case BPF_JSLE: c = LE; break;
              ^~~~~~~~
In file included from staptree.h:27:0,
                 from bpf-internal.h:18,
                 from bpf-translate.cxx:10:
util.h:62:59: error: format ‘%ld’ expects argument of type ‘long int’, but
argument 2 has type ‘int64_t {aka long long int}’ [-Werror=format=]
 #define _F(format, ...) autosprintf(_(format), __VA_ARGS__)
                                                           ^
util.h:68:53: note: in definition of macro ‘SEMANTIC_ERROR’
 #define SEMANTIC_ERROR(...) semantic_error(ERR_SRC, __VA_ARGS__)
                                                     ^~~~~~~~~~~
bpf-translate.cxx:1127:27: note: in expansion of macro ‘_F’
     throw SEMANTIC_ERROR (_F("offset field '%ld' out of range in bpf code",
stmt.off), stmt.tok);
                           ^~
cc1plus: all warnings being treated as errors

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

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

* [Bug bpf/23829] Bug introduced in bpf -base.cxx in git master
  2018-10-26  5:38 [Bug bpf/23829] New: Bug introduced in bpf -base.cxx in git master gmoreira at gmail dot com
  2018-10-26  5:47 ` [Bug bpf/23829] " gmoreira at gmail dot com
@ 2018-10-29 17:54 ` me at serhei dot io
  2018-10-29 17:54 ` me at serhei dot io
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: me at serhei dot io @ 2018-10-29 17:54 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=23829

--- Comment #3 from Serhei Makarov <me at serhei dot io> ---
If possibly, could you attach the output of stap-report ?

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

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

* [Bug bpf/23829] Bug introduced in bpf -base.cxx in git master
  2018-10-26  5:38 [Bug bpf/23829] New: Bug introduced in bpf -base.cxx in git master gmoreira at gmail dot com
  2018-10-26  5:47 ` [Bug bpf/23829] " gmoreira at gmail dot com
  2018-10-29 17:54 ` me at serhei dot io
@ 2018-10-29 17:54 ` me at serhei dot io
  2018-10-31  1:02 ` gmoreira at gmail dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: me at serhei dot io @ 2018-10-29 17:54 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=23829

Serhei Makarov <me at serhei dot io> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2018-10-29
                 CC|                            |me at serhei dot io
     Ever confirmed|0                           |1

--- Comment #2 from Serhei Makarov <me at serhei dot io> ---
__BPF_FUNC_MAPPER is included from the Linux kernel's bpf.h header, via a
directive in bpf-internal.h:

extern "C" {
#include <linux/bpf.h>
}

Some of the other errors also seem to relate to symbols not in bpf.h e.g.
BPF_JLT. I will need to work out a good fallback for when bpf.h is unavailable
/ lacks those symbols. Which version of the kernel headers were you compiling
against?

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

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

* [Bug bpf/23829] Bug introduced in bpf -base.cxx in git master
  2018-10-26  5:38 [Bug bpf/23829] New: Bug introduced in bpf -base.cxx in git master gmoreira at gmail dot com
                   ` (2 preceding siblings ...)
  2018-10-29 17:54 ` me at serhei dot io
@ 2018-10-31  1:02 ` gmoreira at gmail dot com
  2018-10-31  1:03 ` gmoreira at gmail dot com
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: gmoreira at gmail dot com @ 2018-10-31  1:02 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=23829

--- Comment #4 from Gustavo Moreira <gmoreira at gmail dot com> ---
Oh I see, it's in "uapi/linux/bpf.h" but it seems to be from 4.10 on, I'm using
4.9.75. 
Yeah, I think it would be needed a fallback otherwise it won't be supported for
older kernels.

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

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

* [Bug bpf/23829] Bug introduced in bpf -base.cxx in git master
  2018-10-26  5:38 [Bug bpf/23829] New: Bug introduced in bpf -base.cxx in git master gmoreira at gmail dot com
                   ` (3 preceding siblings ...)
  2018-10-31  1:02 ` gmoreira at gmail dot com
@ 2018-10-31  1:03 ` gmoreira at gmail dot com
  2018-11-02 20:51 ` me at serhei dot io
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: gmoreira at gmail dot com @ 2018-10-31  1:03 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=23829

--- Comment #5 from Gustavo Moreira <gmoreira at gmail dot com> ---
Created attachment 11374
  --> https://sourceware.org/bugzilla/attachment.cgi?id=11374&action=edit
stap-report output

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

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

* [Bug bpf/23829] Bug introduced in bpf -base.cxx in git master
  2018-10-26  5:38 [Bug bpf/23829] New: Bug introduced in bpf -base.cxx in git master gmoreira at gmail dot com
                   ` (4 preceding siblings ...)
  2018-10-31  1:03 ` gmoreira at gmail dot com
@ 2018-11-02 20:51 ` me at serhei dot io
  2019-03-22 19:09 ` me at serhei dot io
  2019-03-27 14:48 ` me at serhei dot io
  7 siblings, 0 replies; 9+ messages in thread
From: me at serhei dot io @ 2018-11-02 20:51 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=23829

--- Comment #6 from Serhei Makarov <me at serhei dot io> ---
Thanks for that info. I've tested with bpf.h from kernel 4.8. Other defines
aside from __BPF_FUNC_MAPPER and BPF_J{LT,LE,SLT,SLE} seem to be present.

The build errors reported should be fixed in commits 3d9e0d2a5 (for _F format
specifiers on 32-bit systems) and 8fb0cb4a (for undefined bpf.h symbols).
Partly fixed by adding a fallback version of __BPF_FUNC_MAPPER and fallback
defines for the new BPF_J(...) insn opcodes (these are recognized by the new
embedded-code assembler; stapbpf backend already replaces these with older
insns, so the code should work even on old kernel versions that do not support
them).

Let me know if the fixes work and I can close the bug, or if I need to refine
my workaround further.

This exposes a deeper issue, in that SystemTap/BPF must be compiled against a
recent kernel version to generate modules that use BPF features from that
version. This has also caused hiccups e.g. when building SystemTap RPM packages
in mockbuild on a kernel without eBPF support. Don't see an obvious workaround
for this.

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

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

* [Bug bpf/23829] Bug introduced in bpf -base.cxx in git master
  2018-10-26  5:38 [Bug bpf/23829] New: Bug introduced in bpf -base.cxx in git master gmoreira at gmail dot com
                   ` (5 preceding siblings ...)
  2018-11-02 20:51 ` me at serhei dot io
@ 2019-03-22 19:09 ` me at serhei dot io
  2019-03-27 14:48 ` me at serhei dot io
  7 siblings, 0 replies; 9+ messages in thread
From: me at serhei dot io @ 2019-03-22 19:09 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=23829

--- Comment #7 from Serhei Makarov <me at serhei dot io> ---
I'll eventually close this PR as WORKSFORME and assume it was fixed. Feel free
to let me know if that's not the case. If the error was still there, since it
happens during SystemTap compilation with default configure options, I assume
people would have kept encountering it.

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

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

* [Bug bpf/23829] Bug introduced in bpf -base.cxx in git master
  2018-10-26  5:38 [Bug bpf/23829] New: Bug introduced in bpf -base.cxx in git master gmoreira at gmail dot com
                   ` (6 preceding siblings ...)
  2019-03-22 19:09 ` me at serhei dot io
@ 2019-03-27 14:48 ` me at serhei dot io
  7 siblings, 0 replies; 9+ messages in thread
From: me at serhei dot io @ 2019-03-27 14:48 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=23829

Serhei Makarov <me at serhei dot io> changed:

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

--- Comment #8 from Serhei Makarov <me at serhei dot io> ---
Closing WORKSFORME as the indicated compile issues have been fixed and there
have been no further complaints.

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

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

end of thread, other threads:[~2019-03-27 14:48 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-26  5:38 [Bug bpf/23829] New: Bug introduced in bpf -base.cxx in git master gmoreira at gmail dot com
2018-10-26  5:47 ` [Bug bpf/23829] " gmoreira at gmail dot com
2018-10-29 17:54 ` me at serhei dot io
2018-10-29 17:54 ` me at serhei dot io
2018-10-31  1:02 ` gmoreira at gmail dot com
2018-10-31  1:03 ` gmoreira at gmail dot com
2018-11-02 20:51 ` me at serhei dot io
2019-03-22 19:09 ` me at serhei dot io
2019-03-27 14:48 ` me at serhei dot io

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).