Page MenuHomeFreeBSD

restore(8): Handle extended attribute names correctly
ClosedPublic

Authored by cem on Jan 17 2017, 4:51 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Dec 4, 11:11 AM
Unknown Object (File)
Wed, Dec 4, 11:11 AM
Unknown Object (File)
Wed, Dec 4, 11:11 AM
Unknown Object (File)
Wed, Dec 4, 10:51 AM
Unknown Object (File)
Sun, Dec 1, 11:59 PM
Unknown Object (File)
Sun, Dec 1, 11:59 PM
Unknown Object (File)
Sun, Dec 1, 11:59 PM
Unknown Object (File)
Sun, Dec 1, 11:43 PM
Subscribers
None

Details

Summary

UFS2 extended attribute names are not NUL-terminated. Handle
appropriately.

Correct the EXTATTR_BASE_LENGTH() macro, which handled ea_namelength ==
one (mod eight) extended attributes incorrectly.

PR: 216127
Reported by: dewayne at heuristicsystems.com.au
Sponsored by: Dell EMC Isilon

Test Plan
BEFORE

$ (cd mountp2 && sudo restore -rvf ../backup.dump )
Verify tape and initialize maps
Tape block size is 20
Dump   date: Wed Dec 31 16:00:00 1969
Dumped from: the epoch
Level 0 dump of an unlisted file system on wklptp:/dev/md0
Label: none
Begin level 0 restore
Initialize symbol table.
Extract directories from tape
Calculate extraction list.
warning: ./.snap: File exists
Extract new leaves.
Checkpointing the restore
extract file ./file-ext
Set attributes for ./file-ext:
        system, (16 bytes), mAAAAAAA (unable to set)
                            ^^^^^^^^
        system, (24 bytes), m12345678BBBBBBB (unable to set)
                            ^^^^^^^^^^^^^^^^
Add links
Set directory mode, owner, and times.
Check the symbol table.
Checkpointing the restore
...

AFTER

$ (cd mountp2 && sudo restore -rvf ../backup.dump )
Verify tape and initialize maps
Tape block size is 20
Dump   date: Wed Dec 31 16:00:00 1969
Dumped from: the epoch
Level 0 dump of an unlisted file system on wklptp:/dev/md0
Label: none
Begin level 0 restore
Initialize symbol table.
Extract directories from tape
Calculate extraction list.
warning: ./.snap: File exists
Extract new leaves.
Checkpointing the restore
extract file ./file-ext
Set attributes for ./file-ext:
        system, (16 bytes), m
        system, (24 bytes), m12345678
                            ^^^^^^^^^
Add links
Set directory mode, owner, and times.
Check the symbol table.
Checkpointing the restore

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

cem retitled this revision from to restore(8): Handle extended attribute names correctly.
cem updated this object.
cem edited the test plan for this revision. (Show Details)
cem added reviewers: mckusick, kib.
kib edited edge metadata.
kib added inline comments.
sys/ufs/ufs/extattr.h
100 โ†—(On Diff #24102)

This is the meat of the change, the -1 is there to compensate the ea_name[1]. Might be either comment about this or switch to the flexible array for ea_name.

This revision is now accepted and ready to land.Jan 17 2017, 11:25 AM
sys/ufs/ufs/extattr.h
100 โ†—(On Diff #24102)

Do you have a preference? I guess ea_name[1] was used in 2007 because flexible array wasn't available at the time.

This revision was automatically updated to reflect the committed changes.