untrusted comment: verify with openbsd-79-base.pub RWTSdNN9A3yvWBWmINpVZKws2W8hF5jCix2Zjm+c8YTYk6Q2dnL+zcSyR8fOs+P5GW4k7EM+FT1iPhHn24/Vqc6tBE4bj5lCbQI= OpenBSD 7.9 errata 018, September 14, 2026: Prevent integer overflow in shmat(4). Apply by doing: signify -Vep /etc/signify/openbsd-79-base.pub -x 018_shmat.patch.sig \ -m - | (cd /usr/src && patch -p0) And then rebuild and install a new kernel: KK=`sysctl -n kern.osversion | cut -d# -f1` cd /usr/src/sys/arch/`machine`/compile/$KK make obj make config make make install Index: sys/uvm/uvm_aobj.c =================================================================== RCS file: /cvs/src/sys/uvm/uvm_aobj.c,v diff -u -p -r1.122 uvm_aobj.c --- sys/uvm/uvm_aobj.c 11 Feb 2026 22:34:40 -0000 1.122 +++ sys/uvm/uvm_aobj.c 7 Sep 2026 20:37:38 -0000 @@ -951,6 +951,32 @@ uao_flush(struct uvm_object *uobj, voff_ } /* + * PGO_ALLPAGES makes every requested page mandatory; otherwise only + * centeridx must remain within the object, because adjacent pages are + * fault clustering candidates rather than required fetches. Validate + * this distinction before allocation because pageidx directly indexes + * swap metadata; an out of range value can therefore access storage + * beyond the object's extent. + */ +static inline int +uao_get_validate(struct uvm_aobj *aobj, voff_t firstpage, int maxpages, + int centeridx, int flags) +{ + if (maxpages <= 0 || + firstpage < 0 || + firstpage >= (voff_t)aobj->u_pages) + return 0; + + if (flags & PGO_ALLPAGES) + return (voff_t)maxpages <= + (voff_t)aobj->u_pages - firstpage; + + return centeridx >= 0 && + centeridx < maxpages && + (voff_t)centeridx < (voff_t)aobj->u_pages - firstpage; +} + +/* * uao_get: fetch me a page * * we have three cases: @@ -972,7 +998,7 @@ uao_get(struct uvm_object *uobj, voff_t int *npagesp, int centeridx, vm_prot_t access_type, int advice, int flags) { struct uvm_aobj *aobj = (struct uvm_aobj *)uobj; - voff_t current_offset; + voff_t current_offset, firstpage; vm_page_t ptmp; int lcv, gotpages, maxpages, swslot, rv, pageidx; boolean_t done; @@ -986,6 +1012,13 @@ uao_get(struct uvm_object *uobj, voff_t * get number of pages */ maxpages = *npagesp; + firstpage = offset >> PAGE_SHIFT; + if (!uao_get_validate(aobj, firstpage, maxpages, centeridx, flags)) { + *npagesp = 0; + if ((flags & PGO_LOCKED) == 0) + rw_exit(uobj->vmobjlock); + return VM_PAGER_BAD; + } if (flags & PGO_LOCKED) { /* @@ -1049,7 +1082,7 @@ uao_get(struct uvm_object *uobj, voff_t (lcv != centeridx && (flags & PGO_ALLPAGES) == 0)) continue; - pageidx = current_offset >> PAGE_SHIFT; + pageidx = firstpage + lcv; /* * we have yet to locate the current page (pps[lcv]). we