git: a04f2d46dda2 - stable/14 - extattr_list*: avoid panic with absurd buffer lengths
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 16 Nov 2026 18:12:48 UTC
The branch stable/14 has been updated by brooks:
URL: https://cgit.FreeBSD.org/src/commit/?id=a04f2d46dda2d9f3b9ef9409d47dbc097cfb9b3f
commit a04f2d46dda2d9f3b9ef9409d47dbc097cfb9b3f
Author: Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2026-11-13 10:06:52 +0000
Commit: Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2026-11-16 15:57:41 +0000
extattr_list*: avoid panic with absurd buffer lengths
Apply a layered defence:
- Reject nbytes > IOSIZE_MAX in user_extattr_list_fd and
user_extattr_list_path.
- In extattr_list_vp require auiop->uio_resid to be non-negative.
Effort: CHERI upstreaming
Reviewed by: markj
Reported by: llm-postcr
MFC after: 3 days
Sponsored by: Innovate UK
Fixes: 6453d4240f6b ("vfs: Export exattr methods to reuse by Linuxulator")
Differential Revision: https://reviews.freebsd.org/D61461
(cherry picked from commit 118067f51c111390dbc54760d781cd14a10c499e)
---
sys/kern/vfs_extattr.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c
index 831090f02f90..9241e0984559 100644
--- a/sys/kern/vfs_extattr.c
+++ b/sys/kern/vfs_extattr.c
@@ -694,7 +694,7 @@ extattr_list_vp(struct vnode *vp, int attrnamespace, struct uio *auiop,
sizep = NULL;
cnt = 0;
if (auiop != NULL) {
- if (auiop->uio_resid > IOSIZE_MAX)
+ if (auiop->uio_resid < 0 || auiop->uio_resid > IOSIZE_MAX)
return (EINVAL);
cnt = auiop->uio_resid;
} else
@@ -736,6 +736,9 @@ sys_extattr_list_fd(struct thread *td, struct extattr_list_fd_args *uap)
struct uio auio, *auiop;
struct iovec aiov;
+ if (uap->nbytes > IOSIZE_MAX)
+ return (EINVAL);
+
if (uap->data != NULL) {
aiov.iov_base = uap->data;
aiov.iov_len = uap->nbytes;
@@ -814,6 +817,9 @@ user_extattr_list_path(struct thread *td, const char *path, int attrnamespace,
struct uio auio, *auiop;
struct iovec aiov;
+ if (nbytes > IOSIZE_MAX)
+ return (EINVAL);
+
if (data != NULL) {
aiov.iov_base = data;
aiov.iov_len = nbytes;