Commit Graph

1738 Commits

Author SHA1 Message Date
Rich Felker
ac5d085691 dladdr should be available under _BSD_SOURCE as well as _GNU_SOURCE 2012-09-06 22:58:34 -04:00
Rich Felker
400c5e5c83 use restrict everywhere it's required by c99 and/or posix 2008
to deal with the fact that the public headers may be used with pre-c99
compilers, __restrict is used in place of restrict, and defined
appropriately for any supported compiler. we also avoid the form
[restrict] since older versions of gcc rejected it due to a bug in the
original c99 standard, and instead use the form *restrict.
2012-09-06 22:44:55 -04:00
Rich Felker
bac03cdde1 remove dependency of wmemmove on wmemcpy direction
unlike the memmove commit, this one should be fine to leave in place.
wmemmove is not performance-critical, and even if it were, it's
already copying whole 32-bit words at a time instead of bytes.
2012-09-06 20:28:42 -04:00
Rich Felker
594318fd3d remove dependency of memmove on memcpy direction
this commit introduces a performance regression in many uses of
memmove, which will need to be addressed before the next release. i'm
making it as a temporary measure so that the restrict patch can be
committed without invoking undefined behavior when memmove calls
memcpy with overlapping regions.
2012-09-06 20:25:48 -04:00
Rich Felker
fcfba99503 fix broken ttyname[_r] (failure to null-terminate result) 2012-09-06 20:21:13 -04:00
Rich Felker
fb247fafa0 avoid "inline" in public headers for strict c89 compatibility
while musl itself requires a c99 compiler, some applications insist on
being compiled with c89 compilers, and use of "inline" in the headers
was breaking them. much of this had been avoided already by just
skipping the inline keyword in pre-c99 compilers or modes, but this
new unified solution is cleaner and may/should result in better code
generation in the default gcc configuration.
2012-09-02 12:46:06 -04:00
Rich Felker
3f62f76cab fix wrong type for poll.h nfds_t
this should not break anything since the type should never be used
except as the argument type for poll.
2012-09-01 00:20:24 -04:00
Rich Felker
0447b8dc5c fix missing statics in crypt_sha256 code 2012-08-30 08:27:08 -04:00
Rich Felker
13157b025e anti-DoS rounds count limits for blowfish and des crypt
all of the limits could use review, but err on the side of avoiding
excessive rounds for now.
2012-08-29 12:56:12 -04:00
Rich Felker
507b6091fa limit sha512 rounds to similar runtime to sha256 limit
these limits could definitely use review, but for now, i feel
consistency and erring on the side of preventing servers from getting
bogged down by excessively-slow user-provided settings (think
.htpasswd) are the best policy. blowfish should be updated to match.
2012-08-29 12:44:27 -04:00
Rich Felker
88bf5a8a8d add sha256/sha512 crypt
based on versions sent to the list by nsz, with some simplification
and debloating. i'd still like to get them a bit smaller, or ideally
merge them into a single file with most of the code being shared, but
that can be done later.
2012-08-29 12:41:29 -04:00
Rich Felker
b439c051c7 get rid of eh_frame bloat
if needed for debugging, it will be output in the .debug_frame section
instead, where it is not part of the loaded program and where the
strip command is free to strip it.
2012-08-29 09:36:02 -04:00
Rich Felker
8b28aa9c94 fix bug caused by main app & libc having map set; cannot free them 2012-08-27 10:07:32 -04:00
Rich Felker
f419bcb9dc dladdr support for dynamic linker (nonstandard extension)
based on patches submitted by boris brezillon. this commit also fixes
the issue whereby the main application and libc don't have the address
ranges of their mappings stored, which was theoretically a problem for
RTLD_NEXT support in dlsym; it didn't actually matter because libc
never calls dlsym, and it seemed to be doing the right thing (by
chance) for symbols in the main program as well.
2012-08-26 21:09:26 -04:00
Rich Felker
9bff7c133e implement "low hanging fruit" from C11
based on Gregor's patch sent to the list. includes:
- stdalign.h
- removing gets in C11 mode
- adding aligned_alloc and adjusting other functions to use it
- adding 'x' flag to fopen for exclusive mode
2012-08-25 23:15:13 -04:00
Rich Felker
b5289fd749 add c11 quick_exit and at_quick_exit functions 2012-08-25 22:49:47 -04:00
Rich Felker
a5d6199d09 fix bug in gnu hash lookup on dlsym(handle, name) lookups
wrong hash was being passed; just a copy/paste error. did not affect
lookups in the global namespace; this is probably why it was not
caught in testing.
2012-08-25 17:40:27 -04:00
Rich Felker
dbcb3ad925 clean up search_vec usage for vdso 2012-08-25 17:31:59 -04:00
Rich Felker
08b3c71410 use new search_vec function to find vdso in dynamic linker 2012-08-25 17:30:59 -04:00
Rich Felker
731e8ffdcf ensure canary is setup if stack-prot libs are dlopen'd into non-ssp app
previously, this usage could lead to a crash if the thread pointer was
still uninitialized, and otherwise would just cause the canary to be
zero (less secure).
2012-08-25 17:24:46 -04:00
Rich Felker
2bd05a4fc2 add gnu hash support in the dynamic linker
based on the patches contributed by boris brezillon.
2012-08-25 17:13:28 -04:00
Rich Felker
7dba0494e8 type exposure fixes in sys/sem.h 2012-08-24 17:01:17 -04:00
Rich Felker
d03b3e7323 stdio_ext.h needs to include stdio.h, at least to get FILE... 2012-08-24 16:16:30 -04:00
Rich Felker
43a5a00e4a fix missing uintXX_t in nameser.h 2012-08-24 15:55:36 -04:00
Rich Felker
9a470b0a6e fix dirent.h with _BSD_SOURCE 2012-08-24 14:23:16 -04:00
Rich Felker
67ba40d1e0 optimize legacy ffs function 2012-08-23 14:38:34 -04:00
Rich Felker
a749ba3adc fix bug whereby most atexit-registered functions got skipped 2012-08-19 20:48:16 -04:00
Rich Felker
04109502c0 make dynamic linker report all failures before exiting
before, only the first library that failed to load or symbol that
failed to resolve was reported, and then the dynamic linker
immediately exited. when attempting to fix a library compatibility
issue, this is about the worst possible behavior. now we print all
errors as they occur and exit at the very end if errors were
encountered.
2012-08-18 16:00:23 -04:00
Rich Felker
53de960d6f release notes for 0.9.4 2012-08-17 23:51:00 -04:00
Rich Felker
3ae8b980d1 add mips to supported arch list in INSTALL file 2012-08-17 23:45:21 -04:00
Rich Felker
259071c249 crt1 must align stack pointer on mips
it's naturally aligned when entered with the kernel argv array, but if
ld.so has been invoked explicitly to run a program, the stack will not
be aligned due to having thrown away argv[0].
2012-08-17 21:23:10 -04:00
Rich Felker
efe9751468 fix bug computing argc when invoking ld-musl-mips.so.1 progname ... 2012-08-17 20:02:37 -04:00
Rich Felker
0780936312 split up installation target
patch by Luca Barbato (lu_zero)
2012-08-17 19:32:24 -04:00
Rich Felker
da8d0fc4fa fix extremely rare but dangerous race condition in robust mutexes
if new shared mappings of files/devices/shared memory can be made
between the time a robust mutex is unlocked and its subsequent removal
from the pending slot in the robustlist header, the kernel can
inadvertently corrupt data in the newly-mapped pages when the process
terminates. i am fixing the bug by using the same global vm lock
mechanism that was used to fix the race condition with unmapping
barriers after pthread_barrier_wait returns.
2012-08-17 17:13:53 -04:00
Rich Felker
11458e5b09 fix float parsing logic for long decimal expansions
this affects at least the case of very long inputs, but may also
affect shorter inputs that become long due to growth while upscaling.
basically, the logic for the circular buffer indices of the initial
base-10^9 digit and the slot one past the final digit, and for
simplicity of the loop logic, assumes an invariant that they're not
equal. the upscale loop, which can increase the length of the
base-10^9 representation, attempted to preserve this invariant, but
was actually only ensuring that the end index did not loop around past
the start index, not that the two never become equal.

the main (only?) effect of this bug was that subsequent logic treats
the excessively long number as having no digits, leading to junk
results.
2012-08-17 16:53:09 -04:00
Rich Felker
dc82ee4e30 handle null arguments to legacy bsd err.h functions 2012-08-15 22:35:02 -04:00
Rich Felker
3f80afc505 improve headers to better deal with removed-in-posix-2008 features
with this patch, setting _POSIX_SOURCE, or setting _POSIX_C_SOURCE or
_XOPEN_SOURCE to an old version, will bring back the interfaces that
were removed in POSIX 2008 - at least the ones i've covered so far,
which are gethostby*, usleep, and ualarm. if there are other functions
still in widespread use that were removed for which similar changes
would be beneficial, they can be added just like this.
2012-08-15 15:35:32 -04:00
Rich Felker
7650390de8 add missing xattr functions
not sure why these were originally omitted..
2012-08-15 08:31:44 -04:00
Rich Felker
0d4d1a96e4 update copyright/credits for recent code additions 2012-08-15 00:19:42 -04:00
Rich Felker
94e920d0cd support configuring cross compiling with CROSS_COMPILE prefix variable 2012-08-14 22:50:16 -04:00
Rich Felker
b99836f3ad Merge remote-tracking branch 'nsz/bsd' 2012-08-13 21:55:35 -04:00
Rich Felker
2d93d64461 Merge remote-tracking branch 'nsz/exp' 2012-08-13 21:55:22 -04:00
nsz
23e6940a2c math: fix _BSD_SOURCE namespace in math.h 2012-08-13 22:06:01 +02:00
Rich Felker
ab76321c14 remove significandl
this function never existed historically; since the float/double
functions it's based on are nonstandard and deprecated, there's really
no justification for its existence except that glibc has it. it can be
added back if there's ever really a need...
2012-08-13 16:00:31 -04:00
Rich Felker
2242bf616b add significand[fl] math functions 2012-08-13 14:51:43 -04:00
Rich Felker
0c42beb5f9 publicly expose getdents api under _BSD_SOURCE 2012-08-13 14:50:30 -04:00
Rich Felker
aaa9eb5101 memcpy asm for i386 and x86_64 2012-08-11 21:33:13 -04:00
Rich Felker
036eaa24cf avoid need for -march=mips2 to compile mips atomic.h asm
linux guarantees ll/sc are always available. on mips1, they will be
emulated by the kernel. thus they are part of the linux mips1 abi and
safe to use.
2012-08-11 19:51:21 -04:00
Rich Felker
f997e224fc remove unused but buggy code from strstr.c 2012-08-11 18:40:33 -04:00
Rich Felker
35c16933f0 remove buggy short-string wcsstr implementation; always use twoway
since this interface is rarely used, it's probably best to lean
towards keeping code size down anyway. one-character needles will
still be found immediately by the initial wcschr call anyway.
2012-08-11 18:39:12 -04:00