git: bb48aba6244c - releng/13.4 - cd9660: Make sure that struct ifid fits in generic filehandle structure
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 29 Jan 2025 18:55:27 UTC
The branch releng/13.4 has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=bb48aba6244c10236590b49e43fe90daab6a55fa
commit bb48aba6244c10236590b49e43fe90daab6a55fa
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-12-06 02:03:59 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2025-01-29 17:01:33 +0000
cd9660: Make sure that struct ifid fits in generic filehandle structure
File system specific *fid structures are copied into the generic
struct fid defined in sys/mount.h.
As such, they cannot be larger than struct fid.
This patch packs the structure and checks via a __Static_assert().
Approved by: so
Security: FreeBSD-SA-25:02.fs
Reported by: Kevin Miller <mas@0x194.net>
Reviewed by: olce, imp, kib, emaste
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D47879
(cherry picked from commit 205659c43d87bd42c4a0819fde8f81e8ebba068e)
(cherry picked from commit cd597b4bb194f7a0bd756b5299b40ad3607b1baf)
---
sys/fs/cd9660/cd9660_vnops.c | 3 +++
sys/fs/cd9660/iso.h | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/sys/fs/cd9660/cd9660_vnops.c b/sys/fs/cd9660/cd9660_vnops.c
index 9598ecdd7712..60b33fa9a493 100644
--- a/sys/fs/cd9660/cd9660_vnops.c
+++ b/sys/fs/cd9660/cd9660_vnops.c
@@ -826,6 +826,9 @@ cd9660_pathconf(ap)
/* NOTREACHED */
}
+_Static_assert(sizeof(struct ifid) <= sizeof(struct fid),
+ "struct ifid must be no larger than struct fid");
+
/*
* Vnode pointer to File handle
*/
diff --git a/sys/fs/cd9660/iso.h b/sys/fs/cd9660/iso.h
index bf98e75c42d9..b54f5f8e5cf4 100644
--- a/sys/fs/cd9660/iso.h
+++ b/sys/fs/cd9660/iso.h
@@ -269,7 +269,7 @@ struct ifid {
u_short ifid_pad;
cd_ino_t ifid_ino;
long ifid_start;
-};
+} __packed;
#define VFSTOISOFS(mp) ((struct iso_mnt *)((mp)->mnt_data))