Page MenuHomeFreeBSD

lookup(): ensure that openat("/", "..", O_RESOLVE_BENEATH) fails
ClosedPublic

Authored by kib on Apr 23 2023, 11:24 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Feb 11, 1:01 AM
Unknown Object (File)
Sun, Feb 11, 1:00 AM
Unknown Object (File)
Sun, Feb 11, 1:00 AM
Unknown Object (File)
Sun, Feb 11, 12:59 AM
Unknown Object (File)
Sat, Feb 10, 12:00 PM
Unknown Object (File)
Jan 14 2024, 7:12 AM
Unknown Object (File)
Jan 8 2024, 4:56 PM
Unknown Object (File)
Dec 23 2023, 12:36 AM
Subscribers

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kib requested review of this revision.Apr 23 2023, 11:24 PM
emaste added inline comments.
sys/kern/vfs_lookup.c
1087

Incidentally I think STRICTRELATIVE is slightly confusing now (as of 7359fdcf5ffa). Previously ni_strictrelative meant /* relative lookup only; no '..' */ - i.e., the "strict" part referred to disallowing ... (Unrelated to this review.)

This revision is now accepted and ready to land.Apr 24 2023, 1:17 PM
sys/kern/vfs_lookup.c
1086–1095

Do we really want to prohibit lookups in the (v_flag & VV_ROOT) && (cn_flags & NOCROSSMOUNT) case?

1090

This is redundant. If we break, then pr != NULL, and the next if-statement will handle it.

sys/kern/vfs_lookup.c
1087

This thought seemed familiar to me, and I found my forgotten D28445 again. Will take another look.

kib marked 2 inline comments as done.Apr 24 2023, 2:23 PM
kib added inline comments.
sys/kern/vfs_lookup.c
1086–1095

I think it does not matter. NOCROSSMOUNT is strictly nfs server option, which does not use BENEATH. But ok, let me restructure code some more.

kib marked an inline comment as done.

Drop the jail checks.
Exclude NOCROSSMOUNT lookups.

This revision now requires review to proceed.Apr 24 2023, 2:59 PM
markj added inline comments.
sys/kern/vfs_lookup.c
1088

The indentation here is wrong.

This revision is now accepted and ready to land.Apr 24 2023, 3:04 PM