19082 Commits

Author SHA1 Message Date
Rainer Gerhards
35f508a085
imjournal: initialize instance fields to avoid invalid free
createInstance() left stateFile and bMain uninitialized. When a
statefile was configured, activateCnf() attempted to free the garbage
pointer, leading to free(): invalid pointer at startup. Initialize
these fields to sane defaults.

Fixes https://github.com/rsyslog/rsyslog/issues/5730

AI-Agent: ChatGPT
2025-08-22 14:04:57 +02:00
Rainer Gerhards
21c9164a4b
Merge pull request #6006 from rgerhards/revert-pr-5806
tcpsrv: revert PR 5806 because it was ineffective
2025-08-22 12:46:59 +02:00
Rainer Gerhards
3e64f45bb8
Merge pull request #6002 from rgerhards/statan2
mmaitag: fix potential memory leak
2025-08-22 12:45:55 +02:00
Rainer Gerhards
5b0a8e4b31
Merge pull request #6008 from rgerhards/statan-fix
imdocker: fix cosmetic memory leak
2025-08-22 12:43:21 +02:00
Rainer Gerhards
d8d0da9255
mmaitag: fix potential memory leak
This was detected by clang static analyzer.
2025-08-22 12:39:41 +02:00
Rainer Gerhards
22226a7989
Merge pull request #6003 from rsyslog/codex/refactor-templates-documentation-into-hub-page
doc: restructure templates docs into hub and refs
2025-08-22 12:27:55 +02:00
Rainer Gerhards
c070eca8fd
imdocker: fix cosmetic memory leak
This addresses a small one-time leak in option parsing, reported by
clang static analyzer. While it is practically invisible in real use,
fixing it improves code hygiene and keeps analyzers clean.

Impact: No user-visible effect; prevents analyzer warnings.

Technical details:
Previously, a buffer created by strdup() for container log options
was not always released, leading to a minor leak during config load.
The code now allocates once, uses CHKmalloc for safety, and frees the
buffer in the finalize step. This ensures consistent memory ownership
without altering module behavior. No changes to runtime logging flow,
queue semantics, or config parameter interpretation.
2025-08-22 12:22:35 +02:00
Rainer Gerhards
46a91d1aa3
Merge pull request #5982 from rsyslog/codex/implement-patch-for-code-cleanup
atomic: remove trailing semicolons from helper macros
2025-08-22 11:40:23 +02:00
Rainer Gerhards
7fe7d27df3
Merge pull request #6007 from rgerhards/ai_bug_finder
AI: add base prompt for rsyslog C code review assistant
2025-08-22 11:38:22 +02:00
Rainer Gerhards
01ca92bbe0
Merge pull request #6004 from rsyslog/codex/task-title
omhttp: guard rest path template access
2025-08-22 11:28:24 +02:00
Rainer Gerhards
ff66a1c806 AI: add base prompt for rsyslog C code review assistant 2025-08-22 11:24:38 +02:00
Rainer Gerhards
75c06fa333
tcpsrv: revert PR 5806 because it was ineffective
While at the time of merge I was confident it would fix a data race,
the root cause has now surfaced to be a simple state advancement
(single-threaded) bug. See commit c5fd73499 for details. As such
I revert this patch. it caused no harm, but complicates code, adds
a bit of computation and is no longer needed.

I cannot 100% outrule it might have addressed some edge cases.
I know an environment where we can verify this within the next
month or so. If, unexpectedly, this shows regressions, we can
re-enable the patch. But I am 99.99% sure it is not needed.

see also: https://github.com/rsyslog/rsyslog/pull/5806
see also: https://github.com/rsyslog/rsyslog/pull/5993
2025-08-22 11:20:13 +02:00
Rainer Gerhards
56da437037
Merge pull request #6005 from rsyslog/codex/analyze-and-refactor-inqueue-handling
runtime/tcpsrv: drop obsolete inQueue handling
2025-08-22 09:17:53 +02:00
Rainer Gerhards
9d53da753e runtime/tcpsrv: drop obsolete inQueue handling
inQueue guarded against double-queuing of descriptors.
The server uses EPOLLONESHOT and only one dispatcher, so
a descriptor is enqueued at most once before being
processed. The extra flag and atomic helpers are dead
code. Removing them simplifies queue management.

AI-Agent: ChatGPT
2025-08-21 21:00:23 +02:00
Rainer Gerhards
df74f4d00b omhttp: guard rest path template access 2025-08-21 19:28:11 +02:00
Rainer Gerhards
b5d7bd7a4d doc: restore property statement context 2025-08-21 19:11:05 +02:00
Rainer Gerhards
f17ad70f7e
ci: add clang static analyzer workflow via github action (#5981)
This replaces the former clang static analyzer check via buildbot, which needed quite some baby-sitting due to environment constraints. For the next time, run it via github action.

Note that we use the same core script to run the analyzer like we did previously. This means we can also switch back with ease.
2025-08-21 19:10:01 +02:00
Rainer Gerhards
97c7a8ad31 doc: restructure templates docs into hub and refs
Split monolithic templates doc into hub and ten reference pages.
Normalize parameter casing to lowerCamelCase and modernize cross references.
Add summary include blocks and table navigation.

AI-Agent: ChatGPT
2025-08-21 18:20:58 +02:00
Rainer Gerhards
a462eb22d9
Merge pull request #6001 from rgerhards/fix-posisble-garbagge
core/nsd_ptcp: zero addr before getpeername()
2025-08-21 17:48:35 +02:00
Rainer Gerhards
87d1de2083
Merge pull request #6000 from rgerhards/statan-fixes
core: code cleanup, avoid dead assignment
2025-08-21 17:47:35 +02:00
Rainer Gerhards
d445a33d6e
Merge pull request #5995 from alorbach/pr-issue-5989
ci: add Fedora 41/42 and Debian 13 dev-base images
2025-08-21 12:54:19 +02:00
Rainer Gerhards
7bb07668fe
core/nsd_ptcp: zero addr before getpeername()
Static analysis cleanup to remove a possible read of uninitialized data.
This reduces undefined behavior risk with negligible overhead and aligns
with best practices for network address handling.

Impact: No functional change expected on correct systems; on buggy
getpeername() implementations we now return -1 instead of a random port.

Before: addr could contain garbage when getpeername() failed/partially
filled it, leading to spurious port extraction.
After: addr is zero-initialized; if family/port are not set we keep
*port at -1 and treat it as "no remote port".

Technically, GetRemotePort() now zeroes the local sockaddr_storage
before calling getpeername(). This prevents subsequent AF_INET/AF_INET6
parsing from reading uninitialized fields. No changes to RS_RET codes,
queues, OMODTX, or HUP semantics. No tests/docs touched.
2025-08-21 12:31:13 +02:00
Rainer Gerhards
5ecfe0ff0b
core: code cleanup, avoid dead assignment 2025-08-21 12:11:03 +02:00
Cursor Agent
574ad7c3b4 ci: add Fedora 41/42 and Debian 13 dev-base images
Modernize our dev/CI matrix to match current distro lines and reduce
toolchain drift. This keeps project-provided images aligned with what
contributors run locally and moves us toward “project-supported” bases.

Impact: CI matrix refresh only; no runtime behavior change intended.

Before: CI used Fedora 35/36 and Debian 10/11 dev-base images.
After: CI uses Fedora 41/42 and Debian 11/13 dev-base images.

Update run_checks.yml to use new container tags and pass consistent
configure extras (incl. enabling dtls in relevant jobs). Add Dockerfiles
and helper scripts for debian:13 and fedora:{41,42}. Bump the cached
ZooKeeper tarball to 3.9.3 across legacy images. Debian 13 adds a small
libgcrypt-config wrapper that defers to pkg-config to keep builds working.
Fedora images refresh toolchains (clang18 et al.) and re-sync module flags.
No API/ABI changes; this is build/CI plumbing only.

closes: https://github.com/rsyslog/rsyslog/issues/5989
2025-08-21 12:06:14 +02:00
Rainer Gerhards
3290e9dd58
Merge pull request #5993 from rgerhards/tcpsrv-racefix
tcpsrv: stop loop after closeSess to avoid use-after-free
2025-08-21 11:52:04 +02:00
anis
e153bdca97 Feature: #define macro creation for journald namespace function. 2025-08-20 19:28:10 +02:00
Rainer Gerhards
c5fd734999
tcpsrv: stop loop after closeSess to avoid use-after-free
This fixes a real-world segfault seen in production. The loop could
continue after closing a session and touch freed state on EPOLL builds.
The change makes the termination explicit to prevent crashes.

Impact: prevents segfaults in rare error paths; loop ends earlier after
a close, which may skip remaining iteration work for that session.

Before/After: before, the read/error branch could continue after
closeSess() and use freed pioDescr/pSess; after, we set do_run=0 and
exit the loop, avoiding any further dereference.

Technical: closeSess() on EPOLL removes the fd from epoll and frees the
io descriptor; callers must not access pioDescr or pSess after return.
We now set do_run=0 right after CHKiRet(closeSess(...)) in the read/
error path, matching the documented contract that both pointers become
invalid. We also improve closeSess() documentation to state pre/post
conditions, unlocking behavior, and epoll semantics, and fix a comment
typo ("epoll_Ctl"). No API/ABI change; action queues and stats are
unchanged. HUP and OMODTX semantics are unaffected.
2025-08-20 18:44:48 +02:00
Rainer Gerhards
cef0b33c38
Update README.md - notification channels
add channels to get news about rsyslog
2025-08-20 15:31:22 +02:00
Rainer Gerhards
a653e30ae0
Merge pull request #5985 from rsyslog/codex/refactor-rsyslog-parameters-documentation
omprog: split parameter docs into reference pages
2025-08-20 15:07:19 +02:00
Rainer Gerhards
43cb156744
omprog: split parameter docs into reference pages
Make omprog docs easier to navigate and link while improving structure
for AI tooling and programmatic ingestion. This aids both humans and
assistants in finding a single parameter quickly with stable anchors.

BEFORE: All action parameters lived inline in modules/omprog.rst.
AFTER: Each parameter has its own reference page; omprog.rst shows a
       list-table with concise summaries and a hidden toctree.

Technically, move each action parameter into
doc/source/reference/parameters/omprog-*.rst with stable anchors
(param-omprog-* and omprog.parameter.action.*), a summary block,
metadata (type/default/introduced), usage snippets, and legacy
directive mappings. The module page now pulls per-parameter summaries
via include directives and adds a hidden toctree for discovery.
Cross-references were aligned, legacy names preserved (e.g.
$ActionOMProgBinary), and a non-normative note recommends camelCase
for readability. No runtime or API/ABI changes; documentation only.

With help from AI coding Agents: codex, Gemini
see also: https://github.com/rsyslog/rsyslog/issues/5933
2025-08-20 14:50:08 +02:00
Rainer Gerhards
c8e2188158
maintain ChangeLog 2025-08-20 12:26:00 +02:00
Rainer Gerhards
d0d2e14ce8
Merge pull request #5987 from rgerhards/copilot-enh
ci: add copilot support instruction files
2025-08-20 12:22:25 +02:00
Rainer Gerhards
b76e816db3
Merge pull request #5984 from rsyslog/fix/omfwd-retry-on-flush-failure
omfwd: document and enforce pool-level suspend semantics
2025-08-20 10:34:19 +02:00
Rainer Gerhards
4c7d85d04c
Update .github/instructions/modules.plugins.instructions.md
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-08-20 10:31:23 +02:00
Rainer Gerhards
a29cbd6d09
ci: add copilot support instruction files
This adds repository-level instructions to guide GitHub Copilot in
producing higher quality and safer pull requests. It is part of the
"AI First" approach, aiming to improve contributor experience and
reduce review friction.

Impact: no change to runtime or user-facing behavior.

The new files under `.github/` provide scoped rules for Copilot across
documentation, plugins, and contrib modules. They emphasize alignment
with AGENTS.md, developer checklists, and module maps. Guardrails cover
quoting, doc structure, config conventions, and mandatory source
citations. The intent is to ensure AI-assisted edits follow existing
rsyslog patterns and remain minimal and test-backed.

These changes are additive only and have no effect on rsyslog code,
APIs, or operational semantics. They prepare the repo for more
consistent AI-assisted contributions.
2025-08-20 10:24:55 +02:00
Cursor Agent
d846dffbc9 omfwd: document and enforce pool-level suspend semantics
Inline code docs clarify when omfwd should suspend an action in pooled
TCP forwarding. This improves maintainability and reduces ambiguity for
future changes and reviews.

Impact: No user-visible behavior change; semantics documented.

Before/After: Before, a per-target flush failure could be read as
suspending the action; after, SUSPENDED is returned only when the pool
has zero active targets.

Technically, commitTransaction no longer marks the action suspended on
a single-target flush failure. We destruct the failing target, keep the
commit OK, and rely on pool stats plus `countActiveTargets()` to decide
pool-wide availability. Only when `nActiveTargets == 0` do we return
RS_RET_SUSPENDED, engaging the action engine's retry. Buffered frames
for a failed target remain with that target and are flushed after
`doTryResume()` re-establishes the connection in a later transaction.
This preserves existing omfwd pool semantics while documenting them in
code comments for clarity.

Refs: no issue
2025-08-20 08:04:04 +00:00
Rainer Gerhards
7d3ff39e88 atomic: remove trailing semicolons from helper macros
Trailing semicolons in atomic helper macros caused double
semicolons when the macros expanded, producing build warnings.
Macros now omit semicolons and call sites add them explicitly.
STATSCOUNTER_DEF updated to terminate the generated mutex line.

AI-Agent: ChatGPT
2025-08-19 16:06:44 +02:00
Rainer Gerhards
df9dc9be1c
Merge pull request #5977 from rsyslog/codex/refactor-documentation-for-module-parameters
imuxsock: split input parameter docs into reference pages
2025-08-19 15:54:31 +02:00
Rainer Gerhards
852a35cec2
Merge pull request #5881 from rgerhards/omfwd-flaky-test-experimental
testbench: fix some omfwd-lb-1target* tests - they were very flaky
2025-08-19 15:33:22 +02:00
Rainer Gerhards
af7f23032c
Merge pull request #5910 from rgerhards/customgpt2
AI: a try at further improving custom GPT correctness
2025-08-19 15:31:57 +02:00
Rainer Gerhards
b0f368f39c
Merge pull request #5980 from rgerhards/docai
doc: make AI-First concrete; add guardrails and CI proof
2025-08-19 15:19:59 +02:00
Rainer Gerhards
1324f0b7e4
imuxsock: tidy parameter docs and links
Fix broken omjournal reference in IgnoreOwnMessages.\nClarify SysSock.ParseTrusted version history.\nRemove stray blank lines in Legacy names sections to avoid Sphinx warnings.\n\nAI-Agent: ChatGPT
2025-08-19 13:48:08 +02:00
Rainer Gerhards
d6a04c16bf
doc: make AI-First concrete; add guardrails and CI proof
This turns the AI-First vision from words into verifiable practice.
It documents how we apply AI responsibly and shows the checks that
protect users, contributors, and releases.

Before: high-level narrative with few proofs.
After: structured principles plus Golden Path, Guardrails, Safeguards,
and CI gates users can verify.

The page is renamed to "AI-First (Human-Controlled)" and reorganized
with Sphinx anchors, index terms, and meta fields for better retrieval.
It adds Golden Path guidance (low-friction, good-default workflows) and
explicit Guardrails (style, structure, commit/PR templates, provenance).
It then lists concrete Safeguards that actually gate PRs and releases:
multi-distro builds, sanitizers, distcheck, coverage, CodeQL, and
selective workflows, including file paths to GitHub Actions. Buildbot
is noted for extended checks. A "Visible Artifacts" section shows how
contributors can observe the process (assistants, reviewer bot, docs
metadata). Roles, operational rules, and a change log round out the
page. No runtime or ABI changes.

This update aims to improve trust and maintainability by making the
responsible AI approach inspectable and reproducible across time.
2025-08-19 13:19:19 +02:00
Rainer Gerhards
556755a6e7
Merge pull request #5964 from rsyslog/codex/analyze-and-fix-race-condition-in-tcpflood
Serialize TLS session setup in tcpflood to avoid race
2025-08-18 20:23:27 +02:00
Rainer Gerhards
d9f3a24214
Merge pull request #5975 from rsyslog/codex/fix-imfile-examples-to-include-mandatory-parameters
doc/imfile: add File and Tag to parameter samples
2025-08-18 20:21:43 +02:00
Rainer Gerhards
50edb1de72 imuxsock: split input parameter docs into reference pages 2025-08-18 20:02:21 +02:00
Rainer Gerhards
ca0eaeee3f doc/imfile: add File and Tag to parameter samples 2025-08-18 18:27:14 +02:00
Rainer Gerhards
ad082167f0
maintain ChangeLog 2025-08-18 18:10:27 +02:00
Rainer Gerhards
7fd4d95a4b
Merge pull request #5955 from xietangxin/main
imjournal: fix double sd_journal_close() during thread cancellation
2025-08-18 18:07:14 +02:00
Rainer Gerhards
333efbdeb6 tcpflood: omit delimiter for octet frames 2025-08-18 18:00:52 +02:00