Page MenuHomeFreeBSD

FFS extattr: fix handling of the tail
ClosedPublic

Authored by kib on Mar 1 2021, 3:33 PM.

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
R10 FreeBSD src repository
Lint
Lint Skipped
Unit
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.