Page MenuHomeFreeBSD

FFS extattr: fix handling of the tail
ClosedPublic

Authored by kib on Mar 1 2021, 3:33 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Nov 12, 8:35 PM
Unknown Object (File)
Wed, Nov 6, 12:44 PM
Unknown Object (File)
Oct 2 2024, 7:23 PM
Unknown Object (File)
Oct 2 2024, 5:12 PM
Unknown Object (File)
Oct 2 2024, 5:55 AM
Unknown Object (File)
Oct 2 2024, 4:11 AM
Unknown Object (File)
Oct 2 2024, 2:39 AM
Unknown Object (File)
Oct 1 2024, 10:10 PM
Subscribers
None

Details

Summary

There are three issues with change that stopped truncating ea area before write, and resulted in possible zero tail in the area:

  • Truncate to zero checked i_ea_len after the reference was dropped, making the last drop effectively truncate to zero length always.
  • Loop to fill uio for zeroing specified too large length.
  • Integrity check could trip over the tail, instead we must allow partial header or header with zero length, and chomp ea at it.

Fixup: 5e198e7646a27412c0541719f7bf1bbc0bd89223

Test Plan

Test case looks like this:

mdconfig -a -t swap -s 32m
newfs -U /dev/md0
mount /dev/md0 /mnt
touch /mnt/foo

setextattr user a aaaa /mnt/foo
setextattr user b bbbb /mnt/foo
setextattr user c cccc /mnt/foo

rmextattr user c /mnt/foo
lsextattr user /mnt/foo

getextattr user a /mnt/foo
getextattr user b /mnt/foo

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

kib requested review of this revision.Mar 1 2021, 3:33 PM
kib created this revision.

I can confirm that this fixes the failing tests for me: /usr/tests/usr.sbin/extattr # env TMPDIR=/root/tmp kyua test

I ran your test scenario plus the five other extattr scenarios I already had. LGTM.

This revision was not accepted when it landed; it landed in state Needs Review.Mar 2 2021, 12:20 AM
This revision was automatically updated to reflect the committed changes.

Sorry for the delayed review. This change looks correct to me.