Commit graph

16794 commits

Author SHA1 Message Date
Tim Wojtulewicz
1d4bd2c70a Remove STMT_ANY statement type 2024-08-07 11:58:21 -07:00
Tim Wojtulewicz
e2b03681d1 Remove EventRegistry::Used and EventRegistry::SetUsed 2024-08-07 11:58:21 -07:00
Arne Welzel
97fa7cdc0a Merge remote-tracking branch 'origin/topic/awelzel/ldap-fix-uint8-shift'
* origin/topic/awelzel/ldap-fix-uint8-shift:
  ldap: Promote uint8 to uint64 before shifting
2024-08-07 14:11:30 +02:00
Arne Welzel
2be39cf0d0 ldap: Promote uint8 to uint64 before shifting
Relates to zeek/spicy#1829
2024-08-07 13:47:12 +02:00
Arne Welzel
2c62ecf57d Merge remote-tracking branch 'origin/topic/awelzel/ci-ubuntu-24-new-ccache'
* origin/topic/awelzel/ci-ubuntu-24-new-ccache:
  ci/ubuntu-24.04: Use ccache 4.10.2
2024-08-07 11:43:33 +02:00
Arne Welzel
84c9daafd1 ci/ubuntu-24.04: Use ccache 4.10.2
The ccache version shipped with Ubuntu 24.04 does not yet recognize
--fprofile-update=atomic, install one that does.

Now that the asan_sanitizer build also includes building Spicy and
running the spicyz test suite, ccache is quite important.

Reference ccache/ccache#1408 and zeek/zeek#3777.
2024-08-07 11:36:00 +02:00
Arne Welzel
b0df736ba7 Merge remote-tracking branch 'origin/topic/awelzel/threading-manager-metrics-follow-up'
* origin/topic/awelzel/threading-manager-metrics-follow-up:
  telemetry/Manager: Check RegisterFd() return value
  telemetry/Manager: Track sent_in and sent_out totals without callback
  threading/Manager: Switch inf bucket from infinity() to max()
  threading/Manager: "lt" to "le" and do not break
2024-08-07 10:55:13 +02:00
Arne Welzel
4fe9580a7e telemetry/Manager: Check RegisterFd() return value
Please coverity.
2024-08-07 09:48:29 +02:00
zeek-bot
60bdaffe0b Update doc submodule [nomail] [skip ci] 2024-08-07 00:20:16 +00:00
Arne Welzel
c845c7cce0 Merge remote-tracking branch 'origin/topic/awelzel/3860-ldap-fuzzer'
* origin/topic/awelzel/3860-ldap-fuzzer:
  Bump auxil/spicy to latest development snapshot
  spicy/runtime-support: Switch ParameterMismatch::_fmt to static
  coverage/lcov_html: Ignore testing/btest/.tmp
  cirrus: Do not disable Spicy for sanitizer builds
  ldap: Avoid unset m$opcode
  fuzzers: Add LDAP fuzzing
2024-08-06 20:09:09 +02:00
Arne Welzel
821d460c2e Bump auxil/spicy to latest development snapshot 2024-08-06 18:20:09 +02:00
Arne Welzel
9f5f8b809a spicy/runtime-support: Switch ParameterMismatch::_fmt to static
UBSAN's vptr sanitize isn't happy with the call to _fmt()
in its member initializer list.

    $ zeek -r Traces/ssh/single-conn.trace .tmp/spicy.event-args-mismatch/test.hlto .tmp/spicy.event-args-mismatch/event-args-mismatch.zeek
    <...>/src/include/zeek/spicy/runtime-support.h:80:29: runtime error: member call on address 0x511000369540 which does not point to an object of type 'zeek::spicy::rt::ParameterMismatch'
    0x511000369540: note: object has invalid vptr
     00 00 00 00  be be be be be be be be  be be be be be be be be  be be be be be be be be  be be be be
                  ^~~~~~~~~~~~~~~~~~~~~~~
                  invalid vptr
        #0 0x7f9c9977b019 in zeek::spicy::rt::ParameterMismatch::ParameterMismatch(std::basic_string_view<char, std::char_traits<char>>, zeek::IntrusivePtr<zeek::Type> const&, std::basic_string_view<char, std::char_traits<char>>) <...>/src/include/zeek/spicy/runtime-support.h:80:29
         #1 0x7f9c9977a6a2 in zeek::spicy::rt::to_val(hilti::rt::Bytes const&, zeek::IntrusivePtr<zeek::Type> const&) <...>/src/include/zeek/spicy/runtime-support.h:562:15
2024-08-06 18:20:09 +02:00
Arne Welzel
11bc233f45 coverage/lcov_html: Ignore testing/btest/.tmp
gcda/gcno files in the btest/.tmp directory are from .htlo files
referencing ephemeral cc files. No need to include these.
2024-08-06 18:20:09 +02:00
Arne Welzel
f1167fc87f cirrus: Do not disable Spicy for sanitizer builds 2024-08-06 18:20:09 +02:00
Arne Welzel
83a2eb3665 ldap: Avoid unset m$opcode
Initial fuzzing caused a bind response to arrive before a bind request,
resulting in an unset field expression error:

    expression error in base/protocols/ldap/main.zeek, line 270: field value missing (LDAP::m$opcode)

Prevent this by ensuring m$opcode is set and raising instead.
2024-08-06 18:20:09 +02:00
Arne Welzel
92d4e50b48 fuzzers: Add LDAP fuzzing
LDAP supports both, UDP and TCP as separate analyzers. The corpus
is identical, however. Started to hit the TLS analyzer fairly
quickly, too.

Closes #3860
2024-08-06 18:20:09 +02:00
Tim Wojtulewicz
d52ec28c89 Merge remote-tracking branch 'origin/topic/timw/dont-install-empty-zam-dirs'
* origin/topic/timw/dont-install-empty-zam-dirs:
  Don't install empty ZAM directories
2024-08-06 09:02:31 -07:00
Arne Welzel
bd8c5b7bbb Merge remote-tracking branch 'upstream/topic/awelzel/fix-btest-spicy-replaces-conflicts'
* upstream/topic/awelzel/fix-btest-spicy-replaces-conflicts:
  btest/spicy: Make replaces-conflicts trigger replaces code path
2024-08-06 12:03:18 +02:00
Arne Welzel
bae15230bb btest/spicy: Make replaces-conflicts trigger replaces code path
The current test attempts to instantiate two spicy::SSH_1 protocol
analyzers in the .evt file. The intention likely was to use two
distinct protocol analyzer both trying to replace the builtin SSH
analyzer.

Coincidentally, fixing this happens to workaround TSAN errors tickled
by the FatalError() call while loading the .hlto with two identically
named analyzers.

    $ cat .tmp/spicy.replaces-conflicts/output
    error: redefinition of protocol analyzer spicy::SSH_1
    ThreadSanitizer: main thread finished with ignores enabled
      One of the following ignores was not ended (in order of probability)
      Ignore was enabled at:
        #0 __llvm_gcov_init __linker___d192e45c25d5ee23-484d3e0fc2caf5b4.cc (ssh.hlto+0x34036) (BuildId: 091934ca4da885e7)
        #1 __llvm_gcov_init __linker___d192e45c25d5ee23-484d3e0fc2caf5b4.cc (ssh.hlto+0x34036) (BuildId: 091934ca4da885e7)
        ...

I was tempted to replace FatalError() with Error() and rely on
zeek-setup.cc's early exiting on any reporter errors, but this
seems easier for now.

Relates to #3865.
2024-08-06 11:52:52 +02:00
Arne Welzel
351f16c160 telemetry/Manager: Track sent_in and sent_out totals without callback
For terminated threads, the totals would go down once the threads are
removed, which isn't great. Move tracking of sent in and sent out
messages from callback to explicit `Inc()` calls.

Also fixes total_messages_in_metric being initialized twice rather
than total_messages_out_metric.
2024-08-06 11:06:38 +02:00
Arne Welzel
c55b2ece8f threading/Manager: Switch inf bucket from infinity() to max()
For uint64_t, std::numeric_limits<T>::has_infinity is false and infinity()
actually returns 0. Use uint64_t's max() instead. We could cast to double
and use the double infinity, but this seems reasonable, too.

This was found while trying to provoke some pending messages and being
confused why all but the "inf" bucket increased.
2024-08-06 11:05:42 +02:00
Arne Welzel
98480cf339 threading/Manager: "lt" to "le" and do not break
The buckets are specified as lower-equal (changed from lower-than now),
which means we shouldn't break: The larger "le" bucket contains all previous
buckets, too. The "inf" bucket represents the current number of threads.

For example, with a total of 10 threads, 5 threads with 0 messages pending,
another 4 threads with 50 messages, and on with 2000 messages, the metrics
would end end up as follows:

    pending_buckets{le=1}      = 5
    pending_buckets{le=10}     = 5
    pending_buckets{le=100}    = 9
    pending_buckets{le=1000}   = 9
    pending_buckets{le=10000}  = 10
    pending_buckets{le=inf}    = 10

This might be strange initially, but aligns with the Prometheus
histogram approach (though we're using gauges here).
2024-08-06 09:46:51 +02:00
Tim Wojtulewicz
2f8733e08d Don't install empty ZAM directories 2024-08-05 16:23:03 -07:00
Tim Wojtulewicz
25f65a705f Updating CHANGES and VERSION. 2024-08-05 14:40:31 -07:00
Tim Wojtulewicz
b483fad3d0 Merge remote-tracking branch 'origin/topic/timw/3081-prof-log-metrics'
* origin/topic/timw/3081-prof-log-metrics:
  Remove some unnecessary #includes
  Avoid capturing 'this' for callback in telemetry::Manager
  Make telemetry metrics out of MsgThread statistics
  Split cpu time metric into user/system components like prof.log
  Move broker statistics to be telemetry metrics
  Add timer counts as telemetry metrics
  Move thread manager stats to telemetry metric
  Add extra metrics to session_mgr
  Move dns_mgr stats to telemetry instruments
  Move trigger stats to telemetry instruments
  Move pulling of global state inside 'expensive' check for stats
2024-08-05 14:39:56 -07:00
Tim Wojtulewicz
1325e16a0d Remove some unnecessary #includes 2024-08-05 13:27:30 -07:00
Tim Wojtulewicz
7a1eb78b67 Avoid capturing 'this' for callback in telemetry::Manager 2024-08-05 13:27:30 -07:00
Tim Wojtulewicz
73f71e652d Make telemetry metrics out of MsgThread statistics 2024-08-05 13:27:30 -07:00
Tim Wojtulewicz
a6843067e9 Split cpu time metric into user/system components like prof.log
The total can be calculated from the two parts via Prometheus/Grafana
if desired, so it's more informative to pass them as separate parts.
2024-08-05 13:27:30 -07:00
Tim Wojtulewicz
206f5cd522 Move broker statistics to be telemetry metrics 2024-08-05 13:27:30 -07:00
Tim Wojtulewicz
44860676a2 Add timer counts as telemetry metrics 2024-08-05 13:21:44 -07:00
Tim Wojtulewicz
4face43462 Move thread manager stats to telemetry metric 2024-08-05 13:21:44 -07:00
Tim Wojtulewicz
a81f6ab9a6 Add extra metrics to session_mgr
- Sessions killed by activity
- Current number of sessions across all types
2024-08-05 13:21:44 -07:00
Tim Wojtulewicz
d1f7999f61 Move dns_mgr stats to telemetry instruments 2024-08-02 21:27:26 -07:00
Tim Wojtulewicz
8b4af06484 Move trigger stats to telemetry instruments 2024-08-02 21:27:26 -07:00
Tim Wojtulewicz
77c05357b5 Move pulling of global state inside 'expensive' check for stats 2024-08-02 21:27:26 -07:00
zeek-bot
8acc5ae15e Update doc submodule [nomail] [skip ci] 2024-08-03 00:12:18 +00:00
Tim Wojtulewicz
3c3853dc7d Merge remote-tracking branch 'origin/topic/timw/telemetry-threading'
* origin/topic/timw/telemetry-threading:
  Process metric callbacks from the main-loop thread
2024-08-02 15:50:47 -07:00
Tim Wojtulewicz
7ac7ce1d2b Process metric callbacks from the main-loop thread
This avoids the callbacks from being processed on the worker thread
spawned by Civetweb. It fixes data race issues with lookups involving
global variables, amongst other threading issues.
2024-08-02 15:30:47 -07:00
Arne Welzel
9d9cc51e9d Merge remote-tracking branch 'origin/topic/timw/use-more-memory-for-freebsd-builds'
* origin/topic/timw/use-more-memory-for-freebsd-builds:
  CI: Use 16GB of memory for FreeBSD builds
2024-08-01 11:14:46 +02:00
Tim Wojtulewicz
af65c29a3e CI: Use 16GB of memory for FreeBSD builds 2024-07-31 10:19:11 -07:00
Arne Welzel
ed4acd2437 Update doc submodule [nomail] [skip ci] 2024-07-31 12:22:08 +02:00
zeek-bot
e9adb8e462 Update doc submodule [nomail] [skip ci] 2024-07-30 00:10:33 +00:00
Tim Wojtulewicz
4c0c7581c8 Merge remote-tracking branch 'origin/topic/bbannier/bump-spicy'
* origin/topic/bbannier/bump-spicy:
  Bump auxil/spicy to latest development snapshot
2024-07-26 10:12:04 -07:00
Arne Welzel
152bbbd680 Merge remote-tracking branch 'origin/topic/awelzel/3853-ldap-spnego-ntlmssp'
* origin/topic/awelzel/3853-ldap-spnego-ntlmssp:
  ldap: Recognize SASL+SPNEGO+NTLMSSP
2024-07-26 15:14:52 +02:00
Arne Welzel
02e3d30227 ldap: Recognize SASL+SPNEGO+NTLMSSP
The ctu-sme-11-win7ad-1-ldap-tcp-50041.pcap file was harvested
from the CTU-SME-11 (Experiment-VM-Microsoft-Windows7AD-1) dataset
at https://zenodo.org/records/7958259 (DOI 10.5281/zenodo.7958258).

Closes #3853
2024-07-26 14:37:36 +02:00
Benjamin Bannier
666341fcbb Bump auxil/spicy to latest development snapshot
This in particular pulls in a fix for zeek/spicy#1808.
2024-07-26 13:28:31 +02:00
zeek-bot
7afb9b2afb Update doc submodule [nomail] [skip ci] 2024-07-26 00:10:24 +00:00
Tim Wojtulewicz
a40da34915 Merge remote-tracking branch 'botovq/opaque_x509_algor'
* botovq/opaque_x509_algor:
  Use accessor to reach into X509_ALGOR
2024-07-25 09:19:31 -07:00
Arne Welzel
93a430ce15 Merge remote-tracking branch 'origin/topic/awelzel/mysql-amazing-pp-issue-2716-additions'
* origin/topic/awelzel/mysql-amazing-pp-issue-2716-additions:
  mysql: Simplify length computation
  mysql: Improve date and time parsing
  btest/mysql: Clean query-attr.pcapng
  mysql: Support non-string query attributes
  btest/mysql: Add pcap with non-string query attributes
  mysql: Introduce mysql_ssl_request event
  mysql: Fix EOFIfLegacyThenResultSet
  mysql: Add data parameter to mysql_auth_plugin
  mysql: Add mysql_auth_plugin, mysql_auth_more_data and mysql_auth_switch_request events
  mysql: AuthSwitchRequest: &enforce a 0xfe / 254 status
  mysql: Make auth_plugin_ a std::string
  mysql: Fix auth_plugin_data_part2 length computation
  Refactored connection phase state handling
  Add support for "auth switch" and "query attrs"
  Add support for parsing the "caching_sha2_password" auth plugin
2024-07-25 12:18:31 +02:00