From 6d153c48a17487a1bd2ae47a1d6be8df28c21130 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Sat, 16 Nov 2013 06:34:39 +1000 Subject: alpha: Fix signal thunk unwind info --- ports/ChangeLog.alpha | 5 +++++ ports/sysdeps/unix/sysv/linux/alpha/rt_sigaction.S | 18 ++++++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/ports/ChangeLog.alpha b/ports/ChangeLog.alpha index 4a4db09fb8..0fc0a4b775 100644 --- a/ports/ChangeLog.alpha +++ b/ports/ChangeLog.alpha @@ -1,3 +1,8 @@ +2013-11-16 Richard Henderson + + * sysdeps/unix/sysv/linux/alpha/rt_sigaction.S: Include a nop + before each signal thunk. + 2013-07-02 Richard Henderson * sysdeps/alpha/fpu/libm-test-ulps: Update. diff --git a/ports/sysdeps/unix/sysv/linux/alpha/rt_sigaction.S b/ports/sysdeps/unix/sysv/linux/alpha/rt_sigaction.S index 3d291fd0b4..6efa7386d5 100644 --- a/ports/sysdeps/unix/sysv/linux/alpha/rt_sigaction.S +++ b/ports/sysdeps/unix/sysv/linux/alpha/rt_sigaction.S @@ -83,14 +83,21 @@ PSEUDO_END(__syscall_rt_sigaction) cfi_offset (64, \base + 2 * 8) .endm - .align 4 - cfi_startproc cfi_return_column (64) .cfi_signal_frame SIGCONTEXT_REGS -648 - cfi_def_cfa_offset (648) + + /* While this frame is marked as a signal frame, that only applies + to how this return address is handled for the outer frame. + The return address that arrived here, from the inner frame, is + not marked as a signal frame and so the unwinder still tries to + subtract 1 to examine the presumed call insn. Thus we must + extend the unwind info to a nop before the start. */ + nop + .align 4 + __syscall_sigreturn: mov sp, a0 ldi v0, __NR_sigreturn @@ -98,8 +105,11 @@ __syscall_sigreturn: .size __syscall_sigreturn, .-__syscall_sigreturn .type __syscall_sigreturn, @function - .align 4 + /* See above wrt including the nop. */ cfi_def_cfa_offset (176 + 648) + nop + .align 4 + __syscall_rt_sigreturn: mov sp,a0 ldi v0,__NR_rt_sigreturn -- cgit 1.4.1 From ca0dd6386ed2b5c5c6ca392547628a1228432ae0 Mon Sep 17 00:00:00 2001 From: Marcus Shawcroft Date: Wed, 18 Dec 2013 10:00:07 +0000 Subject: [AArch64] Save and restore q0-q7 on entry to dynamic linker. [BZ #15128] Ensure all argument passing registers are saved and restored on entry to dynamic linker. (cherry picked from commit 9dbebe1a67bbedfcb39c6b739f15bc639e8d40a2) Conflicts: NEWS --- NEWS | 2 +- ports/ChangeLog.aarch64 | 6 ++++++ ports/sysdeps/aarch64/dl-trampoline.S | 28 ++++++++++++++++++++++++---- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index df97235ac8..6c7aaa7c21 100644 --- a/NEWS +++ b/NEWS @@ -9,7 +9,7 @@ Version 2.18.1 * The following bugs are resolved with this release: - 15909, 15996, 16150. + 15128, 15909, 15996, 16150. Version 2.18 diff --git a/ports/ChangeLog.aarch64 b/ports/ChangeLog.aarch64 index 537ae601e0..dbb330bc9c 100644 --- a/ports/ChangeLog.aarch64 +++ b/ports/ChangeLog.aarch64 @@ -1,3 +1,9 @@ +2013-12-18 Marcus Shawcroft + + [BZ #15128] + * sysdeps/aarch64/dl-trampoline.S (_dl_runtime_resolve): Save and + restore q0-q7. + 2013-07-26 Marcus Shawcroft * sysdeps/aarch64/Versions: New file. diff --git a/ports/sysdeps/aarch64/dl-trampoline.S b/ports/sysdeps/aarch64/dl-trampoline.S index 94c69a0e2d..923ca76afc 100644 --- a/ports/sysdeps/aarch64/dl-trampoline.S +++ b/ports/sysdeps/aarch64/dl-trampoline.S @@ -41,7 +41,7 @@ _dl_runtime_resolve: cfi_rel_offset (lr, 8) /* Save arguments. */ - stp x8, x9, [sp, #-80]! + stp x8, x9, [sp, #-(80+8*16)]! cfi_adjust_cfa_offset (80) cfi_rel_offset (x8, 0) cfi_rel_offset (x9, 8) @@ -62,11 +62,27 @@ _dl_runtime_resolve: cfi_rel_offset (x0, 64) cfi_rel_offset (x1, 72) + stp q0, q1, [sp, #(80+0*16)] + cfi_rel_offset (q0, 80+0*16) + cfi_rel_offset (q1, 80+1*16) + + stp q2, q3, [sp, #(80+2*16)] + cfi_rel_offset (q0, 80+2*16) + cfi_rel_offset (q1, 80+3*16) + + stp q4, q5, [sp, #(80+4*16)] + cfi_rel_offset (q0, 80+4*16) + cfi_rel_offset (q1, 80+5*16) + + stp q6, q7, [sp, #(80+6*16)] + cfi_rel_offset (q0, 80+6*16) + cfi_rel_offset (q1, 80+7*16) + /* Get pointer to linker struct. */ ldr x0, [ip0, #-8] /* Prepare to call _dl_fixup(). */ - ldr x1, [sp, 80] /* Recover &PLTGOT[n] */ + ldr x1, [sp, 80+8*16] /* Recover &PLTGOT[n] */ sub x1, x1, ip0 add x1, x1, x1, lsl #1 @@ -81,12 +97,16 @@ _dl_runtime_resolve: mov ip0, x0 /* Get arguments and return address back. */ + ldp q0, q1, [sp, #(80+0*16)] + ldp q2, q3, [sp, #(80+2*16)] + ldp q4, q5, [sp, #(80+4*16)] + ldp q6, q7, [sp, #(80+6*16)] ldp x0, x1, [sp, #64] ldp x2, x3, [sp, #48] ldp x4, x5, [sp, #32] ldp x6, x7, [sp, #16] - ldp x8, x9, [sp], #80 - cfi_adjust_cfa_offset (-80) + ldp x8, x9, [sp], #(80+8*16) + cfi_adjust_cfa_offset (-(80+8*16)) ldp ip1, lr, [sp], #16 cfi_adjust_cfa_offset (-16) -- cgit 1.4.1 From 8b43a2274a593ce91e673db1cfac6e808134bc84 Mon Sep 17 00:00:00 2001 From: Maxim Kuvyrkov Date: Tue, 24 Dec 2013 09:44:50 +1300 Subject: Fix race in free() of fastbin chunk: BZ #15073 Perform sanity check only if we have_lock. Due to lockless nature of fastbins we need to be careful derefencing pointers to fastbin entries (chunksize(old) in this case) in multithreaded environments. The fix is to add have_lock to the if-condition checks. The rest of the patch only makes code more readable. * malloc/malloc.c (_int_free): Perform sanity check only if we have_lock. Conflicts: ChangeLog NEWS --- ChangeLog | 7 +++++++ NEWS | 2 +- malloc/malloc.c | 20 ++++++++++++-------- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1e5efa74c0..74d433076e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2014-01-04 Maxim Kuvyrkov + Ondřej Bílka + + [BZ #15073] + * malloc/malloc.c (_int_free): Perform sanity check only if we + have_lock. + 2013-11-11 David S. Miller [BZ #16150] diff --git a/NEWS b/NEWS index 6c7aaa7c21..29856cc046 100644 --- a/NEWS +++ b/NEWS @@ -9,7 +9,7 @@ Version 2.18.1 * The following bugs are resolved with this release: - 15128, 15909, 15996, 16150. + 15073, 15128, 15909, 15996, 16150. Version 2.18 diff --git a/malloc/malloc.c b/malloc/malloc.c index be472b2ba3..8a0eb854e2 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -3809,25 +3809,29 @@ _int_free(mstate av, mchunkptr p, int have_lock) unsigned int idx = fastbin_index(size); fb = &fastbin (av, idx); - mchunkptr fd; - mchunkptr old = *fb; + /* Atomically link P to its fastbin: P->FD = *FB; *FB = P; */ + mchunkptr old = *fb, old2; unsigned int old_idx = ~0u; do { - /* Another simple check: make sure the top of the bin is not the - record we are going to add (i.e., double free). */ + /* Check that the top of the bin is not the record we are going to add + (i.e., double free). */ if (__builtin_expect (old == p, 0)) { errstr = "double free or corruption (fasttop)"; goto errout; } - if (old != NULL) + /* Check that size of fastbin chunk at the top is the same as + size of the chunk that we are adding. We can dereference OLD + only if we have the lock, otherwise it might have already been + deallocated. See use of OLD_IDX below for the actual check. */ + if (have_lock && old != NULL) old_idx = fastbin_index(chunksize(old)); - p->fd = fd = old; + p->fd = old2 = old; } - while ((old = catomic_compare_and_exchange_val_rel (fb, p, fd)) != fd); + while ((old = catomic_compare_and_exchange_val_rel (fb, p, old2)) != old2); - if (fd != NULL && __builtin_expect (old_idx != idx, 0)) + if (have_lock && old != NULL && __builtin_expect (old_idx != idx, 0)) { errstr = "invalid fastbin entry (free)"; goto errout; -- cgit 1.4.1 From a244697f97107af77f26eb7e4dfc4538c7e68b27 Mon Sep 17 00:00:00 2001 From: Marcus Shawcroft Date: Tue, 7 Jan 2014 10:12:35 +0000 Subject: [AArch64] Fix CFA adjustment on dynamic linker entry. --- ports/ChangeLog.aarch64 | 5 +++++ ports/sysdeps/aarch64/dl-trampoline.S | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ports/ChangeLog.aarch64 b/ports/ChangeLog.aarch64 index dbb330bc9c..89cc504fe4 100644 --- a/ports/ChangeLog.aarch64 +++ b/ports/ChangeLog.aarch64 @@ -1,3 +1,8 @@ +2014-01-07 Marcus Shawcroft + + * sysdeps/aarch64/dl-trampoline.S (_dl_runtime_resolve): Correct + cfi_adjust_cfa_offset offset. + 2013-12-18 Marcus Shawcroft [BZ #15128] diff --git a/ports/sysdeps/aarch64/dl-trampoline.S b/ports/sysdeps/aarch64/dl-trampoline.S index 923ca76afc..fc5ec83424 100644 --- a/ports/sysdeps/aarch64/dl-trampoline.S +++ b/ports/sysdeps/aarch64/dl-trampoline.S @@ -42,7 +42,7 @@ _dl_runtime_resolve: /* Save arguments. */ stp x8, x9, [sp, #-(80+8*16)]! - cfi_adjust_cfa_offset (80) + cfi_adjust_cfa_offset (80+8*16) cfi_rel_offset (x8, 0) cfi_rel_offset (x9, 8) -- cgit 1.4.1 From 0553c6642be2cdf6bac776fac5fd50164cb28709 Mon Sep 17 00:00:00 2001 From: Marcus Shawcroft Date: Tue, 7 Jan 2014 16:16:35 +0000 Subject: [AArch64] Fix FP_ROUNDMODE. [BZ #16387] Fix FP_ROUNDMODE to extract the correct bits from FPCR. Conflicts: NEWS --- NEWS | 2 +- ports/ChangeLog.aarch64 | 7 +++++++ ports/sysdeps/aarch64/fpu/fpu_control.h | 3 +++ ports/sysdeps/aarch64/soft-fp/sfp-machine.h | 2 +- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 29856cc046..2e8bb1684e 100644 --- a/NEWS +++ b/NEWS @@ -9,7 +9,7 @@ Version 2.18.1 * The following bugs are resolved with this release: - 15073, 15128, 15909, 15996, 16150. + 15073, 15128, 15909, 15996, 16150, 16387. Version 2.18 diff --git a/ports/ChangeLog.aarch64 b/ports/ChangeLog.aarch64 index 89cc504fe4..ce2fd5cf5e 100644 --- a/ports/ChangeLog.aarch64 +++ b/ports/ChangeLog.aarch64 @@ -1,3 +1,10 @@ +2014-01-07 Marcus Shawcroft + + [BZ #16387] + * sysdeps/aarch64/fpu/fpu_control.h (_FPU_FPCR_RM_MASK): Define. + * sysdeps/aarch64/soft-fp/sfp-machine.h (FP_ROUNDMODE): Adjust + rounding mode mask. + 2014-01-07 Marcus Shawcroft * sysdeps/aarch64/dl-trampoline.S (_dl_runtime_resolve): Correct diff --git a/ports/sysdeps/aarch64/fpu/fpu_control.h b/ports/sysdeps/aarch64/fpu/fpu_control.h index 89ff7e129d..37059261f7 100644 --- a/ports/sysdeps/aarch64/fpu/fpu_control.h +++ b/ports/sysdeps/aarch64/fpu/fpu_control.h @@ -59,6 +59,9 @@ E E D D E E */ + +#define _FPU_FPCR_RM_MASK 0xc00000 + #define _FPU_FPCR_MASK_IXE 0x1000 #define _FPU_FPCR_MASK_UFE 0x0800 #define _FPU_FPCR_MASK_OFE 0x0400 diff --git a/ports/sysdeps/aarch64/soft-fp/sfp-machine.h b/ports/sysdeps/aarch64/soft-fp/sfp-machine.h index d21d00a934..9bb94e5ccc 100644 --- a/ports/sysdeps/aarch64/soft-fp/sfp-machine.h +++ b/ports/sysdeps/aarch64/soft-fp/sfp-machine.h @@ -47,7 +47,7 @@ #define _FP_DECL_EX fpu_control_t _fcw -#define FP_ROUNDMODE (_fcw & 0x3) +#define FP_ROUNDMODE (_fcw & _FPU_FPCR_RM_MASK) #define FP_RND_NEAREST FE_TONEAREST #define FP_RND_ZERO FE_TOWARDZERO -- cgit 1.4.1 From 2a8396b962b8c57a2581023b62766a3ac44c3ba4 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Mon, 20 Jan 2014 11:05:22 -0800 Subject: Include generic symbol-hacks.h for x32 In BZ #15605 fix with addding memset/memmove alias in symbol-hacks.h, x32 symbol-hacks.h change was missing. Fixed by including in x32 symbol-hacks.h. --- ChangeLog | 5 +++++ sysdeps/x86_64/x32/symbol-hacks.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 74d433076e..15ce0b6aa2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-01-20 H.J. Lu + + [BZ #15605] + * sysdeps/x86_64/x32/symbol-hacks.h: Include generic symbol-hacks.h. + 2014-01-04 Maxim Kuvyrkov Ondřej Bílka diff --git a/sysdeps/x86_64/x32/symbol-hacks.h b/sysdeps/x86_64/x32/symbol-hacks.h index bc7b4c4441..22aad04437 100644 --- a/sysdeps/x86_64/x32/symbol-hacks.h +++ b/sysdeps/x86_64/x32/symbol-hacks.h @@ -1 +1 @@ -/* Fortunately nothing to do. */ +#include -- cgit 1.4.1 From c616775d2c6df31786b71b4e135fba90b4a63f89 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 20 Jan 2014 12:58:03 +0000 Subject: [AArch64] BZ #16169 Add CFI directives to clone.S [BZ #16169] Add CFI directives to the AArch64 clone.S implementation and ensure that the FP in the child is zero'd in order to comply with AAPCS. (cherry picked from commit 3a3acb6afc753475675b5724f206e619d0c9590d) Conflicts: NEWS --- NEWS | 2 +- ports/ChangeLog.aarch64 | 6 ++++++ ports/sysdeps/unix/sysv/linux/aarch64/clone.S | 7 ++++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 2e8bb1684e..c914dadd53 100644 --- a/NEWS +++ b/NEWS @@ -9,7 +9,7 @@ Version 2.18.1 * The following bugs are resolved with this release: - 15073, 15128, 15909, 15996, 16150, 16387. + 15073, 15128, 15909, 15996, 16150, 16169, 16387. Version 2.18 diff --git a/ports/ChangeLog.aarch64 b/ports/ChangeLog.aarch64 index ce2fd5cf5e..89259326d6 100644 --- a/ports/ChangeLog.aarch64 +++ b/ports/ChangeLog.aarch64 @@ -1,3 +1,9 @@ +2014-01-20 Tom Tromey + + [BZ #16169] + * sysdeps/unix/sysv/linux/aarch64/clone.S (__clone): Add CFI + directives; Zero x29. + 2014-01-07 Marcus Shawcroft [BZ #16387] diff --git a/ports/sysdeps/unix/sysv/linux/aarch64/clone.S b/ports/sysdeps/unix/sysv/linux/aarch64/clone.S index b359e6e8a3..7d8816977f 100644 --- a/ports/sysdeps/unix/sysv/linux/aarch64/clone.S +++ b/ports/sysdeps/unix/sysv/linux/aarch64/clone.S @@ -63,6 +63,7 @@ ENTRY(__clone) mov x8, #SYS_ify(clone) /* X0:flags, x1:newsp, x2:parenttidptr, x3:newtls, x4:childtid. */ svc 0x0 + cfi_endproc cmp x0, #0 beq 2f blt 3f @@ -72,6 +73,9 @@ ENTRY(__clone) b syscall_error 2: + cfi_startproc + cfi_undefined (x30) + mov x29, 0 #ifdef RESET_PID tbnz x5, #CLONE_THREAD_BIT, 3f mov x0, #-1 @@ -93,7 +97,8 @@ ENTRY(__clone) /* We are done, pass the return value through x0. */ b HIDDEN_JUMPTARGET(_exit) - + cfi_endproc + cfi_startproc PSEUDO_END (__clone) weak_alias (__clone, clone) -- cgit 1.4.1 From d680656b61891159d21a535f38219cf01d5edeea Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Wed, 29 Jan 2014 07:51:41 -0800 Subject: Disable x87 inline functions for SSE2 math When i386 and x86-64 mathinline.h was merged into a single mathinline.h, "gcc -m32" enables x87 inline functions on x86-64 even when -mfpmath=sse and SSE2 is enabled. It is a regression on x86-64. We should check __SSE2_MATH__ instead of __x86_64__ when disabling x87 inline functions. (cherry picked from commit 409e00bd69b8d8dd74d7327085351d26769ea6fc) Conflicts: ChangeLog NEWS --- ChangeLog | 6 ++++++ NEWS | 2 +- sysdeps/x86/fpu/bits/mathinline.h | 6 +++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 15ce0b6aa2..41f5d2eb89 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2014-01-29 H.J. Lu + + [BZ #16510] + * sysdeps/x86/fpu/bits/mathinline.h: Check __SSE2_MATH__ instead + of __x86_64__ when disabling x87 inline functions. + 2014-01-20 H.J. Lu [BZ #15605] diff --git a/NEWS b/NEWS index c914dadd53..a9920158c8 100644 --- a/NEWS +++ b/NEWS @@ -9,7 +9,7 @@ Version 2.18.1 * The following bugs are resolved with this release: - 15073, 15128, 15909, 15996, 16150, 16169, 16387. + 15073, 15128, 15909, 15996, 16150, 16169, 16387, 16510. Version 2.18 diff --git a/sysdeps/x86/fpu/bits/mathinline.h b/sysdeps/x86/fpu/bits/mathinline.h index fed64149fc..b4b28f30f1 100644 --- a/sysdeps/x86/fpu/bits/mathinline.h +++ b/sysdeps/x86/fpu/bits/mathinline.h @@ -1,5 +1,5 @@ /* Inline math functions for i387 and SSE. - Copyright (C) 1995-2013 Free Software Foundation, Inc. + Copyright (C) 1995-2014 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -384,7 +384,7 @@ __END_NAMESPACE_C99 # endif #endif -#ifndef __x86_64__ +#ifndef __SSE2_MATH__ # if ((!defined __NO_MATH_INLINES || defined __LIBC_INTERNAL_MATH_INLINES) \ && defined __OPTIMIZE__) @@ -970,4 +970,4 @@ __inline_mathcode2 (__ieee754_atan2, __y, __x, return __value;) # endif -#endif /* !__x86_64__ */ +#endif /* !__SSE2_MATH__ */ -- cgit 1.4.1 From bc273d38b147d67668e92a8f39dd696e28695c30 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Wed, 30 Apr 2014 12:57:51 -0700 Subject: Fix v9/64-bit strcmp when string ends in multiple zero bytes. [BZ #16885] * sysdeps/sparc/sparc64/strcmp.S: Fix end comparison handling when multiple zero bytes exist at the end of a string. Reported by Aurelien Jarno * string/test-strcmp.c (check): Add explicit test for situations where there are multiple zero bytes after the first. --- ChangeLog | 10 ++++++++++ string/test-strcmp.c | 28 ++++++++++++++++++++++++++++ sysdeps/sparc/sparc64/strcmp.S | 31 +++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+) diff --git a/ChangeLog b/ChangeLog index 41f5d2eb89..15d560f36f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2014-05-01 David S. Miller + + [BZ #16885] + * sysdeps/sparc/sparc64/strcmp.S: Fix end comparison handling when + multiple zero bytes exist at the end of a string. + Reported by Aurelien Jarno + + * string/test-strcmp.c (check): Add explicit test for situations where + there are multiple zero bytes after the first. + 2014-01-29 H.J. Lu [BZ #16510] diff --git a/string/test-strcmp.c b/string/test-strcmp.c index f666993929..d4fb82a598 100644 --- a/string/test-strcmp.c +++ b/string/test-strcmp.c @@ -329,6 +329,34 @@ check (void) FOR_EACH_IMPL (impl, 0) check_result (impl, s1 + i1, s2 + i2, exp_result); } + + /* Test cases where there are multiple zero bytes after the first. */ + + for (size_t i = 0; i < 16 + 1; i++) + { + s1[i] = 0x00; + s2[i] = 0x00; + } + + for (size_t i = 0; i < 16; i++) + { + int exp_result; + + for (int val = 0x01; val < 0x100; val++) + { + for (size_t j = 0; j < i; j++) + { + s1[j] = val; + s2[j] = val; + } + + s2[i] = val; + + exp_result = SIMPLE_STRCMP (s1, s2); + FOR_EACH_IMPL (impl, 0) + check_result (impl, s1, s2, exp_result); + } + } } diff --git a/sysdeps/sparc/sparc64/strcmp.S b/sysdeps/sparc/sparc64/strcmp.S index a36992e437..0b90f575a5 100644 --- a/sysdeps/sparc/sparc64/strcmp.S +++ b/sysdeps/sparc/sparc64/strcmp.S @@ -121,6 +121,37 @@ ENTRY(strcmp) movleu %xcc, -1, %o0 srlx rTMP1, 7, rTMP1 + /* In order not to be influenced by bytes after the zero byte, we + * have to retain only the highest bit in the mask for the comparison + * with rSTRXOR to work properly. + */ + mov 0, rTMP2 + andcc rTMP1, 0x0100, %g0 + + movne %xcc, 8, rTMP2 + sllx rTMP1, 63 - 16, %o1 + + movrlz %o1, 16, rTMP2 + sllx rTMP1, 63 - 24, %o1 + + movrlz %o1, 24, rTMP2 + sllx rTMP1, 63 - 32, %o1 + + movrlz %o1, 32, rTMP2 + sllx rTMP1, 63 - 40, %o1 + + movrlz %o1, 40, rTMP2 + sllx rTMP1, 63 - 48, %o1 + + movrlz %o1, 48, rTMP2 + sllx rTMP1, 63 - 56, %o1 + + movrlz %o1, 56, rTMP2 + + srlx rTMP1, rTMP2, rTMP1 + + sllx rTMP1, rTMP2, rTMP1 + cmp rTMP1, rSTRXOR retl movgu %xcc, 0, %o0 -- cgit 1.4.1 From 25394eff67a3119011ffa04a1986be130a6b628d Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Thu, 1 May 2014 16:44:25 -0400 Subject: NEWS: Add 16885 to fixed bug list. --- NEWS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS b/NEWS index a9920158c8..5e0f699908 100644 --- a/NEWS +++ b/NEWS @@ -9,7 +9,7 @@ Version 2.18.1 * The following bugs are resolved with this release: - 15073, 15128, 15909, 15996, 16150, 16169, 16387, 16510. + 15073, 15128, 15909, 15996, 16150, 16169, 16387, 16510, 16885. Version 2.18 -- cgit 1.4.1 From 3ce4555d432282fcfe963cc8809163e85ee0f71c Mon Sep 17 00:00:00 2001 From: Aurelien Jarno Date: Tue, 6 May 2014 23:31:44 +0200 Subject: SPARC: add EFD_SEMAPHORE in (BZ #16916) EFD_SEMAPHORE has been added in the main , but not in the SPARC specific version. Fix that. (cherry picked from commit 83df9ad0cc861ef24f08a88c5a4c055e2516d33c) --- ChangeLog | 6 ++++++ NEWS | 2 +- sysdeps/unix/sysv/linux/sparc/bits/eventfd.h | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 15d560f36f..961f0dd40c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2014-05-06 Aurelien Jarno + + [BZ# 16916] + * sysdeps/unix/sysv/linux/sparc/bits/eventfd.h (EFD_SEMAPHORE): + Define. + 2014-05-01 David S. Miller [BZ #16885] diff --git a/NEWS b/NEWS index 5e0f699908..93175e1792 100644 --- a/NEWS +++ b/NEWS @@ -9,7 +9,7 @@ Version 2.18.1 * The following bugs are resolved with this release: - 15073, 15128, 15909, 15996, 16150, 16169, 16387, 16510, 16885. + 15073, 15128, 15909, 15996, 16150, 16169, 16387, 16510, 16885, 16916. Version 2.18 diff --git a/sysdeps/unix/sysv/linux/sparc/bits/eventfd.h b/sysdeps/unix/sysv/linux/sparc/bits/eventfd.h index b0234d1a20..e348cc6fb6 100644 --- a/sysdeps/unix/sysv/linux/sparc/bits/eventfd.h +++ b/sysdeps/unix/sysv/linux/sparc/bits/eventfd.h @@ -22,6 +22,8 @@ /* Flags for eventfd. */ enum { + EFD_SEMAPHORE = 0x000001, +#define EFD_SEMAPHORE EFD_SEMAPHORE EFD_CLOEXEC = 0x400000, #define EFD_CLOEXEC EFD_CLOEXEC EFD_NONBLOCK = 0x004000 -- cgit 1.4.1 From d56700df46977b14e9fe54201132fed04475cd03 Mon Sep 17 00:00:00 2001 From: Aurelien Jarno Date: Fri, 16 May 2014 00:04:41 +0200 Subject: SPARC: add prlimit and prlimit64 in (BZ #16943) prlimit and prlimit64 have been added in the main , but not in the SPARC specific version. Fix that. Note: this is Debian bug#703559, reported by Emilio Pozuelo Monfort (cherry picked from commit d16e6ec7ca2c861ba681e3a2fbd431725774292e) --- ChangeLog | 6 ++++++ NEWS | 3 ++- sysdeps/unix/sysv/linux/sparc/bits/resource.h | 27 +++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 961f0dd40c..f008fb468d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2014-05-16 Aurelien Jarno + + [BZ #16943] + * sysdeps/unix/sysv/linux/sparc/bits/resource.h: Declare prlimit + and prlimit64. + 2014-05-06 Aurelien Jarno [BZ# 16916] diff --git a/NEWS b/NEWS index 93175e1792..482561767f 100644 --- a/NEWS +++ b/NEWS @@ -9,7 +9,8 @@ Version 2.18.1 * The following bugs are resolved with this release: - 15073, 15128, 15909, 15996, 16150, 16169, 16387, 16510, 16885, 16916. + 15073, 15128, 15909, 15996, 16150, 16169, 16387, 16510, 16885, 16916, + 16943. Version 2.18 diff --git a/sysdeps/unix/sysv/linux/sparc/bits/resource.h b/sysdeps/unix/sysv/linux/sparc/bits/resource.h index 14c2b70ad3..cee1c0fe88 100644 --- a/sysdeps/unix/sysv/linux/sparc/bits/resource.h +++ b/sysdeps/unix/sysv/linux/sparc/bits/resource.h @@ -252,3 +252,30 @@ enum __priority_which PRIO_USER = 2 /* WHO is a user ID. */ #define PRIO_USER PRIO_USER }; + +__BEGIN_DECLS + +#ifdef __USE_GNU +/* Modify and return resource limits of a process atomically. */ +# ifndef __USE_FILE_OFFSET64 +extern int prlimit (__pid_t __pid, enum __rlimit_resource __resource, + const struct rlimit *__new_limit, + struct rlimit *__old_limit) __THROW; +# else +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (prlimit, (__pid_t __pid, + enum __rlimit_resource __resource, + const struct rlimit *__new_limit, + struct rlimit *__old_limit), prlimit64); +# else +# define prlimit prlimit64 +# endif +# endif +# ifdef __USE_LARGEFILE64 +extern int prlimit64 (__pid_t __pid, enum __rlimit_resource __resource, + const struct rlimit64 *__new_limit, + struct rlimit64 *__old_limit) __THROW; +# endif +#endif + +__END_DECLS -- cgit 1.4.1 From f2b605ed8882a922c403386b2af7e7a5eecbf39f Mon Sep 17 00:00:00 2001 From: "Jose E. Marchesi" Date: Sat, 17 May 2014 11:20:27 -0700 Subject: Fix sparc memcpy data corruption when using niagara2 optimized routines. * sysdeps/sparc/sparc64/multiarch/memcpy-niagara2.S: Add missing membar to avoid block loads/stores to overlap previous stores. --- ChangeLog | 6 ++++++ NEWS | 2 +- sysdeps/sparc/sparc64/multiarch/memcpy-niagara2.S | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index f008fb468d..2a14ec2399 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2014-05-17 Jose E. Marchesi + + [BZ #16958] + * sysdeps/sparc/sparc64/multiarch/memcpy-niagara2.S: Add missing + membar to avoid block loads/stores to overlap previous stores. + 2014-05-16 Aurelien Jarno [BZ #16943] diff --git a/NEWS b/NEWS index 482561767f..4cbe73644e 100644 --- a/NEWS +++ b/NEWS @@ -10,7 +10,7 @@ Version 2.18.1 * The following bugs are resolved with this release: 15073, 15128, 15909, 15996, 16150, 16169, 16387, 16510, 16885, 16916, - 16943. + 16943, 16958. Version 2.18 diff --git a/sysdeps/sparc/sparc64/multiarch/memcpy-niagara2.S b/sysdeps/sparc/sparc64/multiarch/memcpy-niagara2.S index 594405051f..63ba0811d0 100644 --- a/sysdeps/sparc/sparc64/multiarch/memcpy-niagara2.S +++ b/sysdeps/sparc/sparc64/multiarch/memcpy-niagara2.S @@ -211,6 +211,7 @@ ENTRY(__memcpy_niagara2) */ VISEntryHalf + membar #Sync alignaddr %o1, %g0, %g0 add %o1, (64 - 1), %o4 -- cgit 1.4.1 From d4deb63367247eaddcbe10b872d39ff70659eaf4 Mon Sep 17 00:00:00 2001 From: Guo Yixuan Date: Tue, 3 Jun 2014 16:19:11 -0700 Subject: Fixed pthread_spin_lock on sparc32/64 (bug 16882) [BZ #16882] * nptl/sysdeps/sparc/sparc32/pthread_spin_lock.S (pthread_spin_lock): Branch out of spin loop to proper location. * nptl/sysdeps/sparc/sparc64/pthread_spin_lock.S (pthread_spin_lock): Likewise. * nptl/tst-spin4.c: New test. * nptl/Makefile (tests): Add tst-spin4. --- ChangeLog | 11 +++ NEWS | 2 +- nptl/Makefile | 2 +- nptl/sysdeps/sparc/sparc32/pthread_spin_lock.S | 4 +- nptl/sysdeps/sparc/sparc64/pthread_spin_lock.S | 4 +- nptl/tst-spin4.c | 109 +++++++++++++++++++++++++ 6 files changed, 126 insertions(+), 6 deletions(-) create mode 100644 nptl/tst-spin4.c diff --git a/ChangeLog b/ChangeLog index 2a14ec2399..9c95cc05b9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2014-06-03 Guo Yixuan + + [BZ #16882] + * nptl/sysdeps/sparc/sparc32/pthread_spin_lock.S + (pthread_spin_lock): Branch out of spin loop to proper location. + * nptl/sysdeps/sparc/sparc64/pthread_spin_lock.S + (pthread_spin_lock): Likewise. + + * nptl/tst-spin4.c: New test. + * nptl/Makefile (tests): Add tst-spin4. + 2014-05-17 Jose E. Marchesi [BZ #16958] diff --git a/NEWS b/NEWS index 4cbe73644e..31664e40cc 100644 --- a/NEWS +++ b/NEWS @@ -29,7 +29,7 @@ Version 2.18 15429, 15431, 15432, 15441, 15442, 15448, 15465, 15480, 15485, 15488, 15490, 15492, 15493, 15497, 15506, 15529, 15536, 15553, 15577, 15583, 15618, 15627, 15631, 15654, 15655, 15666, 15667, 15674, 15711, 15755, - 15759, 15985. + 15759, 15985, 16882. * CVE-2013-2207 Incorrectly granting access to another user's pseudo-terminal has been fixed by disabling the use of pt_chown (Bugzilla #15755). diff --git a/nptl/Makefile b/nptl/Makefile index cd601e5f5a..9f02c68506 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -208,7 +208,7 @@ tests = tst-typesizes \ tst-mutexpi1 tst-mutexpi2 tst-mutexpi3 tst-mutexpi4 tst-mutexpi5 \ tst-mutexpi5a tst-mutexpi6 tst-mutexpi7 tst-mutexpi7a tst-mutexpi8 \ tst-mutexpi9 \ - tst-spin1 tst-spin2 tst-spin3 \ + tst-spin1 tst-spin2 tst-spin3 tst-spin4 \ tst-cond1 tst-cond2 tst-cond3 tst-cond4 tst-cond5 tst-cond6 tst-cond7 \ tst-cond8 tst-cond9 tst-cond10 tst-cond11 tst-cond12 tst-cond13 \ tst-cond14 tst-cond15 tst-cond16 tst-cond17 tst-cond18 tst-cond19 \ diff --git a/nptl/sysdeps/sparc/sparc32/pthread_spin_lock.S b/nptl/sysdeps/sparc/sparc32/pthread_spin_lock.S index 7099f2984a..ad13681412 100644 --- a/nptl/sysdeps/sparc/sparc32/pthread_spin_lock.S +++ b/nptl/sysdeps/sparc/sparc32/pthread_spin_lock.S @@ -19,11 +19,11 @@ .text ENTRY(pthread_spin_lock) - ldstub [%o0], %g1 +1: ldstub [%o0], %g1 orcc %g1, 0x0, %g0 bne,a 2f ldub [%o0], %g1 -1: retl + retl mov 0, %o0 2: orcc %g1, 0x0, %g0 bne,a 2b diff --git a/nptl/sysdeps/sparc/sparc64/pthread_spin_lock.S b/nptl/sysdeps/sparc/sparc64/pthread_spin_lock.S index 11091e900b..8896a71c9a 100644 --- a/nptl/sysdeps/sparc/sparc64/pthread_spin_lock.S +++ b/nptl/sysdeps/sparc/sparc64/pthread_spin_lock.S @@ -19,10 +19,10 @@ .text ENTRY(pthread_spin_lock) - ldstub [%o0], %g1 +1: ldstub [%o0], %g1 brnz,pn %g1, 2f membar #StoreLoad | #StoreStore -1: retl + retl mov 0, %o0 2: ldub [%o0], %g1 brnz,pt %g1, 2b diff --git a/nptl/tst-spin4.c b/nptl/tst-spin4.c new file mode 100644 index 0000000000..5b23a172ca --- /dev/null +++ b/nptl/tst-spin4.c @@ -0,0 +1,109 @@ +#include +#include +#include + +static int count = 0; + +static void * +thread_add_one (void *arg) +{ + int tmp; + pthread_spinlock_t *lock = (pthread_spinlock_t *) arg; + + /* When do_test holds the lock for 1 sec, the two thread will be + in contention for the lock. */ + if (pthread_spin_lock (lock) != 0) + { + puts ("thread_add_one(): spin_lock failed"); + pthread_exit ((void *) 1l); + } + + /* sleep 1s before modifying count */ + tmp = count; + sleep (1); + count = tmp + 1; + + if (pthread_spin_unlock (lock) != 0) + { + puts ("thread_add_one(): spin_unlock failed"); + pthread_exit ((void *) 1l); + } + + return NULL; +} + +static int +do_test (void) +{ + pthread_t thr1, thr2; + pthread_spinlock_t lock; + int tmp; + + if (pthread_spin_init (&lock, PTHREAD_PROCESS_PRIVATE) != 0) + { + puts ("spin_init failed"); + return 1; + } + + if (pthread_spin_lock (&lock) != 0) + { + puts ("1st spin_lock failed"); + return 1; + } + + if (pthread_create (&thr1, NULL, thread_add_one, (void *) &lock) != 0) + { + puts ("1st pthread_create failed"); + return 1; + } + + if (pthread_create (&thr2, NULL, thread_add_one, (void *) &lock) != 0) + { + puts ("2nd pthread_create failed"); + return 1; + } + + /* sleep 1s before modifying count */ + tmp = count; + sleep (1); + count = tmp + 1; + + if (pthread_spin_unlock (&lock) != 0) + { + puts ("1st spin_unlock failed"); + return 1; + } + + void *status; + if (pthread_join (thr1, &status) != 0) + { + puts ("1st pthread_join failed"); + return 1; + } + if (status != NULL) + { + puts ("failure in the 1st thread"); + return 1; + } + if (pthread_join (thr2, &status) != 0) + { + puts ("2nd pthread_join failed"); + return 1; + } + if (status != NULL) + { + puts ("failure in the 2nd thread"); + return 1; + } + + if (count != 3) + { + printf ("count is %d, should be 3\n", count); + return 1; + } + return 0; +} + +#define TIMEOUT 5 +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" -- cgit 1.4.1