summaryrefslogtreecommitdiff
path: root/src/lib/libc/stdlib/malloc.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Fix the second malloc_ulimit regression: maintaining the free listotto2006-05-141-3/+12
| | | | | | requires memory; try to make sure we have it. If all fails, leak instead of crash. Test case originally found by cloder@, fix tested by many.
* Do not leave an hole in the directory list if allocation of theotto2006-04-241-11/+32
| | | | | | | region succeeds, but allocation a required page dir failed. This can happen if we're really close to ulimit after allocation the region of the size requested. See malloc_ulimit1 regress test. Tested by many; thanks.
* delint; original from deraadt@ with fixes from tdeval@ and me;otto2006-04-181-43/+60
| | | | tested by quite a few developers. ok deraadt@
* quick path for free(0)espie2006-02-141-5/+5
| | | | `looks to be safe' millert, okay tedu.
* Remove a few warnings. Those were not apparent thanks to a bug in gcc 2.95.espie2005-10-101-3/+3
| | | | | Patch by Leonardo Chiquitto Filho <leonardo@iken.com.br> Thanks.
* further knf and cleaning; ok tdevalderaadt2005-10-051-382/+364
|
* first KNF (no binary diffs)deraadt2005-10-051-1322/+1356
|
* zap remaining rcsid.espie2005-08-081-4/+1
| | | | | | Kill old files that are no longer compiled. okay theo
* Fix the unmapping of freed pages, leaving just 64k worth of cache pages.tdeval2005-07-071-58/+136
| | | | Prodded by art@ and fgsch@, ok deraadt@
* adding pointer protection to 'G' was too heavyweight. Since malloc guardtedu2005-06-071-4/+8
| | | | should be generally usable, split this out into option 'P'. ok deraadt
* handle sizeof(void *) allocations specially when using malloc guard.tedu2005-05-241-1/+31
| | | | they get a whole page and go right at the end of it. ok deraadt tdeval
* MMAP(2) malloc, here we go again.tdeval2005-03-311-222/+591
|
* Back out to brk(2) version.tdeval2004-08-111-554/+189
| | | | | | | The mmap(2) code is cool and it has already uncovered some bugs in other code. But some issues remain on some archs, and we can't afford that for production. Don't worry, it will be back soon... I'll make sure of it...
* - Remove the userland data limit check. It's mmap(2)'s job.tdeval2004-08-051-37/+108
| | | | | | - When malloc_abort==0 (MALLOC_OPTIONS=a), don't abort in wrterror(). fine deraadt@
* Missing check for NULL.tdeval2004-08-041-2/+2
|
* After a long gestation period, here comes our custom version of malloc(3)tdeval2004-08-011-181/+475
| | | | | | | | | | using mmap(2) instead of sbrk(2). To make a long story short, using mmap(2) in malloc(3) allows us to draw all the benefits from our mmap(2)'s randomization feature, closing the effort we did for returning memory blocks from random addresses. Tested for a long time by many, thanks to them. Go for it ! deraadt@
* Clean up malloc_active state when aborting.tdeval2004-04-121-3/+5
| | | | | | | This allows for safe abort handling, without tripping into false recursivity problems. Ok tedu@, deraadt@
* Sanity fix.tdeval2004-02-191-2/+5
| | | | reviewed by deraadt@, tedu@
* only whine about recursion once, so we don't get into problems with loops.tedu2003-11-191-19/+26
|
* by popular demand, malloc guard pages. insert an unreadable/unwriteabletedu2003-10-161-4/+45
| | | | | | | | page after each page size allocation to detect overrun. this is somewhat electric fence like, while attempting to be mostly usable in production. also, use tdeval's chunk randomization code. enabled with the G option. ok deraadt and co.
* abort on errors by default. workaround so running out of memory isn'ttedu2003-10-151-3/+3
| | | | | actually an error, A still applies full effect. suggested by phk. ok deraadt@ tdeval@
* two minor fixes. set errno on recursive calls. ENOMEM suggested by marc@.tedu2003-10-021-4/+7
| | | | | lock before setting malloc_func, not after. ok cloder@ deraadt@
* full stop. reverse course. remove all periods, so as to be alignedtedu2003-09-301-40/+40
| | | | with error messages elsewhere. requested ok deraadt@ henning@
* remove register. end all sentences with periods.tedu2003-09-271-16/+16
| | | | ok deraadt@ henning@ millert@
* ansify function argumentsjfb2003-08-041-34/+16
| | | | ok tdeval@
* - just warn in case of mmap/brk failuretdeval2003-07-191-5/+5
| | | | | | - extend_pgdir and malloc_make_chunks return int, not void* ok tedu@
* Fix two cases where malloc() returns NULL but does not set errno to ENOMEM.otto2003-07-131-2/+5
| | | | ok tdeval@ henning@ millert@
* Unbreak 64-bit archs...tdeval2003-05-141-2/+2
|
* Pointer cleaning. ok ian@, tedu@, krw@tdeval2003-05-141-66/+67
|
* Add sanity check to prevent int oflow for very large allocations.millert2003-01-141-3/+11
| | | | | Also fix a signed vs. unsigned issue while I am at it. Found by Jim Geovedi. OK deraadt@
* Honour malloc_junk ('J') with realloc(3), and fix page_dir shrink update.tdeval2002-11-271-6/+11
|
* Warn if atexit(3) fails. Change some tabs to spaces. Usecloder2002-11-251-5/+5
| | | | | | STDERR_FILENO instead of 2. OK millert@
* thread safe libc -- 2nd try. OK miod@, millert@marc2002-11-051-44/+13
| | | | Thanks to miod@ for m68k and vax fixes
* back out previous patch.. there are still some vax/m68k issuesmarc2002-11-031-13/+44
|
* libc changes for thread safety. Tested on:marc2002-11-031-44/+13
| | | | | | | alpha (millert@), i386 (marc@), m68k (millert@ and miod@), powerpc (drahn@ and dhartmei@), sparc (millert@ and marc@), sparc64 (marc@), and vax (millert@ and miod@). Thanks to millert@, miod@, and mickey@ for fixes along the way.
* unsigned vs unsigned intderaadt2002-05-271-3/+3
|
* Part one of userland __P removal. Done with a simple regexp with some minor ↵millert2002-02-161-3/+3
| | | | hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.
* THREAD_UNLOCK() on error before returning; millert@ ok.fgsch2002-01-231-1/+3
|
* correct an alignment mis-conception for malloc(0) returned regions.tdeval2001-12-051-14/+25
| | | | OK deraadt@
* remove dangling spaces and tabsmickey2001-11-011-16/+16
|
* mprotect allocations sized at 0 bytes. This will cause a fault for accesstdeval2001-10-301-36/+47
| | | | | to such, permitting them to be discovered, instead of exploited as the ssh crc insertion detector was. Idea by theo, written by tdeval.
* -1 -> MAP_FAILEDart2001-05-111-3/+3
|
* Use madvise(MADV_FREE) to allow the 'h' option.art2001-05-101-4/+4
| | | | (the code was already there, just not enabled).
* missing THREAD_UNLOCK; netch@segfault.kiev.uaderaadt2000-04-101-1/+2
|
* typo fix; halogen@nol.netderaadt2000-03-011-2/+2
|
* calloc() needs to be separate from malloc in case a user wants to havemillert1999-11-101-25/+1
| | | | their own malloc() implementation.
* Move calloc() into malloc.c and only zero out the area if malloc()millert1999-11-091-1/+25
| | | | | | didn't do so for us. By default, malloc() zeros out the space it allocates but the programmer cannot rely on this as it is implementation- specific (and configurable via /etc/malloc.conf)
* use writev() where possiblederaadt1999-09-161-12/+29
|
* wrong ret type for write define (millert@)d1999-02-031-2/+2
|
* malloc can't use write() if it fails very early, so use the unwrapped ↵d1999-02-011-1/+10
| | | | syscall _thread_sys_write() if we are threaded