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)
Feb 10 2024, 4:51 PM
Unknown Object (File)
Dec 26 2023, 3:26 AM
Unknown Object (File)
Dec 23 2023, 2:43 AM
Unknown Object (File)
Nov 3 2023, 11:24 AM
Unknown Object (File)
Oct 4 2023, 12:23 PM
Unknown Object (File)
Aug 30 2023, 2:48 AM
Unknown Object (File)
Aug 27 2023, 1:14 AM
Unknown Object (File)
Aug 26 2023, 5:12 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.