public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug bpf/24528] New: bpf-next housekeeping: bpf-translate.cxx should distinguish codegen for kernel/userspace targets
@ 2019-05-06 16:25 me at serhei dot io
  2019-05-06 17:04 ` [Bug bpf/24528] " me at serhei dot io
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: me at serhei dot io @ 2019-05-06 16:25 UTC (permalink / raw)
  To: systemtap

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

            Bug ID: 24528
           Summary: bpf-next housekeeping: bpf-translate.cxx should
                    distinguish codegen for kernel/userspace targets
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: bpf
          Assignee: systemtap at sourceware dot org
          Reporter: me at serhei dot io
  Target Milestone: ---

bpf_unparser should have a flag bpf_target() which distinguishes whether code
is being generated for userspace-interpreter (no restrictions) or BPF
kernel-interpreter (many restrictions).

First this will enable better/simpler error checking logic.

Down the line, this will allow adding more values to bpf_target() and
generating certain constructs differently depending on whether they're
targeting different versions of BPF (with different restrictions).

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

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

* [Bug bpf/24528] bpf-next housekeeping: bpf-translate.cxx should distinguish codegen for kernel/userspace targets
  2019-05-06 16:25 [Bug bpf/24528] New: bpf-next housekeeping: bpf-translate.cxx should distinguish codegen for kernel/userspace targets me at serhei dot io
@ 2019-05-06 17:04 ` me at serhei dot io
  2019-05-06 17:07 ` [Bug bpf/24528] stapbpf-next " me at serhei dot io
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: me at serhei dot io @ 2019-05-06 17:04 UTC (permalink / raw)
  To: systemtap

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

Serhei Makarov <me at serhei dot io> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |22312


Referenced Bugs:

https://sourceware.org/bugzilla/show_bug.cgi?id=22312
[Bug 22312] bpf: global variable and statistics aggregate locking
-- 
You are receiving this mail because:
You are the assignee for the bug.

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

* [Bug bpf/24528] stapbpf-next housekeeping: bpf-translate.cxx should distinguish codegen for kernel/userspace targets
  2019-05-06 16:25 [Bug bpf/24528] New: bpf-next housekeeping: bpf-translate.cxx should distinguish codegen for kernel/userspace targets me at serhei dot io
  2019-05-06 17:04 ` [Bug bpf/24528] " me at serhei dot io
@ 2019-05-06 17:07 ` me at serhei dot io
  2019-06-20 17:30 ` me at serhei dot io
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: me at serhei dot io @ 2019-05-06 17:07 UTC (permalink / raw)
  To: systemtap

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

Serhei Makarov <me at serhei dot io> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|bpf-next housekeeping:      |stapbpf-next housekeeping:
                   |bpf-translate.cxx should    |bpf-translate.cxx should
                   |distinguish codegen for     |distinguish codegen for
                   |kernel/userspace targets    |kernel/userspace targets

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

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

* [Bug bpf/24528] stapbpf-next housekeeping: bpf-translate.cxx should distinguish codegen for kernel/userspace targets
  2019-05-06 16:25 [Bug bpf/24528] New: bpf-next housekeeping: bpf-translate.cxx should distinguish codegen for kernel/userspace targets me at serhei dot io
  2019-05-06 17:04 ` [Bug bpf/24528] " me at serhei dot io
  2019-05-06 17:07 ` [Bug bpf/24528] stapbpf-next " me at serhei dot io
@ 2019-06-20 17:30 ` me at serhei dot io
  2019-06-21 15:12 ` me at serhei dot io
  2019-06-26 20:29 ` me at serhei dot io
  4 siblings, 0 replies; 6+ messages in thread
From: me at serhei dot io @ 2019-06-20 17:30 UTC (permalink / raw)
  To: systemtap

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

--- Comment #1 from Serhei Makarov <me at serhei dot io> ---
Added a 'target' field to struct program.

Next step is to go through bpf-translate.cxx and spot all the places where we
should be checking that 'target' field and signalling an error (or possibly
generating different code) instead of crossing our fingers that the user knows
which stap language constructs are and aren't supported by kernel bpf.

That way, if we use the wrong construct in the wrong code, we won't be getting
this type of cryptic madness anymore:

$ sudo ~/stap-install/bin/stap --bpf -e 'global g probe
kernel.function("vfs_read") { g["foo"] = "bar" foreach(k in g) { println(k) }
}'
Error loading /tmp/stapoSgfxZ/stap_25366.bo: bpf program load failed: Invalid
argument
back-edge from insn 1051 to 92

WARNING: /home/serhei/stap-install/bin/stapbpf exited with status: 1
Pass 5: run failed.  [man error::pass5]

Once the error messages work well (exist), I'll close this PR. But in general,
this work should also allow the userspace interpreter's constraints to be
relaxed (e.g. stack size or hard-register file could be increased) if or when
that proves necessary down the line.

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

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

* [Bug bpf/24528] stapbpf-next housekeeping: bpf-translate.cxx should distinguish codegen for kernel/userspace targets
  2019-05-06 16:25 [Bug bpf/24528] New: bpf-next housekeeping: bpf-translate.cxx should distinguish codegen for kernel/userspace targets me at serhei dot io
                   ` (2 preceding siblings ...)
  2019-06-20 17:30 ` me at serhei dot io
@ 2019-06-21 15:12 ` me at serhei dot io
  2019-06-26 20:29 ` me at serhei dot io
  4 siblings, 0 replies; 6+ messages in thread
From: me at serhei dot io @ 2019-06-21 15:12 UTC (permalink / raw)
  To: systemtap

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

--- Comment #2 from Serhei Makarov <me at serhei dot io> ---
Added some basic checking and error messages. Keeping PR open since we also
want to do a pass over tapset functions in case some are userspace-only. We
could mark this with a /* bpf_userspace */ annotation (bikeshed colour choice
pending).

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

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

* [Bug bpf/24528] stapbpf-next housekeeping: bpf-translate.cxx should distinguish codegen for kernel/userspace targets
  2019-05-06 16:25 [Bug bpf/24528] New: bpf-next housekeeping: bpf-translate.cxx should distinguish codegen for kernel/userspace targets me at serhei dot io
                   ` (3 preceding siblings ...)
  2019-06-21 15:12 ` me at serhei dot io
@ 2019-06-26 20:29 ` me at serhei dot io
  4 siblings, 0 replies; 6+ messages in thread
From: me at serhei dot io @ 2019-06-26 20:29 UTC (permalink / raw)
  To: systemtap

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

Serhei Makarov <me at serhei dot io> changed:

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

--- Comment #3 from Serhei Makarov <me at serhei dot io> ---
Added a /* userspace */ annotation to all embeddedcode tapset functions that
call a userspace-only helper.

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

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

end of thread, other threads:[~2019-06-26 20:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-06 16:25 [Bug bpf/24528] New: bpf-next housekeeping: bpf-translate.cxx should distinguish codegen for kernel/userspace targets me at serhei dot io
2019-05-06 17:04 ` [Bug bpf/24528] " me at serhei dot io
2019-05-06 17:07 ` [Bug bpf/24528] stapbpf-next " me at serhei dot io
2019-06-20 17:30 ` me at serhei dot io
2019-06-21 15:12 ` me at serhei dot io
2019-06-26 20:29 ` 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).