Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 May 2001 10:44:54 -0700 (PDT)
From:      Jim.Pirzyk@disney.com
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   kern/27350: /compat/linux/proc/meminfo has size overflows.
Message-ID:  <200105151744.f4FHis214465@snoopy.fan.fa.disney.com>

next in thread | raw e-mail | index | archive | help

>Number:         27350
>Category:       kern
>Synopsis:       /compat/linux/proc/meminfo has size overflow
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue May 15 10:50:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Jim Pirzyk
>Release:        FreeBSD 4.3-RELEASE i386
>Organization:
>Environment:
System: FreeBSD snoopy.fan.fa.disney.com 4.3-RELEASE FreeBSD 4.3-RELEASE #4: Fri Apr 27 01:14:59 PDT 2001 root@snoopy.fan.fa.disney.com:/auto/roy/dist/pub/FreeBSD/4.3-RELEASE/sys/compile/UP_WORKSTATION i386


	
>Description:
	A FreeBSD system with 5GB of swap space

Jim.Pirzyk@render001:/usr/local/lsf/etc
48>pstat -sk
Device          1K-blocks     Used    Avail Capacity  Type
/dev/da0s1b       5242752        0  5242752     0%    Interleaved

	But /compat/linux/proc/meminfo only shows us 1GB:

Jim.Pirzyk@render001:/sys/modules/linprocfs
17>cat /compat/linux/proc/meminfo 
Mem:  2413268992 40722432 2372546560 2891776 0 32768
Swap: 1073741824 131072 1073610752
MemTotal:   2356708 kB
MemFree:    2316940 kB
MemShared:     2824 kB
Buffers:          0 kB
Cached:          32 kB
SwapTotal:  1048576 kB
SwapFree:   1048448 kB

>How-To-Repeat:
>Fix:

*** ./sys/i386/linux/linprocfs/linprocfs_misc.c.orig	Thu Dec  7 05:17:55 2000
--- ./sys/i386/linux/linprocfs/linprocfs_misc.c	Tue May 15 10:35:34 2001
***************
*** 92,100 ****
  	unsigned long memfree;		/* free memory in bytes */
  	unsigned long memshared;	/* shared memory ??? */
  	unsigned long buffers, cached;	/* buffer / cache memory ??? */
! 	unsigned long swaptotal;	/* total swap space in bytes */
! 	unsigned long swapused;		/* used swap space in bytes */
! 	unsigned long swapfree;		/* free swap space in bytes */
  	vm_object_t object;
  
  	if (uio->uio_rw != UIO_READ)
--- 92,100 ----
  	unsigned long memfree;		/* free memory in bytes */
  	unsigned long memshared;	/* shared memory ??? */
  	unsigned long buffers, cached;	/* buffer / cache memory ??? */
! 	unsigned long long swaptotal;	/* total swap space in bytes */
! 	unsigned long long swapused;		/* used swap space in bytes */
! 	unsigned long long swapfree;		/* free swap space in bytes */
  	vm_object_t object;
  
  	if (uio->uio_rw != UIO_READ)
***************
*** 117,124 ****
  		swaptotal = 0;
  		swapfree = 0;
  	} else {
! 		swaptotal = swapblist->bl_blocks * 1024; /* XXX why 1024? */
! 		swapfree = swapblist->bl_root->u.bmu_avail * PAGE_SIZE;
  	}
  	swapused = swaptotal - swapfree;
  	memshared = 0;
--- 117,124 ----
  		swaptotal = 0;
  		swapfree = 0;
  	} else {
! 		swaptotal = (unsigned long long) swapblist->bl_blocks * 1024ULL; /* XXX why 1024? */
! 		swapfree = (unsigned long long) swapblist->bl_root->u.bmu_avail * PAGE_SIZE;
  	}
  	swapused = swaptotal - swapfree;
  	memshared = 0;
***************
*** 142,155 ****
  	ps += sprintf(ps,
  		"        total:    used:    free:  shared: buffers:  cached:\n"
  		"Mem:  %lu %lu %lu %lu %lu %lu\n"
! 		"Swap: %lu %lu %lu\n"
  		"MemTotal: %9lu kB\n"
  		"MemFree:  %9lu kB\n"
  		"MemShared:%9lu kB\n"
  		"Buffers:  %9lu kB\n"
  		"Cached:   %9lu kB\n"
! 		"SwapTotal:%9lu kB\n"
! 		"SwapFree: %9lu kB\n",
  		memtotal, memused, memfree, memshared, buffers, cached,
  		swaptotal, swapused, swapfree,
  		B2K(memtotal), B2K(memfree),
--- 142,155 ----
  	ps += sprintf(ps,
  		"        total:    used:    free:  shared: buffers:  cached:\n"
  		"Mem:  %lu %lu %lu %lu %lu %lu\n"
! 		"Swap: %llu %llu %llu\n"
  		"MemTotal: %9lu kB\n"
  		"MemFree:  %9lu kB\n"
  		"MemShared:%9lu kB\n"
  		"Buffers:  %9lu kB\n"
  		"Cached:   %9lu kB\n"
! 		"SwapTotal:%9llu kB\n"
! 		"SwapFree: %9llu kB\n",
  		memtotal, memused, memfree, memshared, buffers, cached,
  		swaptotal, swapused, swapfree,
  		B2K(memtotal), B2K(memfree),
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200105151744.f4FHis214465>