Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 May 2025 00:42:25 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: e36f069ecb47 - main - fsck_ffs: change struct bufarea member b_index type to uint64_t
Message-ID:  <202505270042.54R0gPfr073619@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=e36f069ecb478b9775b7ad717768d011251d479e

commit e36f069ecb478b9775b7ad717768d011251d479e
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2025-05-25 18:11:58 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-05-27 00:42:03 +0000

    fsck_ffs: change struct bufarea member b_index type to uint64_t
    
    It needs to correctly participate in the inode numbers arithmetic.
    It is possible to have inode number that is negative if truncated to 32
    bit, which causes OOB accesses in ginode() calculating inode location in
    the inode block:
            ip->i_dp = (union dinode *)
                &ip->i_bp->b_un.b_dinode2[inumber - ip->i_bp->b_index];
    
    Tested by:      pho
    Reviewed by:    mckusick
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D50520
---
 sbin/fsck_ffs/fsck.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sbin/fsck_ffs/fsck.h b/sbin/fsck_ffs/fsck.h
index 32d1d93e05c8..aaf02850f29a 100644
--- a/sbin/fsck_ffs/fsck.h
+++ b/sbin/fsck_ffs/fsck.h
@@ -153,7 +153,7 @@ struct bufarea {
 	int b_flags;				/* B_ flags below */
 	int b_type;				/* BT_ type below */
 	int b_refcnt;				/* ref count of users */
-	int b_index;				/* for BT_LEVEL, ptr index */
+	uint64_t b_index;			/* for BT_LEVEL, ptr index */
 						/* for BT_INODES, first inum */
 	union {
 		char *b_buf;			/* buffer space */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202505270042.54R0gPfr073619>