Page MenuHomeFreeBSD

usr.sbin/makefs: fix use-after-free in read_mtree_keywords()
ClosedPublic

Authored by arichardson on Feb 10 2021, 12:07 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Jul 22, 11:39 AM
Unknown Object (File)
Mon, Jul 20, 1:37 AM
Unknown Object (File)
Sun, Jul 19, 11:07 PM
Unknown Object (File)
Sun, Jul 19, 12:17 PM
Unknown Object (File)
Sat, Jul 18, 1:45 AM
Unknown Object (File)
Mon, Jul 13, 4:50 AM
Unknown Object (File)
Mon, Jul 13, 4:49 AM
Unknown Object (File)
Sat, Jul 4, 11:05 AM
Subscribers

Details

Summary

The st variable is used as a shortcut for &node->inode->st, but in one
branch just before the exit we update node->inode without changing st.

Not sure which of the two approaches is preferable

Reported by: AddressSanitizer

Test Plan

ASan no longer complains.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 36860
Build 33749: arc lint + arc unit

Event Timeline

usr.sbin/makefs/mtree.c
786–787

I think I like this one slightly better

LGTM. I'd probably not use "avoid UAF" in the comment though, we are resetting st because it has been invalidated by freeing node->inode

This revision is now accepted and ready to land.Feb 10 2021, 3:07 PM

Update comment and use first approach

This revision now requires review to proceed.Feb 10 2021, 3:12 PM
This revision is now accepted and ready to land.Feb 10 2021, 3:13 PM