summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2012-09-06fix constraint violation in ftwRich Felker1-1/+4
void* does not implicitly convert to function pointer types.
2012-09-06further use of _Noreturn, for non-plain-C functionsRich Felker6-10/+10
note that POSIX does not specify these functions as _Noreturn, because POSIX is aligned with C99, not the new C11 standard. when POSIX is eventually updated to C11, it will almost surely give these functions the _Noreturn attribute. for now, the actual _Noreturn keyword is not used anyway when compiling with a c99 compiler, which is what POSIX requires; the GCC __attribute__ is used instead if it's available, however. in a few places, I've added infinite for loops at the end of _Noreturn functions to silence compiler warnings. presumably __buildin_unreachable could achieve the same thing, but it would only work on newer GCCs and would not be portable. the loops should have near-zero code size cost anyway. like the previous _Noreturn commit, this one is based on patches contributed by philomath.
2012-09-06fix invalid implicit pointer conversion in gnulib-compat functionsRich Felker1-1/+1
2012-09-06add _Noreturn function attribute, with fallback for pre-C11 GNUCRich Felker4-4/+4
2012-09-06use restrict everywhere it's required by c99 and/or posix 2008Rich Felker164-198/+199
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-06remove dependency of wmemmove on wmemcpy directionRich Felker1-4/+4
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-06remove dependency of memmove on memcpy directionRich Felker1-5/+4
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-06fix broken ttyname[_r] (failure to null-terminate result)Rich Felker1-1/+4
2012-08-30fix missing statics in crypt_sha256 codeRich Felker1-3/+3
2012-08-29anti-DoS rounds count limits for blowfish and des cryptRich Felker2-2/+2
all of the limits could use review, but err on the side of avoiding excessive rounds for now.
2012-08-29limit sha512 rounds to similar runtime to sha256 limitRich Felker1-1/+1
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-29add sha256/sha512 cryptRich Felker4-1/+700
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-27fix bug caused by main app & libc having map set; cannot free themRich Felker1-1/+1
2012-08-26dladdr support for dynamic linker (nonstandard extension)Rich Felker2-0/+95
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-25implement "low hanging fruit" from C11Rich Felker4-49/+57
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-25add c11 quick_exit and at_quick_exit functionsRich Felker2-0/+44
2012-08-25fix bug in gnu hash lookup on dlsym(handle, name) lookupsRich Felker1-1/+1
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-25clean up search_vec usage for vdsoRich Felker1-2/+2
2012-08-25use new search_vec function to find vdso in dynamic linkerRich Felker1-4/+2
2012-08-25ensure canary is setup if stack-prot libs are dlopen'd into non-ssp appRich Felker2-2/+6
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-25add gnu hash support in the dynamic linkerRich Felker1-12/+85
based on the patches contributed by boris brezillon.
2012-08-23optimize legacy ffs functionRich Felker1-4/+2
2012-08-19fix bug whereby most atexit-registered functions got skippedRich Felker1-3/+2
2012-08-18make dynamic linker report all failures before exitingRich Felker1-2/+6
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-17fix bug computing argc when invoking ld-musl-mips.so.1 progname ...Rich Felker1-3/+3
2012-08-17fix extremely rare but dangerous race condition in robust mutexesRich Felker3-20/+33
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-17fix float parsing logic for long decimal expansionsRich Felker1-1/+1
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-15handle null arguments to legacy bsd err.h functionsRich Felker1-2/+2
2012-08-15add missing xattr functionsRich Felker1-0/+15
not sure why these were originally omitted..
2012-08-13Merge remote-tracking branch 'nsz/exp'Rich Felker2-40/+35
2012-08-13remove significandlRich Felker1-7/+0
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-13add significand[fl] math functionsRich Felker3-0/+21
2012-08-11memcpy asm for i386 and x86_64Rich Felker2-0/+51
2012-08-11remove unused but buggy code from strstr.cRich Felker1-10/+0
2012-08-11remove buggy short-string wcsstr implementation; always use twowayRich Felker1-9/+0
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-11add bsd fgetln functionRich Felker3-1/+21
optimized to avoid allocation and return lines directly out of the stream buffer whenever possible.
2012-08-10minor but worthwhile optimization in printf: avoid expensive strspnRich Felker1-4/+2
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-10trivial optimization to printf: avoid wasted call frameRich Felker1-1/+1
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-10add blowfish hash support to cryptRich Felker3-8/+806
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-09fix (hopefully) all hard-coded 8's for kernel sigset_t sizeRich Felker14-20/+31
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-09make crypt return an unmatchable hash rather than NULL on failureRich Felker1-5/+2
unfortunately, a large portion of programs which call crypt are not prepared for its failure and do not check that the return value is non-null before using it. thus, always "succeeding" but giving an unmatchable hash is reportedly a better behavior than failing on error. it was suggested that we could do this the same way as other implementations and put the null-to-unmatchable translation in the wrapper rather than the individual crypt modules like crypt_des, but when i tried to do it, i found it was making the logic in __crypt_r for keeping track of which hash type we're working with and whether it succeeded or failed much more complex, and potentially error-prone. the way i'm doing it now seems to have essentially zero cost, anyway.
2012-08-08math: fix exp.s on i386 and x86_64 so the exception flags are correctnsz2-40/+35
exp(inf), exp(-inf), exp(nan) used to raise wrong flags
2012-08-07fix bug dlsym bug that slipped in during dynamic linker cleanupRich Felker1-1/+1
2012-08-05dlsym RTLD_NEXT support for mipsRich Felker1-0/+15
untested
2012-08-05more changes that were lost when committing mips dynamic linkerRich Felker1-0/+4
2012-08-05fix change lost in the process of integrating mips dynamic linkerRich Felker1-2/+2
2012-08-05mips dynamic linker supportRich Felker2-0/+49
not heavily tested, but the basics are working. the basic concept is that the dynamic linker entry point code invokes a pure-PIC (no global accesses) C function in reloc.h to perform the early GOT relocations needed to make the dynamic linker itself functional, then invokes __dynlink like on other archs. since mips uses some ugly arch-specific hacks to optimize relocating the GOT (rather than just using the normal DT_REL[A] tables like on other archs), the dynamic linker has been modified slightly to support calling arch-specific relocation code in reloc.h. most of the actual mips-specific behavior was developed by reading the output of readelf on libc.so and simple executable files. i could not find good reference information on which relocation types need to be supported or their semantics, so it's possible that some legitimate usage cases will not work yet.
2012-08-05more cleanup of dynamic linker internalsRich Felker1-8/+9
2012-08-05more dynamic linker internals cleanupRich Felker1-6/+6
changing the string printed for the dso name is not a regression; the old code was simply using the wrong dso name (head rather than the dso currently being relocated). this will be fixed in a later commit.
2012-08-05dynamic linker internals cleanupRich Felker1-5/+7