Page MenuHomeFreeBSD

Handle truncation while processing a file
ClosedPublic

Authored by darius-dons.net.au on Apr 23 2015, 3:05 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 27, 4:23 PM
Unknown Object (File)
Thu, Apr 24, 7:03 AM
Unknown Object (File)
Tue, Apr 22, 9:02 AM
Unknown Object (File)
Wed, Apr 16, 8:38 PM
Unknown Object (File)
Mon, Apr 14, 6:32 AM
Unknown Object (File)
Mon, Apr 14, 5:23 AM
Unknown Object (File)
Mon, Apr 14, 3:08 AM
Unknown Object (File)
Jan 31 2025, 11:27 AM
Subscribers

Details

Reviewers
ngie
delphij
Group Reviewers
security
Summary

If the file is truncated during processing the loop will spin forever.

See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=196694

Test Plan

I put a break point in the loop and truncated the file, previously it would spin forever, with the change it doesn't.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

darius-dons.net.au retitled this revision from to Handle truncation while processing a file.
darius-dons.net.au updated this object.
darius-dons.net.au edited the test plan for this revision. (Show Details)
darius-dons.net.au added a reviewer: ngie.
darius-dons.net.au set the repository for this revision to rS FreeBSD src repository - subversion.
ngie edited edge metadata.

Based on internal testing done and the fact that this change is shipping in current versions of OneFS, I say, ShipIt!

This revision is now accepted and ready to land.Apr 23 2015, 3:37 AM
delphij added a reviewer: delphij.
delphij added a subscriber: delphij.

Looks good to me, the code should take read(2) returning 0 as a signal for breaking the loop.

Committed as r281928 -- thank you!