Summary: | panic: vfs_lookup: encountered unexpected nul; string when a symlink contains an embedded NUL | ||
---|---|---|---|
Product: | Base System | Reporter: | Alan Somers <asomers> |
Component: | kern | Assignee: | freebsd-bugs (Nobody) <bugs> |
Status: | Closed FIXED | ||
Severity: | Affects Some People | CC: | emaste, grahamperrin, mjg |
Priority: | --- | Keywords: | crash |
Version: | 15.0-CURRENT | Flags: | asomers:
mfc-stable14+
asomers: mfc-stable13+ asomers: mfc-stable12- |
Hardware: | Any | ||
OS: | Any | ||
URL: | https://reviews.freebsd.org/D42081 | ||
Bug Depends on: | |||
Bug Blocks: | 271607 |
Description
Alan Somers
2023-10-04 17:14:05 UTC
This behavior was introduced in d81aefa8b7dd8cbeffeda541fca9962802404983 . It's included in releases 13.1 and 13.2 and the upcoming 14.0. A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=662ec2f781521c36b76af748d74bb0a3c2e27a76 commit 662ec2f781521c36b76af748d74bb0a3c2e27a76 Author: Alan Somers <asomers@FreeBSD.org> AuthorDate: 2023-10-04 18:48:01 +0000 Commit: Alan Somers <asomers@FreeBSD.org> CommitDate: 2023-10-07 14:22:03 +0000 fusefs: sanitize FUSE_READLINK results for embedded NULs If VOP_READLINK returns a path that contains a NUL, it will trigger an assertion in vfs_lookup. Sanitize such paths in fusefs, rejecting any and warning the user about the misbehaving server. PR: 274268 MFC after: 1 week Sponsored by: Axcient Reviewed by: mjg, markj Differential Revision: https://reviews.freebsd.org/D42081 sys/fs/fuse/fuse_ipc.h | 1 + sys/fs/fuse/fuse_vnops.c | 7 +++++++ tests/sys/fs/fusefs/readlink.cc | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+) Per the discussion in the code review, we decided to leave vfs_lookup unchanged and fix the bug in fusefs instead. This means that the same bug could potentially happen in other file systems, like ext2fs. MFC to stable/12 is not required, as the crash isn't possible there. A commit in branch stable/14 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=8fca98f6881fdd68a786f4366c345159ab0df408 commit 8fca98f6881fdd68a786f4366c345159ab0df408 Author: Alan Somers <asomers@FreeBSD.org> AuthorDate: 2023-10-04 18:48:01 +0000 Commit: Alan Somers <asomers@FreeBSD.org> CommitDate: 2023-10-14 17:57:09 +0000 fusefs: sanitize FUSE_READLINK results for embedded NULs If VOP_READLINK returns a path that contains a NUL, it will trigger an assertion in vfs_lookup. Sanitize such paths in fusefs, rejecting any and warning the user about the misbehaving server. PR: 274268 Sponsored by: Axcient Reviewed by: mjg, markj Differential Revision: https://reviews.freebsd.org/D42081 (cherry picked from commit 662ec2f781521c36b76af748d74bb0a3c2e27a76) sys/fs/fuse/fuse_ipc.h | 1 + sys/fs/fuse/fuse_vnops.c | 7 +++++++ tests/sys/fs/fusefs/readlink.cc | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+) A commit in branch releng/14.0 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=0022bd418e6c0c7c767a296a3e0d3782e5137dce commit 0022bd418e6c0c7c767a296a3e0d3782e5137dce Author: Alan Somers <asomers@FreeBSD.org> AuthorDate: 2023-10-04 18:48:01 +0000 Commit: Alan Somers <asomers@FreeBSD.org> CommitDate: 2023-10-15 02:13:05 +0000 fusefs: sanitize FUSE_READLINK results for embedded NULs If VOP_READLINK returns a path that contains a NUL, it will trigger an assertion in vfs_lookup. Sanitize such paths in fusefs, rejecting any and warning the user about the misbehaving server. PR: 274268 Sponsored by: Axcient Approved by: gjb (re) Reviewed by: mjg, markj Differential Revision: https://reviews.freebsd.org/D42081 (cherry picked from commit 662ec2f781521c36b76af748d74bb0a3c2e27a76) (cherry picked from commit 8fca98f6881fdd68a786f4366c345159ab0df408) sys/fs/fuse/fuse_ipc.h | 1 + sys/fs/fuse/fuse_vnops.c | 7 +++++++ tests/sys/fs/fusefs/readlink.cc | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+) A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=ec3864cc68617edb106724a6d423b47ec455e31b commit ec3864cc68617edb106724a6d423b47ec455e31b Author: Alan Somers <asomers@FreeBSD.org> AuthorDate: 2023-10-04 18:48:01 +0000 Commit: Alan Somers <asomers@FreeBSD.org> CommitDate: 2023-10-15 13:02:07 +0000 fusefs: sanitize FUSE_READLINK results for embedded NULs If VOP_READLINK returns a path that contains a NUL, it will trigger an assertion in vfs_lookup. Sanitize such paths in fusefs, rejecting any and warning the user about the misbehaving server. PR: 274268 Sponsored by: Axcient Reviewed by: mjg, markj Differential Revision: https://reviews.freebsd.org/D42081 (cherry picked from commit 662ec2f781521c36b76af748d74bb0a3c2e27a76) sys/fs/fuse/fuse_ipc.h | 1 + sys/fs/fuse/fuse_vnops.c | 7 +++++++ tests/sys/fs/fusefs/readlink.cc | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+) |