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)
Tue, Jul 2, 8:40 AM
Unknown Object (File)
Sat, Jun 29, 5:39 AM
Unknown Object (File)
Fri, Jun 28, 10:10 PM
Unknown Object (File)
Fri, Jun 28, 8:14 PM
Unknown Object (File)
Fri, Jun 28, 6:41 PM
Unknown Object (File)
Thu, Jun 27, 11:14 PM
Unknown Object (File)
Fri, Jun 21, 10:57 PM
Unknown Object (File)
Thu, Jun 6, 3:59 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.