Skip to content

Changed --mpi to --kernel-loader, updated comments#1216

Merged
xuyao0127 merged 2 commits intodmtcp:mainfrom
xuyao0127:kernel-loader
Sep 17, 2025
Merged

Changed --mpi to --kernel-loader, updated comments#1216
xuyao0127 merged 2 commits intodmtcp:mainfrom
xuyao0127:kernel-loader

Conversation

@xuyao0127
Copy link
Copy Markdown
Collaborator

@xuyao0127 xuyao0127 commented Aug 6, 2025

Both MANA and CRAC needs to set the ADDR_NO_RANDOMIZE personality, and use UH_PRELOAD env var instead of LD_PRELOAD. I changed the flag for dmtcp_launch from --mpi to --kernel-loader and updated related comments so that both MANA and CRAC can use the same --kernel-loader flag.

Summary by CodeRabbit

  • New Features

    • Introduced a new --kernel-loader command-line option for advanced plugin support.
  • Improvements

    • Updated help messages to reflect the new option and clarify environment variable usage.
    • Enhanced environment setup to use UH_PRELOAD when kernel loader mode is enabled, improving compatibility with certain plugins.

@xuyao0127 xuyao0127 requested review from gc00 and karya0 August 6, 2025 19:12
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Aug 6, 2025

Walkthrough

The changes update the command-line interface and internal logic in src/dmtcp_launch.cpp to introduce a new --kernel-loader option, replacing the deprecated --mpi flag. The environment setup now conditionally uses UH_PRELOAD instead of LD_PRELOAD when kernel loader mode is enabled, with relevant comments and variable names updated accordingly.

Changes

Cohort / File(s) Change Summary
Kernel Loader Option & Environment Handling
src/dmtcp_launch.cpp
Introduced --kernel-loader CLI option, added enableKernelLoader flag, updated argument parsing, modified environment variable logic to use UH_PRELOAD when enabled, and revised comments for clarity.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant dmtcp_launch
    participant Kernel
    participant UpperHalfProgram

    User->>dmtcp_launch: Launch with --kernel-loader
    dmtcp_launch->>dmtcp_launch: Parse arguments, set enableKernelLoader = true
    dmtcp_launch->>Kernel: Set ADDR_NO_RANDOMIZE personality (if supported)
    dmtcp_launch->>dmtcp_launch: Set UH_PRELOAD environment variable
    dmtcp_launch->>UpperHalfProgram: Start with UH_PRELOAD
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Poem

A hop, a skip, a loader anew,
Kernel mode now in plain view!
UH_PRELOAD leaps in, LD steps aside,
With flags and logic neatly allied.
The bunny blinks, the launch is clear—
New options bloom, springtime is here! 🐇✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ded5ab4 and 86568d1.

📒 Files selected for processing (1)
  • src/dmtcp_launch.cpp (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/dmtcp_launch.cpp
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🔭 Outside diff range comments (1)
src/dmtcp_launch.cpp (1)

844-849: Fix inconsistent environment variable handling for 32-bit ELF.

There are two issues in the 32-bit ELF handling:

  1. Line 844 unconditionally sets LD_PRELOAD, which conflicts with kernel loader mode
  2. Lines 845-846 and 847-849 use preloadLibs instead of preloadLibs32

Apply this diff to fix the logic:

-    setenv("LD_PRELOAD", preloadLibs32.c_str(), 1);
-    if (enableKernelLoader) {
-      setenv("UH_PRELOAD", preloadLibs.c_str(), 1);
-    } else {
-      setenv("LD_PRELOAD", preloadLibs.c_str(), 1);
-    }
+    if (enableKernelLoader) {
+      setenv("UH_PRELOAD", preloadLibs32.c_str(), 1);
+    } else {
+      setenv("LD_PRELOAD", preloadLibs32.c_str(), 1);
+    }
🧹 Nitpick comments (1)
src/dmtcp_launch.cpp (1)

499-500: Fix grammatical error in the comment.

The comment has a subject-verb disagreement.

Apply this diff to fix the grammar:

-  // Test and set env var for FSGSBASE. The env var is used by plugins that uses
+  // Test and set env var for FSGSBASE. The env var is used by plugins that use
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b7fab64 and 7766090.

📒 Files selected for processing (1)
  • src/dmtcp_launch.cpp (4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (4)
src/dmtcp_launch.cpp (4)

140-144: LGTM! Clear and accurate usage documentation.

The usage message clearly describes the new --kernel-loader option's functionality and its effects on the environment setup.


185-186: LGTM! Variable declaration follows established patterns.

The enableKernelLoader variable is properly initialized and follows the same naming convention as other plugin flags in the codebase.


321-326: LGTM! Argument processing is correctly implemented.

The logic properly sets the enableKernelLoader flag and conditionally applies the ADDR_NO_RANDOMIZE personality based on kernel version support. The conditional compilation is consistent with the header includes.


829-833: LGTM! Correct environment variable handling for the main case.

The logic properly sets UH_PRELOAD when kernel loader mode is enabled, otherwise falls back to LD_PRELOAD.

Copy link
Copy Markdown
Contributor

@gc00 gc00 left a comment

Choose a reason for hiding this comment

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

See my request for more information.

@@ -836,11 +841,10 @@ setLDPreloadLibs(bool is32bitElf)
" ./configure --enable-m32 && make clean && make -j && "
"make install\n"
" ./configure && make clean && make -j && make install\n");
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.

I don't understand the use of preloadLibs32 instead of the original preloadLibs, below. I thought preloadLibs32 would be used only for the rare (almost obsolete) case of mixed 32-bit and 64-bit libraries. Perhaps if you added a comment or two here, this change would be clearer. Thanks.

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.

@xuyao0127 , Thanks for explaining this orally. LGTM.

Copy link
Copy Markdown
Contributor

@gc00 gc00 left a comment

Choose a reason for hiding this comment

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

LGTM.

@xuyao0127 xuyao0127 merged commit 28ebd1e into dmtcp:main Sep 17, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants