Commit Graph

1431 Commits

Author SHA1 Message Date
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
Rich Felker 617182734c add bsd fgetln function
optimized to avoid allocation and return lines directly out of the
stream buffer whenever possible.
2012-08-11 18:10:38 -04:00
Rich Felker 2b964b010e minor but worthwhile optimization in printf: avoid expensive strspn
the strspn call was made for every format specifier and end-of-string,
even though the expected return value was 1-2 for normal usage.
replace with simple loop.
2012-08-10 23:39:32 -04:00
Rich Felker 4c346919a9 trivial optimization to printf: avoid wasted call frame
amusingly, this cuts more than 10% off the run time of printf("a"); on
the machine i tested it on.

sadly the same optimization is not possible for snprintf without
duplicating all the pseudo-FILE setup code, which is not worth it.
2012-08-10 22:18:49 -04:00
Rich Felker e3ebe7db5d use int instead of long for ptrdiff_t on all 32-bit archs
this is needed to match the underlying "ABI" standards. it's not
really an ABI issue since the binary representations are the same, but
having the wrong type can lead to errors when the type arising from a
difference-of-pointers expression does not match the defined type of
ptrdiff_t. most of the problems affect C++, not C.
2012-08-10 15:13:26 -04:00
Rich Felker c5875ad34b fix incorrect ptrdiff_t type on mips 2012-08-10 14:59:20 -04:00
Rich Felker a02bf5fc50 add blowfish hash support to crypt
there are still some discussions going on about tweaking the code, but
at least thing brings us to the point of having something working in
the repository. hopefully the remaining major hashes (md5,sha) will
follow soon.
2012-08-10 00:20:00 -04:00
Rich Felker 2f437040e7 fix (hopefully) all hard-coded 8's for kernel sigset_t size
some minor changes to how hard-coded sets for thread-related purposes
are handled were also needed, since the old object sizes were not
necessarily sufficient. things have gotten a bit ugly in this area,
and i think a cleanup is in order at some point, but for now the goal
is just to get the code working on all supported archs including mips,
which was badly broken by linux rejecting syscalls with the wrong
sigset_t size.
2012-08-09 22:52:13 -04:00