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)
Tue, Apr 29, 1:38 AM
Unknown Object (File)
Sat, Apr 19, 5:00 AM
Unknown Object (File)
Tue, Apr 15, 10:29 AM
Unknown Object (File)
Tue, Apr 8, 1:06 AM
Unknown Object (File)
Mar 15 2025, 11:10 PM
Unknown Object (File)
Mar 14 2025, 3:08 PM
Unknown Object (File)
Mar 6 2025, 12:51 AM
Unknown Object (File)
Mar 5 2025, 12:07 PM
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
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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