about summary refs log tree commit diff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* cleanup src/linux and src/misc trees, etc.Rich Felker2012-09-0745-98/+74
| | | | | | | | | | | | previously, it was pretty much random which one of these trees a given function appeared in. they have now been organized into: src/linux: non-POSIX linux syscalls (possibly shard with other nixen) src/legacy: various obsolete/legacy functions, mostly wrappers src/misc: still mostly uncategorized; some misc POSIX, some nonstd src/crypt: crypt hash functions further cleanup will be done later.
* fix constraint violation in ftwRich Felker2012-09-061-1/+4
| | | | void* does not implicitly convert to function pointer types.
* further use of _Noreturn, for non-plain-C functionsRich Felker2012-09-066-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.
* fix invalid implicit pointer conversion in gnulib-compat functionsRich Felker2012-09-061-1/+1
|
* add _Noreturn function attribute, with fallback for pre-C11 GNUCRich Felker2012-09-064-4/+4
|
* use restrict everywhere it's required by c99 and/or posix 2008Rich Felker2012-09-06164-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.
* remove dependency of wmemmove on wmemcpy directionRich Felker2012-09-061-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.
* remove dependency of memmove on memcpy directionRich Felker2012-09-061-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.
* fix broken ttyname[_r] (failure to null-terminate result)Rich Felker2012-09-061-1/+4
|
* fix missing statics in crypt_sha256 codeRich Felker2012-08-301-3/+3
|
* anti-DoS rounds count limits for blowfish and des cryptRich Felker2012-08-292-2/+2
| | | | | all of the limits could use review, but err on the side of avoiding excessive rounds for now.
* limit sha512 rounds to similar runtime to sha256 limitRich Felker2012-08-291-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.
* add sha256/sha512 cryptRich Felker2012-08-294-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.
* fix bug caused by main app & libc having map set; cannot free themRich Felker2012-08-271-1/+1
|
* dladdr support for dynamic linker (nonstandard extension)Rich Felker2012-08-262-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.
* implement "low hanging fruit" from C11Rich Felker2012-08-254-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
* add c11 quick_exit and at_quick_exit functionsRich Felker2012-08-252-0/+44
|
* fix bug in gnu hash lookup on dlsym(handle, name) lookupsRich Felker2012-08-251-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.
* clean up search_vec usage for vdsoRich Felker2012-08-251-2/+2
|
* use new search_vec function to find vdso in dynamic linkerRich Felker2012-08-251-4/+2
|
* ensure canary is setup if stack-prot libs are dlopen'd into non-ssp appRich Felker2012-08-252-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).
* add gnu hash support in the dynamic linkerRich Felker2012-08-251-12/+85
| | | | based on the patches contributed by boris brezillon.
* optimize legacy ffs functionRich Felker2012-08-231-4/+2
|
* fix bug whereby most atexit-registered functions got skippedRich Felker2012-08-191-3/+2
|
* make dynamic linker report all failures before exitingRich Felker2012-08-181-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.
* fix bug computing argc when invoking ld-musl-mips.so.1 progname ...Rich Felker2012-08-171-3/+3
|
* fix extremely rare but dangerous race condition in robust mutexesRich Felker2012-08-173-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.
* fix float parsing logic for long decimal expansionsRich Felker2012-08-171-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.
* handle null arguments to legacy bsd err.h functionsRich Felker2012-08-151-2/+2
|
* add missing xattr functionsRich Felker2012-08-151-0/+15
| | | | not sure why these were originally omitted..
* Merge remote-tracking branch 'nsz/exp'Rich Felker2012-08-132-40/+35
|\
| * math: fix exp.s on i386 and x86_64 so the exception flags are correctnsz2012-08-082-40/+35
| | | | | | | | exp(inf), exp(-inf), exp(nan) used to raise wrong flags
* | remove significandlRich Felker2012-08-131-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...
* | add significand[fl] math functionsRich Felker2012-08-133-0/+21
| |
* | memcpy asm for i386 and x86_64Rich Felker2012-08-112-0/+51
| |
* | remove unused but buggy code from strstr.cRich Felker2012-08-111-10/+0
| |
* | remove buggy short-string wcsstr implementation; always use twowayRich Felker2012-08-111-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.
* | add bsd fgetln functionRich Felker2012-08-113-1/+21
| | | | | | | | | | optimized to avoid allocation and return lines directly out of the stream buffer whenever possible.
* | minor but worthwhile optimization in printf: avoid expensive strspnRich Felker2012-08-101-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.
* | trivial optimization to printf: avoid wasted call frameRich Felker2012-08-101-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.
* | add blowfish hash support to cryptRich Felker2012-08-103-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.
* | fix (hopefully) all hard-coded 8's for kernel sigset_t sizeRich Felker2012-08-0914-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.
* | make crypt return an unmatchable hash rather than NULL on failureRich Felker2012-08-091-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.
* fix bug dlsym bug that slipped in during dynamic linker cleanupRich Felker2012-08-071-1/+1
|
* dlsym RTLD_NEXT support for mipsRich Felker2012-08-051-0/+15
| | | | untested
* more changes that were lost when committing mips dynamic linkerRich Felker2012-08-051-0/+4
|
* fix change lost in the process of integrating mips dynamic linkerRich Felker2012-08-051-2/+2
|
* mips dynamic linker supportRich Felker2012-08-052-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.
* more cleanup of dynamic linker internalsRich Felker2012-08-051-8/+9
|
* more dynamic linker internals cleanupRich Felker2012-08-051-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.