about summary refs log tree commit diff
Commit message (Collapse)AuthorAgeFilesLines
* fix multiple validation issues in dns response label parsingSzabolcs Nagy2014-06-061-4/+6
| | | | | | | | | | | | | | Due to an error introduced in commit fcc522c92335783293ac19df318415cd97fbf66b, checking of the remaining output buffer space was not performed correctly, allowing malformed input to write past the end of the buffer. In addition, the loop detection logic failed to account for the possibility of infinite loops with no output, which would hang the function. The output size is now limited more strictly so only names with valid length are accepted. (cherry picked from commit b3d9e0b94ea73c68ef4169ec82c898ce59a4e30a)
* remove some dummy "ent" function aliases that duplicated real onesRich Felker2014-06-061-8/+0
| | | | | | | | | the service and protocol functions are defined also in other files, and the protocol ones are actually non-nops elsewhere, so the weak definitions in ent.c could have prevented the strong definitions from getting pulled in and used in some static programs. (cherry picked from commit 934aa1350b96461f205ad69c95e8f6f035f6b62c)
* fix if_nametoindex return value when interface does not existRich Felker2014-06-061-1/+1
| | | | | | | | the return value is unsigned, so negative results for "errors" do not make sense; 0 is the value reserved for when the interface name does not exist. (cherry picked from commit 8041af59881219c32267c3491bee43591d3c3fe6)
* fix incorrect end pointer in some cases when wcsrtombs stops earlyRich Felker2014-06-061-7/+15
| | | | | | | | | | | | | | when wcsrtombs stopped due to hitting zero remaining space in the output buffer, it was wrongly clearing the position pointer as if it had completed the conversion successfully. this commit rearranges the code somewhat to make a clear separation between the cases of ending due to running out of output buffer space, and ending due to reaching the end of input or an illegal sequence in the input. the new branches have been arranged with the hope of optimizing more common cases, too. (cherry picked from commit 8fba4458afb7304b32ca887e4a3990c6029131f9)
* fix for broken kernel side RLIM_INFINITY on mipsSzabolcs Nagy2014-06-065-3/+40
| | | | | | | | | | | | | | | | | | | | | | On 32 bit mips the kernel uses -1UL/2 to mark RLIM_INFINITY (and this is the definition in the userspace api), but since it is in the middle of the valid range of limits and limits are often compared with relational operators, various kernel side logic is broken if larger than -1UL/2 limits are used. So we truncate the limits to -1UL/2 in get/setrlimit and prlimit. Even if the kernel side logic consistently treated -1UL/2 as greater than any other limit value, there wouldn't be any clean workaround that allowed using large limits: * using -1UL/2 as RLIM_INFINITY in userspace would mean different infinity value for get/setrlimt and prlimit (where infinity is always -1ULL) and userspace logic could break easily (just like the kernel is broken now) and more special case code would be needed for mips. * translating -1UL/2 kernel side value to -1ULL in userspace would mean that -1UL/2 limit cannot be set (eg. -1UL/2+1 had to be passed to the kernel instead). (cherry picked from commit 8258014fd1e34e942a549c88c7e022a00445c352)
* fix sendfile syscall to use 64-bit off_tRich Felker2014-06-061-0/+5
| | | | | | | | | | | | | somehow the remapping of this syscall to the 64-bit version was overlooked. the issue was found, and patch provided, by Stefan Kristiansson. presumably the reason this bug was not caught earlier is that the syscall takes a pointer to off_t rather than a value, so on little-endian systems, everything appears to work as long as the offset value fits in the low 31 bits. on big-endian systems, though, sendfile was presumably completely non-functional. corresponds to commit 55f45bc7222ec50b72aa8411c61e30184d0ade23 in master branch.
* release 1.0.2 v1.0.2Rich Felker2014-05-202-1/+20
|
* trivial formatting fix for the config.mak generated by configureRich Felker2014-05-201-1/+1
| | | | (cherry picked from commit 7c6db373a55a348b3ecc7b124dd4ea541eff63cd)
* fix unhandled cases in strptimeRich Felker2014-05-201-5/+16
| | | | | | | | | | | | | | | | | | | | | | | %C, %U, %W, and %y handling were completely missing; %C wrongly fell-through to unrelated cases, and the rest returned failure. for now, they all parse numbers in the proper forms and range-check the values, but they do not store the value anywhere. it's not clear to me whether, as "derived" fields, %U and %W should produce any result. they certainly cannot produce a result unless the year and weekday are also converted, but in this case it might be desirable for them to do so. clarification is needed on the intended behavior of strptime in cases like this. %C and %y have well-defined behavior as long as they are used together (and %y is defined by itself but may change in the future). implementing them (including their correct interaction) is left as a later change to be made. finally, strptime now rejects unknown/invalid format characters instead of ignoring them. (cherry picked from commit dec66750b8ed4493d5bb40042f7a473e60fe934e)
* add configure check for broken gcc 4.9.0 and possibly other versionsRich Felker2014-05-201-5/+37
| | | | | | | | | | | | | this is gcc bug #61144. the broken compiler is detected, but the user must manually work around it. this is partly to avoid complex logic for adding workaround CFLAGS and attempting to recheck with them, and partly for the sake of letting the user know the compiler is broken (since the workaround will result in less-efficient code production). some refactoring was also needed to move the check for gcc outside of the check for whether to build the compiler wrapper. (cherry picked from commit 9ca4dae5d895cf816eb1815511aba77a90f6acd7)
* add configure check for working compilerRich Felker2014-05-201-0/+9
| | | | | | | | without this, broken choices of CC/CPPFLAGS/CFLAGS don't show up until late in the configure process where they are confusingly reported as a different failure such as incorrect long double type. (cherry picked from commit 8945667fadc2eb71b7924bb4c5a69507fd362f4a)
* fix strftime %s not to zero pad with default width=2Szabolcs Nagy2014-05-201-0/+1
| | | | (cherry picked from commit ac0acd569e01735fc6052d43fdf57f3a07c93f3d)
* remove useless __yield alias for sched_yieldRich Felker2014-05-201-4/+1
| | | | | | | this is no longer used for anything, and reportedly clashed with a builtin on certain compilers. (cherry picked from commit adbf0258be4eea5f012e173de7e55a87f3093669)
* fix missing SO_RCVBUFFORCE and SO_SNDBUFFORCE in mips socket.hRich Felker2014-05-201-1/+2
| | | | (cherry picked from commit 468bc11ed059c475f974920ac3d499e6071a6b2c)
* fix superh nofpu check on old gcc versionsBobby Bingham2014-05-201-1/+1
| | | | | | | | | | | | | | | As far as gcc3 knows, sh4 is the only processor version that can have an FPU, so it indicates the FPU's presence by defining __SH4__. This is not defined if there is no FPU, even if the processor really is an SH4. Starting with gcc4, there is support for the sh2a processor, which has an FPU but is not an SH4. gcc4 therefore additionally defines __SH_FPU_ANY__ when there is an FPU, but still doesn't define __SH4__ for an FPU-less sh4. Therefore, to support all gcc versions, we must look at both preprocessor symbols. (cherry picked from commit 23d64182d8328c300b368446aad20da9cec91aa3)
* perform minimal sanity checks on zoneinfo files loaded via TZ variableRich Felker2014-05-201-0/+5
| | | | | | | | | | | | | | previously, setting TZ to the pathname of a file which was not a valid zoneinfo file would usually cause programs using local time zone based operations to crash. the new code checks the file size and magic at the beginning of the file, which seems sufficient to prevent accidental misconfiguration from causing crashes. attempting to make fully-robust validation would be futile unless we wanted to drop use of mmap (shared zoneinfo) and instead read it into a local buffer, since such validation would be subject to race conditions with modification of the file. (cherry picked from commit c3d9d172b1fcd56c4d356798f4e3b4653076bcc3)
* fix false negatives with periodic needles in strstr, wcsstr, and memmemRich Felker2014-05-203-3/+3
| | | | | | | | | | in cases where the memorized match range from the right factor exceeded the length of the left factor, it was wrongly treated as a mismatch rather than a match. issue reported by Yves Bastide. (cherry picked from commit 476cd1d96560aaf7f210319597556e7fbcd60469)
* release 1.0.1 v1.0.1Rich Felker2014-04-162-1/+19
|
* fix deadlock race in pthread_onceRich Felker2014-04-161-2/+1
| | | | | | | | | | | | | | at the end of successful pthread_once, there was a race window during which another thread calling pthread_once would momentarily change the state back from 2 (finished) to 1 (in-progress). in this case, the status was immediately changed back, but with no wake call, meaning that waiters which arrived during this short window could block forever. there are two possible fixes. one would be adding the wake to the code path where it was missing. but it's better just to avoid reverting the status at all, by using compare-and-swap instead of swap. (cherry picked from commit 0d0c2f40344640a2a6942dda156509593f51db5d)
* fix RLIMIT_ constants for mipsSzabolcs Nagy2014-04-169-2/+10
| | | | | | | | | The mips arch is special in that it uses different RLIMIT_ numbers than other archs, so allow bits/resource.h to override the default RLIMIT_ numbers (empty on all archs except mips). Reported by orc. (cherry picked from commit fcea534e579077e10456f6ed06c033dfaa013a24)
* fix fallback code for old kernels in clock_gettimeRich Felker2014-04-161-1/+1
| | | | (cherry picked from commit 805698401dbac7ce3079fa97eaad5ba0508377f4)
* use hidden visibility rather than protected for syscall internalsRich Felker2014-04-161-1/+1
| | | | | | | | | | | | | | | | | the use of visibility at all is purely an optimization to avoid the need for the caller to load the GOT register or similar to prepare for a call via the PLT. there is no reason for these symbols to be externally visible, so hidden works just as well as protected, and using protected visibility is undesirable due to toolchain bugs and the lack of testing it receives. in particular, GCC's microblaze target is known to generate symbolic relocations in the GOT for functions with protected visibility. this in turn results in a dynamic linker which crashes under any nontrivial usage that requires making a syscall before symbolic relocations are processed. (cherry picked from commit 83c98aac4c43f9571e8f92a1c795afe02c237d4b)
* math: fix aliasing violation in long double wrappersSzabolcs Nagy2014-04-162-2/+10
| | | | | | | | | | | modfl and sincosl were passing long double* instead of double* to the wrapped double precision functions (on archs where long double and double have the same size). This is fixed now by using temporaries (this is not optimized to a single branch so the generated code is a bit bigger). Found by Morten Welinder. (cherry picked from commit 73c870ed3209b68b5c8c350534508cc9d95a6bcb)
* fix search past the end of haystack in memmemTimo Teräs2014-04-161-0/+1
| | | | | | | | | | to optimize the search, memchr is used to find the first occurrence of the first character of the needle in the haystack before switching to a search for the full needle. however, the number of characters skipped by this first step were not subtracted from the haystack length, causing memmem to search past the end of the haystack. (cherry picked from commit 6fbdeff0e51f6afc38fbb1476a4db81322779da4)
* fix printf rounding with %g for some corner case midpointsRich Felker2014-04-161-1/+1
| | | | | | | | | | | | the subsequent rounding code assumes the end pointer (z) accurately reflects the end of significance in the decimal expansion, but for certain large integers, spurious trailing zero slots were left behind when applying the binary exponent. issue reported by Morten Welinder; the analysis of the cause was performed by nsz, who also proposed this change. (cherry picked from commit e94d0692864ecf9522fd6a97610a47a2f718d3de)
* fix failure of printf %g to strip trailing zeros in some casesRich Felker2014-04-161-1/+1
| | | | | | | | | | | | | | the code to strip trailing zeros was only looking in the last slot for up to 9 zeros, assuming that the rounding code had already removed fully-zero slots from the end. however, this ignored cases where the rounding code did not run at all, which occur when the value being printed is exactly representable in the requested precision. the simplest solution is to move the code that strips trailing zero slots to run unconditionally, immediately after rounding, rather than as the last step of rounding. (cherry picked from commit 89740868c9f1c84b8ee528468d12df1fa72cd392)
* fix carry into uninitialized slots during printf floating point roundingRich Felker2014-04-161-1/+1
| | | | | | | | | | | | | | | in cases where rounding caused a carry, the slot into which the carry was taking place was unconditionally treated as valid, despite the possibility that it could be a new slot prior to the beginning of the existing non-rounded number. in theory this could lead to unbounded runaway carry, but in order for that to happen, the whole uninitialized buffer would need to have been pre-filled with 32-bit integer values greater than or equal to 999999999. patch based on proposed fix by Morten Welinder, who also discovered and reported the bug. (cherry picked from commit 109048e031f39fbb370211fde44ababf6c04c8fb)
* fix microblaze syscall register clobbersRich Felker2014-04-161-7/+7
| | | | | | | | | | | the kernel entry point for syscalls on microblaze nominally saves and restores all registers, and testing on qemu always worked since qemu behaves this way too. however, the real kernel treats r3:r4 as a potential 64-bit return value from the syscall function, and copies both over top of the saved registers before returning to userspace. thus, we need to treat r4 as always-clobbered. (cherry picked from commit 91d5aa06572d2660122f9a06ed242fef0383f292)
* fix confstr return valueTimo Teräs2014-04-161-1/+1
| | | | | | per the specification, the terminating null byte is counted. (cherry picked from commit 0a8d98285f46f721dabf38485df916c02d6a4675)
* include header that declares __syscall_ret where it's definedRich Felker2014-04-161-0/+1
| | | | | | | | | | | | | | in general, we aim to always include the header that's declaring a function before defining it so that the compiler can check that prototypes match. additionally, the internal syscall.h declares __syscall_ret with a visibility attribute to improve code generation for shared libc (to prevent gratuitous GOT-register loads). this declaration should be visible at the point where __syscall_ret is defined, too, or the inconsistency could theoretically lead to problems at link-time. (cherry picked from commit 30c1205acd73c8481ca34f0a41de1d41884d07b5)
* release 1.0.0 v1.0.0Rich Felker2014-03-202-1/+43
|
* remove claim of XSI coverage from READMERich Felker2014-03-201-2/+1
| | | | | | in addition to the dbm functions (which we don't intent to implement anyway), fmtmsg is still missing too. rather than adding exceptions I think it's best just to avoid making the claim.
* update README in preparation for releaseRich Felker2014-03-201-59/+21
| | | | | reduces the amount of news-like content on progress and development direction and focuses on the present.
* update INSTALL file with new information and better adviceRich Felker2014-03-201-109/+114
| | | | | | | | the text covering an ill-advised procedure for 'bootstrapping' a new musl-based system in-place is removed. new information on targets and compilers is added. formatting improved. the remaining text is adjusted to cover both usage with musl-gcc on a non-musl-based system and upgrading a musl-based system or toolchain.
* update COPYRIGHT file with additional contributor informationRich Felker2014-03-201-22/+54
|
* configure: check for __ILP32__ if arch is x86_64rofl0r2014-03-191-0/+4
| | | | | otherwise a multilib compiler used with -mx32 will not be detected properly.
* fix signal.h breakage from moving stack_t to arch-specific bitsRich Felker2014-03-189-48/+50
| | | | | | in the previous changes, I missed the fact that both the prototype of the sigaltstack function and the definition of ucontext_t depend on stack_t.
* fix mips stack_tRich Felker2014-03-181-1/+1
| | | | like almost everything on mips, this is gratuitously different.
* move signal.h definition of stack_t to arch-specific bitsRich Felker2014-03-189-6/+48
| | | | | it's different at least on mips. mips version will be fixed in a separate commit to show the change.
* fix mips sigsetjmp asm to match fixed jmp_buf sizeRich Felker2014-03-181-1/+1
| | | | this was missed in the previous commit.
* fix typo in filename used in sh portRich Felker2014-03-181-0/+0
|
* fix size of mips jmp_bufRich Felker2014-03-181-1/+1
| | | | | | | | | | | the excess space was unused and unintentional. this change does not affect the ABI between applications and libc. while it does theoretically affect linkage between third-party translation units using jmp_buf as part of a structure, we've already changed jmp_buf at least once on all archs, and problems were never observed, likely because such usage would be very unusual. in any case it's best to get things right now rather than making changes sometime during the 1.0.x series or later.
* remove useless and incorrect uc_regspace member from mips ucontext_tRich Felker2014-03-181-1/+0
| | | | | | this seems to have been copied erroneously from the arm version of the file. it's fairly harmless but it's a mistake and better to fix now than later.
* use syscall_arg_t for arguments in public syscall() functionRich Felker2014-03-181-7/+7
| | | | | | | on x32, this change allows programs which use syscall() with pointers or 64-bit values as arguments to work correctly, i.e. without truncation or incorrect sign extension. on all other supported archs, syscall_arg_t is defined as long, so this change is a no-op.
* make configure accept alternate gcc tuples for x32Rich Felker2014-03-171-1/+1
| | | | | | | | the previous pattern required "x32" to be used as the second field of the gcc tuple, which is usually reserved for vendor use and not appropriate as an ABI specifier. with this change, putting "x32" at the end of the tuple, the way ABI specifiers are normally done, is also permitted.
* x32: fix struct statfsrofl0r2014-03-171-2/+4
| | | | | the omission of the padding was uncovered by the latest regression statvfs regression test added to libc-test.
* fix negated error codes from ptsname_rRich Felker2014-03-171-1/+1
| | | | | | the incorrect error codes also made their way into errno when __ptsname_r was called by plain ptsname, which reports errors via errno rather than a return value.
* superh: fix dynamic linking of __fpscr_valuesBobby Bingham2014-03-162-1/+7
| | | | | | | | | | | | | | Applications ended up with copy relocations for this array, which resulted in libc's references to this array pointing to the application's copy. The dynamic linker, however, can require this array before the application is relocated, and therefore before the application's copy of this array is initialized. This resulted in garbage being loaded into FPSCR before executing main, which violated the ABI. We fix this by putting the array in crt1 and making the libc copy private. This prevents libc's reference to the array from pointing to an uninitialized copy in the application.
* semctl: fix UB causing crashes on powerpcrofl0r2014-03-131-4/+8
| | | | | | | | it's UB to fetch variadic args when none are passed, and this caused real crashes on ppc due to its calling convention, which defines that for variadic functions aggregate types be passed as pointers. the assignment caused that pointer to get dereferenced, resulting in a crash.
* fix statfs struct on mipsSzabolcs Nagy2014-03-121-3/+4
| | | | | | The mips statfs struct layout is different than on other archs, so the statfs, fstatfs, statvfs and fstatvfs APIs were broken on mips. Now the ordering is fixed, the types are kept consistent with other archs.