tdeval
1edfc67741
Sanity fix.
reviewed by deraadt@, tedu@
21 years ago
tedu
ab37eb8efb
only whine about recursion once, so we don't get into problems with loops.
21 years ago
tedu
b2f289ed65
by popular demand, malloc guard pages. insert an unreadable/unwriteable
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.
21 years ago
tedu
a63df3864b
abort on errors by default. workaround so running out of memory isn't
actually an error, A still applies full effect.
suggested by phk. ok deraadt@ tdeval@
21 years ago
tedu
60d06f403c
two minor fixes. set errno on recursive calls. ENOMEM suggested by marc@.
lock before setting malloc_func, not after.
ok cloder@ deraadt@
21 years ago
tedu
df965b6a5c
full stop. reverse course. remove all periods, so as to be aligned
with error messages elsewhere. requested ok deraadt@ henning@
21 years ago
tedu
11a1131014
remove register. end all sentences with periods.
ok deraadt@ henning@ millert@
21 years ago
jfb
24eab29db5
ansify function arguments
ok tdeval@
22 years ago
tdeval
5d2808f6c8
- just warn in case of mmap/brk failure
- extend_pgdir and malloc_make_chunks return int, not void*
ok tedu@
22 years ago
otto
eb145cfead
Fix two cases where malloc() returns NULL but does not set errno to ENOMEM.
ok tdeval@ henning@ millert@
22 years ago
tdeval
2fc00a431b
Unbreak 64-bit archs...
22 years ago
tdeval
0106adef12
Pointer cleaning. ok ian@, tedu@, krw@
22 years ago
millert
949ecbd97d
Add sanity check to prevent int oflow for very large allocations.
Also fix a signed vs. unsigned issue while I am at it.
Found by Jim Geovedi. OK deraadt@
22 years ago
tdeval
2a55c1e776
Honour malloc_junk ('J') with realloc(3), and fix page_dir shrink update.
22 years ago
cloder
852a863c23
Warn if atexit(3) fails. Change some tabs to spaces. Use
STDERR_FILENO instead of 2.
OK millert@
22 years ago
marc
eefd3d97b6
thread safe libc -- 2nd try. OK miod@, millert@
22 years ago
marc
2b7dd8d384
back out previous patch.. there are still some vax/m68k issues
22 years ago
marc
80b718f7ee
libc changes for thread safety. Tested on:
22 years ago
deraadt
f1eab69159
unsigned vs unsigned int
23 years ago
millert
b68c09e067
Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.
23 years ago
fgsch
f9ed61c293
THREAD_UNLOCK() on error before returning; millert@ ok.
23 years ago
tdeval
77a7c73d5c
correct an alignment mis-conception for malloc(0) returned regions.
OK deraadt@
23 years ago
mickey
c3e7e8407a
remove dangling spaces and tabs
23 years ago
tdeval
d98536c135
mprotect allocations sized at 0 bytes. This will cause a fault for access
to such, permitting them to be discovered, instead of exploited as the ssh
crc insertion detector was. Idea by theo, written by tdeval.
23 years ago
art
4a1143fa05
-1 -> MAP_FAILED
24 years ago
art
c2600b0389
Use madvise(MADV_FREE) to allow the 'h' option.
(the code was already there, just not enabled).
24 years ago
deraadt
0f5d44fb3b
missing THREAD_UNLOCK; netch@segfault.kiev.ua
25 years ago
deraadt
96494ea71f
typo fix; halogen@nol.net
25 years ago
millert
b3d4a938bb
calloc() needs to be separate from malloc in case a user wants to have
their own malloc() implementation.
25 years ago
millert
e924435af1
Move calloc() into malloc.c and only zero out the area if malloc()
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)
25 years ago
deraadt
b3d4ba5664
use writev() where possible
25 years ago
d
1205763b91
wrong ret type for write define (millert@)
26 years ago
d
21a64850f5
malloc can't use write() if it fails very early, so use the unwrapped syscall _thread_sys_write() if we are threaded
26 years ago
d
31570910f0
Add thread-safety to libc, so that libc_r will build (on i386 at least).
All POSIX libc api now there (to P1003.1c/D10)
(more md stuff is needed for other libc/arch/*)
(setlogin is no longer a special syscall)
Add -pthread option to gcc (that makes it use -lc_r and -D_POSIX_THREADS).
Doc some re-entrant routines
Add libc_r to intro(3)
dig() uses some libc srcs and an extra -I was needed there.
Add more md stuff to libc_r.
Update includes for the pthreads api
Update libc_r TODO
26 years ago
millert
68f9effca8
Don't enumerate every arch in the #if since all OpenBSD platforms use the same values for malloc_pageshift and malloc_minsize except for sparc
27 years ago
rahnds
7db5e7f5e2
Oh fun, mucking about with files used on all archs.
This is one of many places in the source that have
#if defined("list all architectures")
Is there some possible way to eliminate, reduce these or at least
have a file that describes all occurrances so that when a new port is
done this could be addressed. like the recent hppa port, does it need to
take a look at this????
27 years ago
deraadt
e8d65e4516
make mmap() return void *, add MAP_FAILED
27 years ago
pefo
1350af0652
Change realloc(foo,0) to behave like malloc(0). Both now return a pointer
to an object of size zero. This will allow testing on reallocs return value
to determine if the operation was successful or not.
28 years ago
deraadt
c6a30dae2b
malloc_init() should try to not modify errno
28 years ago
millert
81c581b9d6
Use MALLOC_EXTRA_SANITY consistently (EXTRA_SANITY was used in many places)
sizeof *pt -> sizeof *px (point to same type of struct but looked wrong).
28 years ago
tholo
85cb5df3cc
Make it possible to not output warnings (errors causing aborts are always
output).
28 years ago
tholo
a9dc5ef894
Add x/X option to behave like X11 xmalloc; from FreeBSD
Reduce diffs wrt. FreeBSD some
28 years ago
tholo
4c365544ad
Be more careful with mixing types
28 years ago
tholo
bde02a1ec3
Check for overflow; from FreeBSD
28 years ago
niklas
64f8f12484
is we were set[ug]id an unitialized ptr bit us
28 years ago
tholo
784ff4473c
Make this 64-bit safe again
28 years ago
tholo
73305d3116
Integrate latest malloc(3) from FreeBSD
28 years ago
niklas
4dbdb68e0e
more 64bit fixes
28 years ago
niklas
fae65a16e0
64 bit clean
28 years ago
kstailey
fbda0fcd0b
removed plus sign from start of line
28 years ago