Skip to content
Snippets Groups Projects
  1. Oct 31, 2019
    • yonghong-song's avatar
      introduce map.lookup_or_try_init() (#2577) · 82f4302a
      yonghong-song authored
      Previously, map.lookup_or_init() may cause unexpected
      return from the function when lookup finds no element and
      init failed e.g. due to unlikely racy update or
      sometimes hash table full.
      This has caught surprise from many users. So, the commit
        https://github.com/iovisor/bcc/commit/ba64f031f2435aad5a85f8f37dbbe2a982cbbe6b
      attempts to remove the early return in map.lookup_or_init().
      But then since NULL pointer could be returned,
      user will need to change their bpf program to check return value,
      otherwise, verifier will reject the program.
      
      As described in the above, such an API behavior change may cause
      verifier failure and reject previously loadable bpf programs.
      bcc should try to maintain API stability, esp. to avoid subtle
      API behavior change.
      
      This patch propose to restore the behavior of map.lookup_or_init()
      and introduce a new one map.lookup_or_try_init(), which will
      avoid unexpected return. The name is suggested by Alexei
      to reflect that init may fail. map.lookup_or_try_init() will be formally
      documented and used in bcc. A warning will be generated if
      map.lookup_or_init() is used. Documentation will make it clear
      that map.lookup_or_try_init() is preferred over map.lookup_or_init().
      
      ```
      -bash-4.4$ sudo ./syscount.py
      /virtual/main.c:71:11: warning: lookup_or_init() may return from the function, use loopup_or_try_init() instead.
          val = data.lookup_or_init(&key, &zero);
                ^
      1 warning generated.
      Tracing syscalls, printing top 10... Ctrl+C to quit.
      ...
      ```
      
      All uses in examples and tools are converted to use
      lookup_or_try_init(). Most tests are converted to use
      lookup_or_try_init() too except test_trace_maxactive.py
      and test_tracepoint.py to test lookup_or_init()
      functionality.
  2. Sep 20, 2019
    • Philip Gladstone's avatar
      Fixes #2518 -- weird behaviour of lookup_or_init (#2520) · ba64f031
      Philip Gladstone authored
      * Allow lookup_or_init to return NULL (rather than just returning from the current function)
      * Fixed a couple of bad edits found when running tests. Also fixed a bug in the
      test runner. Also fixed a bug in libbcc where the python signature did not match
      the actual implementation.
      ba64f031
  3. Jan 16, 2019
  4. Jan 03, 2019
  5. Jun 14, 2018
    • Paul Chaignon's avatar
      Skip dereferences inside bpf_probe_reads calls (#1824) · f86f7e84
      Paul Chaignon authored
      * Skip all dereferences inside bpf_probe_read calls
      
      If the user decides to rely on a manual call to bpf_probe_read, we
      don't try to rewrite its last argument.  This is needed as the
      rewriter starts to recognize and rewrite more and more dereferences.
      
      * tools: fix dereferences following 1a765a17
      f86f7e84
  6. Mar 14, 2018
  7. Feb 08, 2018
  8. Feb 02, 2018
  9. Mar 26, 2017
    • Rafael F's avatar
      Python 3 compatibility fixes around string handling (#986) · 78948e4a
      Rafael F authored
      This fixes the bcc module and all the affected tools for issues related to string handling in Python 3. Specifically, when passing Python strings to C libraries they are encoded as ASCII, and when constructing Python strings from C strings, they are decoded first.
      78948e4a
  10. Oct 18, 2016
Loading