Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/uvm Avoid undefined behavior in uao_pagein_page(). Found...



details:   https://anonhg.NetBSD.org/src/rev/472926834e10
branches:  trunk
changeset: 458043:472926834e10
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Sun Jul 28 05:28:53 2019 +0000

description:
Avoid undefined behavior in uao_pagein_page(). Found by kUBSan. OK'd by
 riastradh. I think this is a real bug on amd64 at least.

diffstat:

 sys/uvm/uvm_aobj.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 583d65e73cf6 -r 472926834e10 sys/uvm/uvm_aobj.c
--- a/sys/uvm/uvm_aobj.c        Sun Jul 28 03:09:24 2019 +0000
+++ b/sys/uvm/uvm_aobj.c        Sun Jul 28 05:28:53 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_aobj.c,v 1.127 2018/05/28 21:04:35 chs Exp $       */
+/*     $NetBSD: uvm_aobj.c,v 1.128 2019/07/28 05:28:53 msaitoh Exp $   */
 
 /*
  * Copyright (c) 1998 Chuck Silvers, Charles D. Cranor and
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_aobj.c,v 1.127 2018/05/28 21:04:35 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_aobj.c,v 1.128 2019/07/28 05:28:53 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_uvmhist.h"
@@ -1342,7 +1342,7 @@
        npages = 1;
 
        KASSERT(mutex_owned(uobj->vmobjlock));
-       rv = uao_get(uobj, pageidx << PAGE_SHIFT, &pg, &npages,
+       rv = uao_get(uobj, (voff_t)pageidx << PAGE_SHIFT, &pg, &npages,
            0, VM_PROT_READ | VM_PROT_WRITE, 0, PGO_SYNCIO);
 
        /*



Home | Main Index | Thread Index | Old Index