Conversation
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>
|
π 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
π‘οΈ 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.PR created automatically by Jules for task 10380662204608335638 started by @kassoulet