Commit graph

16672 commits

Author SHA1 Message Date
Arne Welzel
1c8fedaf09 Merge remote-tracking branch 'origin/topic/awelzel/move-hilti-jit-parallelism-to-btest-cfg'
* origin/topic/awelzel/move-hilti-jit-parallelism-to-btest-cfg:
  testing/btest: Default to HILTI_JIT_PARALLELISM=1
  Revert "CI: Use ccache and a single CPU when building spicy analyzers for btests"
2024-07-10 11:06:46 +02:00
Arne Welzel
7b99fc01a9 testing/btest: Default to HILTI_JIT_PARALLELISM=1
This is a rework of b59bed9d06 moving
HILTI_JIT_PARALLELISM=1 into btest.cfg to make it default applicable to
btest -j users (and CI).

The background for this change is that spicyz may spawn up to nproc compiler
instances by default. Combined with btest -j, this may be nproc x nproc
instances worst case. Particularly with gcc, this easily overloads CI or
local systems, putting them into hard-to-recover-from thrashing/OOM states.

Exporting HILTI_JIT_PARALLELISM in the shell allows overriding.
2024-07-10 11:04:47 +02:00
Arne Welzel
cb500536ea Revert "CI: Use ccache and a single CPU when building spicy analyzers for btests"
This reverts commit b59bed9d06.
2024-07-10 10:02:53 +02:00
zeek-bot
b995924b21 Update doc submodule [nomail] [skip ci] 2024-07-10 00:21:07 +00:00
Tim Wojtulewicz
b309c423f8 Merge remote-tracking branch 'origin/topic/timw/ci-reduce-spicy-test-load'
* origin/topic/timw/ci-reduce-spicy-test-load:
  CI: Use ccache and a single CPU when building spicy analyzers for btests
2024-07-09 15:12:29 -07:00
Tim Wojtulewicz
b64f0e8fd8 Merge remote-tracking branch 'origin/topic/bbannier/bump-spicy'
* origin/topic/bbannier/bump-spicy:
  Bump auxil/spicy to latest development snapshot
2024-07-09 14:53:49 -07:00
Tim Wojtulewicz
b59bed9d06 CI: Use ccache and a single CPU when building spicy analyzers for btests 2024-07-09 14:31:09 -07:00
Tim Wojtulewicz
c557b2156a Merge remote-tracking branch 'origin/topic/vern/script-opt-maint.Jul24'
* origin/topic/vern/script-opt-maint.Jul24:
  minor script optimization updates to reflect recent changes, Coverity findings
2024-07-09 10:15:26 -07:00
Tim Wojtulewicz
03e17a530a Update zeek-aux submodule [nomail] 2024-07-09 09:33:29 -07:00
Benjamin Bannier
fcded0fc6a Bump auxil/spicy to latest development snapshot 2024-07-09 18:22:21 +02:00
Arne Welzel
e102715bc8 Merge remote-tracking branch 'cknill/topic/cknill/display_cmake_fix'
* cknill/topic/cknill/display_cmake_fix:
  Fix for --display-cmake in configure Moved build directory creation further down in the script so that --display-cmake has a chance to happen before build tree setup.
2024-07-09 17:10:28 +02:00
Christian Kreibich
6552c4e0fe Merge branch 'topic/christian/management-telemetry-additions'
* topic/christian/management-telemetry-additions:
  Management framework: bump cluster testsuite to pull in telemetry tests
  Management framework: bump zeek-client
  Management framework: augment deployed configs with instance IP addresses
  Management framework: add auto-enumeration of metrics ports
  Management framework: propagate metrics port from agent
  Management framework: add metrics port in management & Supervisor node records
  Harden the telemetry manager against unset Telemetry::metrics_address
  Comment-only tweaks for telemetry-related settings.
2024-07-09 00:08:28 -07:00
Christian Kreibich
cdd5062f45 Management framework: bump cluster testsuite to pull in telemetry tests 2024-07-08 23:05:24 -07:00
Christian Kreibich
7d802f27b7 Management framework: bump zeek-client 2024-07-08 23:05:24 -07:00
Christian Kreibich
8a4fb0ee19 Management framework: augment deployed configs with instance IP addresses
The controller learns IP addresses from agents that peer with it, but that
information has so far gotten lost when resulting configs get pushed out to the
agents. This makes these updates include that information.
2024-07-08 23:05:24 -07:00
Christian Kreibich
742f7fe340 Management framework: add auto-enumeration of metrics ports
This is quite redundant with the enumeration for Broker ports,
unfortunately. But the logic is subtly different: all nodes obtain a telemetry
port, while not all nodes require a Broker port, for example, and in the metrics
port assignment we also cross-check selected Broker ports. I found more unified
code actually harder to read in the end.

The logic for the two sets remains the same: from a start point, ports get
enumerated sequentially that aren't otherwise taken. These ports are assumed
available; there's nothing that checks their availability -- for now.

The default start port is 9000. I considered 9090, to align with the Prometheus
default, but counting upward from there is likely to hit trouble with the Broker
default ports (9999/9997), used by the Supervisor. Counting downward is a bit
unnatural, and shifting the Broker default ports brings subtle ordering issues.

This also changes the node ordering logic slightly since it seems more intuitive
to keep sequential ports on a given instance, instead of striping across them.
2024-07-08 23:05:24 -07:00
Christian Kreibich
fa6361af56 Management framework: propagate metrics port from agent
This propagates the metrics port from the node config passed through the
supervisor all the way into the script layer.
2024-07-08 23:05:24 -07:00
Christian Kreibich
563704a26e Management framework: add metrics port in management & Supervisor node records
This allows setting a metrics port for creation in new nodes.
2024-07-08 23:05:24 -07:00
Christian Kreibich
8eb74c04de Harden the telemetry manager against unset Telemetry::metrics_address
We populate that address from the ZEEK_DEFAULT_LISTEN_ADDRESS environment
variable, but weren't prepared for that not being set. We now fall back to
0.0.0.0. This may have the same IPv6 issues that we've encountered elsewhere
when doing so before (v6 interfaces need "::") -- but this is still more likely
to work than not having any string at all.
2024-07-08 23:05:24 -07:00
Christian Kreibich
3ecacf4f50 Comment-only tweaks for telemetry-related settings.
These weren't quite accurate any more.
2024-07-08 23:05:24 -07:00
cknill
8dc120df1d Fix for --display-cmake in configure
Moved build directory creation further down in the script so that --display-cmake
has a chance to happen before build tree setup.
2024-07-08 19:24:40 -06:00
Tim Wojtulewicz
4d31335391 Merge branch 'topic/timw/update-submodules'
* topic/timw/update-submodules:
  Update submodules [nomail]
2024-07-08 15:00:26 -07:00
Tim Wojtulewicz
74ab980992 Update submodules [nomail] 2024-07-08 13:03:30 -07:00
Vern Paxson
a53e28be87 minor script optimization updates to reflect recent changes, Coverity findings 2024-07-06 16:44:27 -07:00
Arne Welzel
66cdb490ff Merge remote-tracking branch 'origin/topic/awelzel/ci-macos-sonoma-only'
* origin/topic/awelzel/ci-macos-sonoma-only:
  CMakeLists: Ensure Threads::Threads target exists
  ci/macos: Only use sonoma image
2024-07-04 17:34:42 +02:00
Benjamin Bannier
ecc1c4c215 Merge remote-tracking branch 'origin/topic/bbannier/bump-zeek-aux' 2024-07-04 17:22:53 +02:00
Benjamin Bannier
b6be7df540 Bump auxil/zeek-aux 2024-07-04 16:16:34 +02:00
Arne Welzel
36dfe89b59 CMakeLists: Ensure Threads::Threads target exists
Fix failure on OSX with CMake 3.30 complaining about missing
Threads::Threads target.
2024-07-04 15:42:52 +02:00
Arne Welzel
036ed95a3a ci/macos: Only use sonoma image 2024-07-04 15:42:50 +02:00
Benjamin Bannier
15b12c399a Merge branch 'topic/bbannier/bump-spicy' 2024-07-04 15:16:17 +02:00
Benjamin Bannier
64ea0af04d Bump auxil/spicy to latest development snapshot 2024-07-04 14:25:47 +02:00
Arne Welzel
651b44bb6e Merge remote-tracking branch 'origin/topic/awelzel/3789-debug-trailing-crlf-assert'
* origin/topic/awelzel/3789-debug-trailing-crlf-assert:
  HTTP: Implement FlipRoles()
  ContentLineAnalyzer: Add getter for skip_partial
2024-07-04 13:36:20 +02:00
Arne Welzel
377fd711bd HTTP: Implement FlipRoles()
When Zeek flips roles of a HTTP connection subsequent to the HTTP analyzer
being attached, that analyzer would not update its own ContentLine analyzer
state, resulting in the wrong ContentLine analyzer being switched into
plain delivery mode.

In debug builds, this would result in assertion failures, in production
builds, the HTTP analyzer would receive HTTP bodies as individual header
lines, or conversely, individual header lines would be delivered as a
large chunk from the ContentLine analyzer.

PCAPs were generated locally using tcprewrite to select well-known-http ports
for both endpoints, then editcap to drop the first SYN packet.

Kudos to @JordanBarnartt for keeping at it.

Closes #3789
2024-07-04 11:38:33 +02:00
Arne Welzel
c6368fc3f0 ContentLineAnalyzer: Add getter for skip_partial 2024-07-04 11:38:24 +02:00
zeek-bot
42a451c2e3 Update doc submodule [nomail] [skip ci] 2024-07-03 00:21:51 +00:00
Christian Kreibich
f9af58a5c2 Merge branch 'topic/christian/supervisor-node-simplification'
* topic/christian/supervisor-node-simplification:
  Remove the Supervisor's internal ClusterEndpoint struct.
  Provide a script-layer equivalent to Supervisor::__init_cluster().
2024-07-02 15:36:08 -07:00
Christian Kreibich
737b1a2013 Remove the Supervisor's internal ClusterEndpoint struct.
This eliminates one place in which we currently need to mirror changes to the
script-land Cluster::Node record. Instead of keeping an exact in-core equivalent, the
Supervisor now treats the data structure as opaque, and stores the whole cluster
table as a JSON string.

We may replace the script-layer Supervisor::ClusterEndpoint in the future, using
Cluster::Node directly. But that's a more invasive change that will affect how
people invoke Supervisor::create() and similars.

Relying on JSON for serialization has the side-effect of removing the
Supervisor's earlier quirk of using 0/tcp, not 0/unknown, to indicate unused
ports in the Supervisor::ClusterEndpoint record.
2024-07-02 14:52:17 -07:00
Christian Kreibich
a98ec6b08b Provide a script-layer equivalent to Supervisor::__init_cluster().
If the script layer is able to access the current node's config via
Supervisor::node(), it can handle populating Cluster::nodes. That code
is much more straightforward than an equivalent in-core implementation
(especially with the upcoming change to the cluster table's implementation).
This introduces base/frameworks/cluster/supervisor.zeek and
Cluster::Supervisor::__init_cluster_nodes() for that purpose.

The @load of the Supervisor API in cluster/main.zeek isn't technically
necessary since we already load it explicitly even in init-bare.zeek,
but being explicit seems better.
2024-07-02 14:52:13 -07:00
Christian Kreibich
3d6954dfd4 Merge branch 'topic/christian/json-improvements'
* topic/christian/json-improvements:
  Update NEWS file to cover JSON enhancements
  Support JSON roundtripping via to_json()/from_json() for patterns
  Support table deserialization in from_json()
  Support map-based definition of ports in from_json()
  Document the field_escape_pattern in the to_json() BiF
2024-07-02 14:47:24 -07:00
Christian Kreibich
5f8b6986a2 Update NEWS file to cover JSON enhancements 2024-07-02 14:46:16 -07:00
Christian Kreibich
0179a5e75c Support JSON roundtripping via to_json()/from_json() for patterns
This needed a small tweak in the deserialization, since each roundtrip
would otherwise pad the prior pattern with an extra /^?(...)$?/.

This expands the language.set test to also verify serializing/unserializing for
sets, similarly to tables in the previous commit.
2024-07-02 14:46:16 -07:00
Christian Kreibich
92c1098e97 Support table deserialization in from_json()
This allows additional data roundtripping through JSON since to_json() already
supports tables. There are some subtleties around the formatting of strings in
JSON object keys, for which this adds a bit of helper infrastructure.

This also expands the language.table test to verify the roundtrips, and adapts
bif.from_json to include a table in the test record.
2024-07-02 14:46:16 -07:00
Christian Kreibich
df645e9bb2 Support map-based definition of ports in from_json()
The from_json() BiF and its underlying code in Val.cc currently expect ports
expressed as a string ('80/tcp' etc). Zeek's own serialization via ToJSON()
renders them as an object ('{"port":80, "proto":"tcp"}'). This adds support
for the latter format to from_json(), so serialized values can be read back.
2024-07-02 14:46:16 -07:00
Christian Kreibich
a29f862f95 Document the field_escape_pattern in the to_json() BiF
This argument, and its corresponding use in Val.cc's BuildJSON(),
were never explained.
2024-07-02 14:46:16 -07:00
Arne Welzel
c2dd3dfad0 Bump cmake submodule [nomail] 2024-07-02 19:42:29 +02:00
Arne Welzel
e57aa5932e Merge remote-tracking branch 'origin/topic/awelzel/3682-bad-pipe-op-3'
* origin/topic/awelzel/3682-bad-pipe-op-3:
  threading/Manager: Warn if threads are added after termination
  iosource/Manager: Reap dry sources while computing timeout
  threading/MsgThread: Decouple IO source and thread lifetimes
  iosource/Manager: Do not manage lifetime of pkt_src
  iosource/Manager: Honor manage_lifetime and dont_count for short-lived IO sources
2024-07-02 14:41:54 +02:00
Arne Welzel
f050d96503 threading/Manager: Warn if threads are added after termination
The core.file-analyzer-violation test showed that it's possible to
create new threads (log writers) when Zeek is in the process of
terminating. This can result in the IO manager's deconstructor
deleting IO sources for threads that are still running.

This is sort of a scripting issue, so for now log a reporter warning
when it happens to have a bit of a bread-crumb what might be
going on. In the future it might make sense to plug APIs with
zeek_is_terminating().
2024-07-02 12:34:28 +02:00
Arne Welzel
739a8ac509 iosource/Manager: Reap dry sources while computing timeout
Avoids looping over the sources vector twice and should result
in the same behavior.
2024-07-02 11:32:05 +02:00
Arne Welzel
b3118d2a48 threading/MsgThread: Decouple IO source and thread lifetimes
MsgThread acting as an IO source can result in the situation where the
threading manager's heartbeat timer deletes a finished MsgThread instance,
but at the same time this thread is in the list of ready IO sources the
main loop is currently processing.

Fix this by decoupling the lifetime of the IO source part and properly
registering as lifetime managed IO sources with the IO manager.

Fixes #3682
2024-07-02 11:00:37 +02:00
Arne Welzel
0451a4038c iosource/Manager: Do not manage lifetime of pkt_src
Now that dry sources are properly reaped and freed, an offline packet
source would be deleted once dry, resulting in GetPktSrc() returning
a wild pointer. Don't manage the packet source lifetime and instead
free it during Manager destruction.
2024-07-02 10:47:08 +02:00