NetBSD-Bugs archive

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

Re: kern/51393: Reproducible KASSERT in UVM



The following reply was made to PR kern/51393; it has been noted by GNATS.

From: Michael van Elst <mlelstv%serpens.de@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: kern/51393: Reproducible KASSERT in UVM
Date: Sun, 29 Apr 2018 19:22:45 +0200

 This patch:
 
 Index: uvm_mmap.c
 ===================================================================
 RCS file: /cvsroot/src/sys/uvm/uvm_mmap.c,v
 retrieving revision 1.169
 diff -p -u -r1.169 uvm_mmap.c
 --- uvm_mmap.c  19 Dec 2017 18:34:47 -0000      1.169
 +++ uvm_mmap.c  29 Apr 2018 17:16:50 -0000
 @@ -896,7 +896,9 @@ uvm_mmap(struct vm_map *map, vaddr_t *ad
          */
  
         if ((flags & MAP_FIXED) == 0) {
 -               *addr = round_page(*addr);
 +               vaddr_t naddr;
 +               naddr = round_page(*addr);
 +               *addr = naddr < *addr ? trunc_page(*addr) : naddr;
         } else {
                 if (*addr & PAGE_MASK)
                         return EINVAL;
 
 stops the panic by ensuring that rounding the hint doesn't wrap.
 
 But I'm wondering why the address hint is actually rounded (up). It's
 probably more correct to truncate for topdown allocation and to round up
 for !topdown allocation. This should also prevent the issue.
 
 
 
 Greetings,
 -- 
                                 Michael van Elst
 Internet: mlelstv%serpens.de@localhost
                                 "A potential Snark may lurk in every tree."
 


Home | Main Index | Thread Index | Old Index