Skip to content

RDKEMW-24390: Mitigate Mythos Findings in RDK Logger - #64

Merged
karuna2git merged 10 commits into
rdkcentral:developfrom
dshett549:topic/RDKEMW-26942
Oct 22, 2026
Merged

karuna2git merged 10 commits into
rdkcentral:developfrom
dshett549:topic/RDKEMW-26942

Conversation

@dshett549

Copy link
Copy Markdown
Contributor

Implement per-process Unix datagram socket replacing UDP broadcast

Signed-off-by: Deepthi <DEEPTHICHANDRASHEKAR_SHETTY@comcast.com>
@dshett549
dshett549 requested a review from a team as a code owner October 16, 2026 09:41
Copilot AI balanced review requested due to automatic review settings October 16, 2026 09:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved socket permission and lifecycle defects, process-name lookup failures, and blocking sends affect security and reliability.

6 open findings
What changed in this PR

Replaces UDP broadcast runtime log control with per-process Unix datagram sockets to harden RDK Logger.

Changes:

  • Adds socket permission checks and process-specific lifecycle handling.
  • Changes rdklogctrl to target PIDs.
  • Updates tests and usage documentation.
File Description
utils/​rdklogctrl.c Resolves PIDs and sends Unix datagrams.
unittests/​rdkLoggerDynamic.cpp Updates PID targeting and strengthens assertions.
src/​rdk_dynamic_logger.c Implements per-process sockets and cleanup.
src/​include/​rdk_dynamic_logger.h Removes the unused message-length field.
docs/​TROUBLESHOOTING.md Updates commands and socket diagnostics.
docs/​QUICK_REFERENCE.md Documents PID-based control.
docs/​API_DOCUMENTATION.md Updates control syntax and transport details.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/rdk_dynamic_logger.c Outdated
Comment thread src/rdk_dynamic_logger.c Outdated
Comment thread src/rdk_dynamic_logger.c Outdated
Comment thread src/rdk_dynamic_logger.c Outdated
Comment thread utils/rdklogctrl.c Outdated
Comment thread utils/rdklogctrl.c Outdated
Comment thread src/rdk_dynamic_logger.c Fixed
Comment thread src/rdk_dynamic_logger.c Fixed
Signed-off-by: Deepthi <DEEPTHICHANDRASHEKAR_SHETTY@comcast.com>
Copilot AI balanced review requested due to automatic review settings October 16, 2026 10:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread src/rdk_dynamic_logger.c Outdated
Comment thread src/rdk_dynamic_logger.c Outdated
Signed-off-by: Deepthi <DEEPTHICHANDRASHEKAR_SHETTY@comcast.com>
Copilot AI balanced review requested due to automatic review settings October 16, 2026 10:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The removed license-comment opener prevents the logger source from compiling.

2 open findings
3 resolved since last review

🧠 Review effort: Balanced

Comment thread src/rdk_dynamic_logger.c
Signed-off-by: Deepthi <DEEPTHICHANDRASHEKAR_SHETTY@comcast.com>
Copilot AI balanced review requested due to automatic review settings October 16, 2026 10:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Socket naming rejects supported process names, and initialized forked children remain unreachable until they log.

0 open findings

2 resolved since last review
Previously missed (3)

In code that hasn't changed since last review

Medium severity Prevent long process names from exceeding Unix socket path limits

src/​rdk_dynamic_logger.c:72

A 100-character process name with module LOG.RDK.TEST fits the existing 128-byte packet limit (120 bytes total), but /tmp/.logger/<name>.<pid> exceeds Linux's 108-byte sun_path even with a one-digit PID. The receiver therefore cannot initialize, and the matching construction in utils/rdklogctrl.c rejects the target too. Use a bounded filename, such as PID-only, consistently in the receiver, controller, and documentation so previously supported names remain controllable.

Medium severity Initialize child control socket before its first log call

src/​rdk_dynamic_logger.c:137

After an initialized application forks or daemonizes, the child has no PID-specific socket until its first log call reaches this branch. Calling rdk_logger_init() in the child does not help: src/rdk_logger_init.c:61 skips initialization because isLogInited is inherited. Thus rdklogctrl targeting an initialized but idle child fails with ENOENT rather than queuing a level change. Establish the child's endpoint through PID-aware post-fork initialization or an explicit lifecycle hook, and test sending a request before the child's first log call.

Medium severity Restore 64-byte component-name boundary regression test

unittests/​rdkLoggerDynamic.cpp:367

This removes the positive 64-byte component-name regression test while retaining oversized-name rejection tests. An off-by-one change that rejects the maximum valid name would now go undetected. Restore a PID-based boundary test that sends a 64-byte name and verifies that the receiver processes the update.

🧠 Review effort: Balanced

Signed-off-by: Deepthi <DEEPTHICHANDRASHEKAR_SHETTY@comcast.com>
Copilot AI balanced review requested due to automatic review settings October 19, 2026 05:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Child socket initialization and inconsistent log-level lookup leave runtime control and getter behavior incorrect.

2 open issues
1 previously missed issue

In code that hasn't changed since last review

Medium severity Publish child control sockets after fork without requiring logging

src/​rdk_dynamic_logger.c:137

After logger initialization followed by fork/daemonization, the child has no PID-specific endpoint until a log call reaches this branch. During that interval, rdklogctrl <child-pid> ... fails with ENOENT rather than queuing a change. Calling rdk_logger_init() again does not create the endpoint because the child inherits isLogInited == true. Provide a post-fork initialization path that publishes the child's socket without requiring a log message first.

Review effort: Balanced

Comment thread src/rdk_debug_priv.c
Comment thread src/rdk_debug_priv.c Outdated
Signed-off-by: Deepthi <DEEPTHICHANDRASHEKAR_SHETTY@comcast.com>
Copilot AI balanced review requested due to automatic review settings October 19, 2026 07:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Forked children remain unreachable by runtime log control until their first logging call.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Publish child control endpoint immediately after fork

src/​rdk_dynamic_logger.c:137

When an initialized process forks or daemonizes, the child's PID-specific socket is not published until a logging call reaches this branch. Until then, rdklogctrl <child-pid> ... fails with ENOENT instead of queuing an update. Calling rdk_logger_init() again does not help because the child inherits isLogInited == true. Provide a supported post-fork initialization path that publishes the child's endpoint without requiring a log call, and test control of a child before it logs.

2 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 19, 2026 16:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Security-sensitive socket access and fork lifecycle behavior need additional regression coverage and human review.

3 open issues

Review effort: Balanced

Comment thread src/rdk_dynamic_logger.c
Comment thread src/rdk_dynamic_logger.c Outdated
Comment thread unittests/rdkLoggerDynamic.cpp
Copilot AI balanced review requested due to automatic review settings October 22, 2026 02:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread src/rdk_dynamic_logger.c Outdated
Comment thread src/rdk_dynamic_logger.c
Comment thread src/rdk_dynamic_logger.c
Comment thread src/rdk_dynamic_logger.c
Comment thread utils/rdklogctrl.c
Comment thread utils/rdklogctrl.c Outdated
Copilot AI balanced review requested due to automatic review settings October 22, 2026 02:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread docs/API_DOCUMENTATION.md Outdated
Comment thread docs/README.md Outdated
Comment thread docs/TROUBLESHOOTING.md Outdated
Copilot AI balanced review requested due to automatic review settings October 22, 2026 03:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Comment thread src/include/rdk_dynamic_logger.h
Comment thread src/include/rdk_dynamic_logger.h Outdated
Signed-off-by: Karunakaran A <karunakaran_amirthalingam@cable.comcast.com>
Copilot AI balanced review requested due to automatic review settings October 22, 2026 03:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread docs/README.md Outdated
Comment thread docs/README.md Outdated
Comment thread docs/README.md Outdated
Comment thread docs/README.md Outdated
Signed-off-by: Deepthi <DEEPTHICHANDRASHEKAR_SHETTY@comcast.com>
Copilot AI balanced review requested due to automatic review settings October 22, 2026 05:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Signed-off-by: Deepthi <DEEPTHICHANDRASHEKAR_SHETTY@comcast.com>
Copilot AI balanced review requested due to automatic review settings October 22, 2026 06:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The transport migration needs human validation of socket lifecycle behavior and compatibility before approval.

1 open issue
2 resolved since last review

Review effort: Balanced

@karuna2git
karuna2git merged commit eb0baf4 into rdkcentral:develop Oct 22, 2026
7 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants