git: kernel - Relax requirements for sysctl operations on longs

Matthew Dillon dillon at crater.dragonflybsd.org
Sun Dec 17 21:49:55 PST 2017


commit 83ed56857dc47610d1c0156612e06093364d3509
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Sun Dec 17 21:45:34 2017 -0800

    kernel - Relax requirements for sysctl operations on longs
    
    * Relax the requirements for sysctl operations on longs.  Allow the
      case where userland is reading the sysctl variable as an integer
      instead of a long.
    
    * Allows us to promote various vm.stats.vm_* fields that must now be
      longs in order to support > 8TB of ram as well as avoid internal
      calculation overflows.
    
    * Fixes an issue where chrome issues this sysctl as an int:
    
      sysctlbyname("vm.stats.vm.v_page_count", &pages, &size, NULL, 0);
    
      And fails to check the return value / error code, resulting in
      a garbage value for 'pages' which chrome then uses to size the
      browser's memory restrains.  This in turn was causing chrome
      to give up multiple tabs thinking it had run out of memory when,
      in fact, there is plenty of memory available.
    
    * Generally speaking, I've wanted to have this sort of backwards
      compatibility for a while now.  Userland shouldn't get errors
      accesing integral sysctl values simply because it uses an integer
      of a different size than the sysctl.

Summary of changes:
 sys/kern/kern_sysctl.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/83ed56857dc47610d1c0156612e06093364d3509


-- 
DragonFly BSD source repository


More information about the Commits mailing list