Skip to content

πŸ›‘οΈ Sentinel: Fix SIGBUS crash on hard-linked output files#5

Merged
kassoulet merged 1 commit intomainfrom
sentinel-hardlink-fix-sigbus-10380662204608335638
Apr 2, 2026
Merged

πŸ›‘οΈ Sentinel: Fix SIGBUS crash on hard-linked output files#5
kassoulet merged 1 commit intomainfrom
sentinel-hardlink-fix-sigbus-10380662204608335638

Conversation

@kassoulet
Copy link
Copy Markdown
Owner

πŸ›‘οΈ Sentinel: [CRITICAL] Fix SIGBUS crash on hard-linked output files

🚨 Severity: CRITICAL
πŸ’‘ Vulnerability: Application crash (SIGBUS) when output file is a hard link to input file.
🎯 Impact: Denial of service or application failure when processing bzip2 files. Truncating a memory-mapped file triggers a Bus error.
πŸ”§ Fix: Enhanced the file identity check to compare device and inode numbers on Unix systems.
βœ… Verification: Ran a reproduction script (test_hardlink.sh) which previously caused a SIGBUS and now results in a clean error message.

ln input.bz2 output.bz2
bz2zstd input.bz2 -o output.bz2
# Before: Bus error (SIGBUS)
# After: Error: Input and output files must be different: "output.bz2"

PR created automatically by Jules for task 10380662204608335638 started by @kassoulet

Identify and prevent input/output file collisions caused by hard links
on Unix systems. Previously, bz2zstd only checked canonical paths,
missing cases where different paths pointed to the same inode.
Truncating such a file while it is memory-mapped for input triggers
a SIGBUS (Bus error).

- Added device and inode comparison using `std::os::unix::fs::MetadataExt`.
- Maintained existing canonical path check for cross-platform support.
- Encapsulated logic in a clean closure with appropriate error handling.

Verified with a reproduction script that formerly triggered SIGBUS.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

πŸ‘‹ Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a πŸ‘€ emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@kassoulet kassoulet merged commit 4791925 into main Apr 2, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant