Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 24 Jan 2026 00:32:31 +0000
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 102400e5d07a - stable/15 - swap_pager_getpages(): assert that bp->b_pages[] is accessed in bounds
Message-ID:  <6974131f.b91a.1e8fee1e@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch stable/15 has been updated by kib:

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

commit 102400e5d07a901e0b55a3645b6708e509000ff0
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-01-11 11:04:01 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-01-24 00:26:45 +0000

    swap_pager_getpages(): assert that bp->b_pages[] is accessed in bounds
    
    (cherry picked from commit b02ddb59e64620733a6cbc48fb1d0583a62fef78)
---
 sys/vm/swap_pager.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c
index efb0dd477c93..012d89db3310 100644
--- a/sys/vm/swap_pager.c
+++ b/sys/vm/swap_pager.c
@@ -1396,6 +1396,9 @@ swap_pager_getpages_locked(struct pctrie_iter *blks, vm_object_t object,
 	vm_object_prepare_buf_pages(object, bp->b_pages, count, &rbehind,
 	    &rahead, ma);
 	bp->b_npages = rbehind + count + rahead;
+	KASSERT(bp->b_npages <= PBUF_PAGES,
+	    ("bp_npages %d (rb %d c %d ra %d) not less than PBUF_PAGES %jd",
+	    bp->b_npages, rbehind, count, rahead, (uintmax_t)PBUF_PAGES));
 	for (int i = 0; i < bp->b_npages; i++)
 		bp->b_pages[i]->oflags |= VPO_SWAPINPROG;
 	bp->b_blkno = swp_pager_meta_lookup(blks, pindex - rbehind);


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6974131f.b91a.1e8fee1e>