bin/64991: malloc(3) crashes with some large parameters

JINMEI Tatuya jinmei at isl.rdc.toshiba.co.jp
Wed Mar 31 05:00:31 PST 2004


>Number:         64991
>Category:       bin
>Synopsis:       malloc(3) crashes with some large parameters
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Mar 31 05:00:30 PST 2004
>Closed-Date:
>Last-Modified:
>Originator:     JINMEI Tatuya
>Release:        FreeBSD 4.9-RELEASE i386
>Organization:
the KAME Project
>Environment:
System: FreeBSD ocean.jinmei.org 4.9-RELEASE FreeBSD 4.9-RELEASE #22: Wed Mar 10 21:19:49 JST 2004 jinmei at ocean.jinmei.org:/home/jinmei/src/kame/kame/freebsd4/sys/compile/SS2010_SCTP i386

Toshiba Portege 2000
FreeBSD 4.9 (with some recent KAME snaps, which should not matter though)

>Description:

malloc(3) dumps core for large size parameters around 0xffff0000.


>How-To-Repeat:

Compile the following code and execute it.  Then something similar to the
following should happen:
% ./foo
malloc: Cannot allocate memory
zsh: 2153 segmentation fault (core dumped)  ./foo

#include <sys/types.h>
#include <sys/param.h>

#include <stdio.h>
#include <stdlib.h>

main()
{
	char *p;

	p = (char *)malloc(0x8fff0000);
	if (p == NULL)
		perror("malloc");
	else
		free(p);

	p = (char *)malloc(0xffff0000);
	if (p == NULL)
		perror("malloc");

	exit(0);
}

>Fix:

I don't have one.

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list