diff options
Diffstat (limited to 'libc/nptl')
23 files changed, 178 insertions, 63 deletions
diff --git a/libc/nptl/ChangeLog b/libc/nptl/ChangeLog index 7a9ce8e80..64b674c67 100644 --- a/libc/nptl/ChangeLog +++ b/libc/nptl/ChangeLog @@ -1,3 +1,47 @@ +2013-06-13 Siddhesh Poyarekar <siddhesh@redhat.com> + Carlos O'Donell <carlos@redhat.com> + + [BZ #15618] + * tst-pthread-attr-affinity: New test case. + * Makefile (tests): Add it. + * sysdeps/unix/sysv/linux/pthread_attr_getaffinity.c + (__pthread_attr_getaffinity_new): Copy minimum of source and + destination sizes to avoid a buffer overrun. + +2013-06-10 Carlos O'Donell <carlos@redhat.com> + + * sysdeps/unix/sysv/linux/i386/lowlevellock.h + (lll_futex_wake): Return syscall error. + * sysdeps/unix/sysv/linux/x86_64/lowlevellock.h + (lll_futex_wake): Return syscall error. + +2013-08-06 Ondřej Bílka <neleai@seznam.cz> + + * sysdeps/pthread/allocalim.h: (__libc_use_alloca): Fix warning. + +2013-06-06 Ondřej Bílka <neleai@seznam.cz> + + * tst-cond22.c: Fix leading whitespaces. + * tst-umask1.c: Likewise. + +2013-06-06 Joseph Myers <joseph@codesourcery.com> + + * sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S: Remove + trailing whitespace. + * sysdeps/unix/sysv/linux/powerpc/pt-longjmp.c: Likewise. + * sysdeps/unix/sysv/linux/sh/lowlevellock.h: Likewise. + * sysdeps/unix/sysv/linux/sh/pthread_barrier_wait.S: Likewise. + * sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S: Likewise. + * sysdeps/unix/sysv/linux/sh/pthread_cond_signal.S: Likewise. + * sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S: Likewise. + * sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S: Likewise. + * sysdeps/unix/sysv/linux/sh/pthread_once.S: Likewise. + * sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S: Likewise. + * sysdeps/unix/sysv/linux/sh/pthread_rwlock_unlock.S: Likewise. + * sysdeps/unix/sysv/linux/sparc/lowlevellock.h: Likewise. + * tst-mutexpp10.c: Likewise. + * tst-stackguard1.c: Likewise. + 2013-05-31 Joseph Myers <joseph@codesourcery.com> * Makefile ($(objpfx)libpthread.so): Remove dependencies on libc diff --git a/libc/nptl/Makefile b/libc/nptl/Makefile index 72ffa147b..812ae184b 100644 --- a/libc/nptl/Makefile +++ b/libc/nptl/Makefile @@ -256,6 +256,7 @@ tests = tst-typesizes \ tst-exit1 tst-exit2 tst-exit3 \ tst-stdio1 tst-stdio2 \ tst-stack1 tst-stack2 tst-stack3 tst-pthread-getattr \ + tst-pthread-attr-affinity \ tst-unload \ tst-dlsym1 \ tst-sysconf \ diff --git a/libc/nptl/sysdeps/pthread/allocalim.h b/libc/nptl/sysdeps/pthread/allocalim.h index 1ccd387ce..2396b836b 100644 --- a/libc/nptl/sysdeps/pthread/allocalim.h +++ b/libc/nptl/sysdeps/pthread/allocalim.h @@ -20,8 +20,8 @@ #include <limits.h> -extern int -__always_inline +extern __always_inline +int __libc_use_alloca (size_t size) { return (__builtin_expect (size <= PTHREAD_STACK_MIN / 4, 1) diff --git a/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S b/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S index bbc46cad3..68f237234 100644 --- a/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S +++ b/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S @@ -114,7 +114,7 @@ pthread_barrier_wait: cfi_adjust_cfa_offset(4) cfi_offset(%ebx, -8) - + /* The necessary number of threads arrived. */ 3: #if CURR_EVENT == 0 diff --git a/libc/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h b/libc/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h index f51f65092..f665ac9e6 100644 --- a/libc/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h +++ b/libc/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h @@ -224,20 +224,21 @@ LLL_STUB_UNWIND_INFO_END #define lll_futex_wake(futex, nr, private) \ - do { \ - int __ignore; \ + ({ \ + int __status; \ register __typeof (nr) _nr asm ("edx") = (nr); \ LIBC_PROBE (lll_futex_wake, 3, futex, nr, private); \ __asm __volatile (LLL_EBX_LOAD \ LLL_ENTER_KERNEL \ LLL_EBX_LOAD \ - : "=a" (__ignore) \ + : "=a" (__status) \ : "0" (SYS_futex), LLL_EBX_REG (futex), \ "c" (__lll_private_flag (FUTEX_WAKE, private)), \ "d" (_nr), \ "i" (0) /* phony, to align next arg's number */, \ "i" (offsetof (tcbhead_t, sysinfo))); \ - } while (0) + __status; \ + }) /* NB: in the lll_trylock macro we simply return the value in %eax diff --git a/libc/nptl/sysdeps/unix/sysv/linux/powerpc/pt-longjmp.c b/libc/nptl/sysdeps/unix/sysv/linux/powerpc/pt-longjmp.c index 7f9367081..ace858fd1 100644 --- a/libc/nptl/sysdeps/unix/sysv/linux/powerpc/pt-longjmp.c +++ b/libc/nptl/sysdeps/unix/sysv/linux/powerpc/pt-longjmp.c @@ -48,7 +48,7 @@ symbol_version (__novmx_siglongjmp,siglongjmp,GLIBC_2.3); symbol_version (__novmx_longjmp,longjmp,GLIBC_2.0); symbol_version (__novmx_siglongjmp,siglongjmp,GLIBC_2.0); # endif -#endif /* defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)) */ +#endif /* defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)) */ void __vmx_longjmp (jmp_buf env, int val) diff --git a/libc/nptl/sysdeps/unix/sysv/linux/pthread_attr_getaffinity.c b/libc/nptl/sysdeps/unix/sysv/linux/pthread_attr_getaffinity.c index 00bb29b3f..2a60f8e19 100644 --- a/libc/nptl/sysdeps/unix/sysv/linux/pthread_attr_getaffinity.c +++ b/libc/nptl/sysdeps/unix/sysv/linux/pthread_attr_getaffinity.c @@ -42,7 +42,12 @@ __pthread_attr_getaffinity_new (const pthread_attr_t *attr, size_t cpusetsize, if (((char *) iattr->cpuset)[cnt] != 0) return EINVAL; - void *p = mempcpy (cpuset, iattr->cpuset, iattr->cpusetsize); + /* Copy over the cpuset from the thread attribute object. Limit the copy + to the minimum of the source and destination sizes to prevent a buffer + overrun. If the destination is larger, fill the remaining space with + zeroes. */ + void *p = mempcpy (cpuset, iattr->cpuset, + MIN (iattr->cpusetsize, cpusetsize)); if (cpusetsize > iattr->cpusetsize) memset (p, '\0', cpusetsize - iattr->cpusetsize); } diff --git a/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h b/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h index 124fe68bd..486e02c15 100644 --- a/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h +++ b/libc/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h @@ -70,7 +70,7 @@ : (fl)) \ : ((fl) | (((private) ^ FUTEX_PRIVATE_FLAG) \ & THREAD_GETMEM (THREAD_SELF, header.private_futex)))) -# endif +# endif #endif #ifndef __ASSEMBLER__ diff --git a/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_barrier_wait.S b/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_barrier_wait.S index c10ec33f2..54209ceff 100644 --- a/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_barrier_wait.S +++ b/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_barrier_wait.S @@ -210,7 +210,7 @@ pthread_barrier_wait: bra 7b mov r9, r6 -9: +9: mov r6, r9 mov.l @(PRIVATE,r8), r5 mov #LLL_SHARED, r0 diff --git a/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S b/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S index ffdffbc6f..a5b4f9c6f 100644 --- a/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S +++ b/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S @@ -200,7 +200,7 @@ __pthread_cond_broadcast: bf/s 99f mov #LLL_PRIVATE, r6 mov #LLL_SHARED, r6 -99: +99: extu.b r6, r6 mov.l .Lwait5, r1 bsrf r1 @@ -220,7 +220,7 @@ __pthread_cond_broadcast: bf/s 99f mov #LLL_PRIVATE, r5 mov #LLL_SHARED, r5 -99: +99: mov.l .Lwake5, r1 bsrf r1 extu.b r5, r5 @@ -239,7 +239,7 @@ __pthread_cond_broadcast: bf/s 99f mov #LLL_PRIVATE, r5 mov #LLL_SHARED, r5 -99: +99: mov.l .Lwake6, r1 bsrf r1 extu.b r5, r5 @@ -263,7 +263,7 @@ __pthread_cond_broadcast: mov #FUTEX_WAKE, r0 or r0, r5 #endif -99: +99: mov #-1, r6 shlr r6 /* r6 = 0x7fffffff */ mov #0, r7 diff --git a/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_signal.S b/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_signal.S index 347c803ad..88d087045 100644 --- a/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_signal.S +++ b/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_signal.S @@ -162,7 +162,7 @@ __pthread_cond_signal: bf/s 99f mov #LLL_PRIVATE, r5 mov #LLL_SHARED, r5 -99: +99: mov.l .Lwake4, r1 bsrf r1 extu.b r5, r5 @@ -181,7 +181,7 @@ __pthread_cond_signal: bf/s 99f mov #LLL_PRIVATE, r6 mov #LLL_SHARED, r6 -99: +99: extu.b r6, r6 mov.l .Lwait4, r1 bsrf r1 diff --git a/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S b/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S index 196add285..2c21883f7 100644 --- a/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S +++ b/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S @@ -107,7 +107,7 @@ __pthread_cond_timedwait: bt 17f mov.l r9, @(dep_mutex,r8) -17: +17: /* Unlock the mutex. */ mov.l .Lmunlock1, r1 mov #0, r5 @@ -137,14 +137,14 @@ __pthread_cond_timedwait: mov.l @(cond_nwaiters,r8), r0 add r2, r0 mov.l r0, @(cond_nwaiters,r8) - + /* Get and store current wakeup_seq value. */ mov.l @(wakeup_seq,r8), r10 mov.l @(wakeup_seq+4,r8), r11 mov.l @(broadcast_seq,r8), r0 mov.l r0, @(4,r15) -8: +8: /* Get current time. */ #ifdef __NR_clock_gettime /* Get the clock number. */ @@ -168,7 +168,7 @@ __pthread_cond_timedwait: .L__NR_clock_gettime: .word __NR_clock_gettime -0: +0: #else mov r15, r4 add #16, r4 @@ -240,7 +240,7 @@ __pthread_cond_timedwait: mov #FUTEX_WAIT, r0 or r0, r5 #endif -99: +99: mov.l @(8,r15), r6 mov r8, r4 add #cond_futex, r4 @@ -364,15 +364,15 @@ __pthread_cond_timedwait: mov #FUTEX_WAKE, r0 or r0, r5 #endif -99: +99: mov #1, r6 mov #0, r7 mov #SYS_futex, r3 extu.b r3, r3 trapa #0x14 SYSCALL_INST_PAD - -25: + +25: #if cond_lock != 0 DEC (@(cond_lock,r8), r2) #else @@ -393,7 +393,7 @@ __pthread_cond_timedwait: bf 18f mov.l @(24,r15), r0 -18: +18: cfi_remember_state add #64, r15 cfi_adjust_cfa_offset (-64) @@ -449,7 +449,7 @@ __pthread_cond_timedwait: bf/s 99f mov #LLL_PRIVATE, r6 mov #LLL_SHARED, r6 -99: +99: extu.b r6, r6 mov.l .Lwait2, r1 bsrf r1 @@ -469,7 +469,7 @@ __pthread_cond_timedwait: bf/s 99f mov #LLL_PRIVATE, r5 mov #LLL_SHARED, r5 -99: +99: mov.l .Lmwait2, r1 bsrf r1 extu.b r5, r5 @@ -488,7 +488,7 @@ __pthread_cond_timedwait: bf/s 99f mov #LLL_PRIVATE, r6 mov #LLL_SHARED, r6 -99: +99: extu.b r6, r6 mov.l .Lwait3, r1 bsrf r1 @@ -508,7 +508,7 @@ __pthread_cond_timedwait: bf/s 99f mov #LLL_PRIVATE, r5 mov #LLL_SHARED, r5 -99: +99: mov.l .Lmwait3, r1 bsrf r1 extu.b r5, r5 @@ -536,7 +536,7 @@ __pthread_cond_timedwait: bf/s 99f mov #LLL_PRIVATE, r5 mov #LLL_SHARED, r5 -99: +99: mov.l .Lmwait4, r1 bsrf r1 extu.b r5, r5 @@ -585,7 +585,7 @@ __condvar_tw_cleanup: bf/s 99f mov #LLL_PRIVATE, r6 mov #LLL_SHARED, r6 -99: +99: extu.b r6, r6 mov.l .Lwait5, r1 bsrf r1 @@ -685,7 +685,7 @@ __condvar_tw_cleanup: bf/s 99f mov #LLL_PRIVATE, r5 mov #LLL_SHARED, r5 -99: +99: mov.l .Lmwait5, r1 bsrf r1 extu.b r5, r5 diff --git a/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S b/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S index 6859de57d..c56b8b1be 100644 --- a/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S +++ b/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S @@ -86,7 +86,7 @@ __pthread_cond_wait: .long _GLOBAL_OFFSET_TABLE_ #endif -2: +2: /* Store the reference to the mutex. If there is already a different value in there this is a bad user bug. */ mov.l @(dep_mutex,r8),r0 @@ -94,7 +94,7 @@ __pthread_cond_wait: bt 15f mov.l r9, @(dep_mutex,r8) -15: +15: /* Unlock the mutex. */ mov.l .Lmunlock0, r1 mov #0, r5 @@ -167,7 +167,7 @@ __pthread_cond_wait: mov #FUTEX_WAIT, r0 or r0, r5 #endif -99: +99: mov.l @(8,r15), r6 mov r8, r4 add #cond_futex, r4 @@ -179,7 +179,7 @@ __pthread_cond_wait: mov.l .Ldisable0, r1 bsrf r1 mov.l @r15, r4 -.Ldisable0b: +.Ldisable0b: .LcleanupEND: /* Lock. */ @@ -260,7 +260,7 @@ __pthread_cond_wait: mov #FUTEX_WAKE, r0 or r0, r5 #endif -99: +99: mov #1, r6 mov #0, r7 mov #SYS_futex, r3 @@ -333,7 +333,7 @@ __pthread_cond_wait: bf/s 99f mov #LLL_PRIVATE, r6 mov #LLL_SHARED, r6 -99: +99: extu.b r6, r6 mov.l .Lwait0, r1 bsrf r1 @@ -352,7 +352,7 @@ __pthread_cond_wait: bf/s 99f mov #LLL_PRIVATE, r5 mov #LLL_SHARED, r5 -99: +99: mov.l .Lwake0, r1 bsrf r1 extu.b r5, r5 @@ -371,7 +371,7 @@ __pthread_cond_wait: bf/s 99f mov #LLL_PRIVATE, r6 mov #LLL_SHARED, r6 -99: +99: extu.b r6, r6 mov.l .Lwait1, r1 bsrf r1 @@ -391,7 +391,7 @@ __pthread_cond_wait: bf/s 99f mov #LLL_PRIVATE, r5 mov #LLL_SHARED, r5 -99: +99: mov.l .Lwake1, r1 bsrf r1 extu.b r5, r5 @@ -419,7 +419,7 @@ __pthread_cond_wait: bf/s 99f mov #LLL_PRIVATE, r5 mov #LLL_SHARED, r5 -99: +99: mov.l .Lwake2, r1 bsrf r1 extu.b r5, r5 @@ -469,7 +469,7 @@ __condvar_w_cleanup: bf/s 99f mov #LLL_PRIVATE, r6 mov #LLL_SHARED, r6 -99: +99: extu.b r6, r6 mov.l .Lwait3, r1 bsrf r1 @@ -557,7 +557,7 @@ __condvar_w_cleanup: mov #FUTEX_WAKE, r0 or r0, r5 #endif -99: +99: mov #1, r6 mov #0, r7 mov #SYS_futex, r3 @@ -584,7 +584,7 @@ __condvar_w_cleanup: bf/s 99f mov #LLL_PRIVATE, r5 mov #LLL_SHARED, r5 -99: +99: mov.l .Lwake3, r1 bsrf r1 extu.b r5, r5 @@ -611,7 +611,7 @@ __condvar_w_cleanup: mov #FUTEX_WAKE, r0 or r0, r5 #endif -99: +99: mov #-1, r6 shlr r6 /* r6 = 0x7fffffff */ mov #0, r7 diff --git a/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_once.S b/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_once.S index 0ae918321..99c96e35f 100644 --- a/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_once.S +++ b/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_once.S @@ -72,7 +72,7 @@ __pthread_once: add r12, r2 #endif mov.l @r2, r3 - or r3, r0 + or r3, r0 or #1, r0 mov r0, r3 mov r1, r5 @@ -119,10 +119,10 @@ __pthread_once: .Lgot: .long _GLOBAL_OFFSET_TABLE_ #ifdef PIC -.Lfgen: +.Lfgen: .long __fork_generation@GOTOFF #else -.Lfgen: +.Lfgen: .long __fork_generation #endif diff --git a/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S b/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S index 56dce73e8..ea1288422 100644 --- a/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S +++ b/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S @@ -192,7 +192,7 @@ __pthread_rwlock_rdlock: .Ltidoff: .word TID - TLS_PRE_TCB_SIZE - + 6: mov r8, r4 #if MUTEX != 0 diff --git a/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_unlock.S b/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_unlock.S index 011b5a3b6..213d5f68f 100644 --- a/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_unlock.S +++ b/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_unlock.S @@ -209,7 +209,7 @@ __pthread_rwlock_unlock: .word PRIVATE_FUTEX - TLS_PRE_TCB_SIZE #endif .align 2 -.Lwait8: +.Lwait8: .long __lll_lock_wait-.Lwait8b .Lwake8: .long __lll_unlock_wake-.Lwake8b diff --git a/libc/nptl/sysdeps/unix/sysv/linux/sparc/lowlevellock.h b/libc/nptl/sysdeps/unix/sysv/linux/sparc/lowlevellock.h index 2d7d9f82f..5ee8f6d7b 100644 --- a/libc/nptl/sysdeps/unix/sysv/linux/sparc/lowlevellock.h +++ b/libc/nptl/sysdeps/unix/sysv/linux/sparc/lowlevellock.h @@ -78,7 +78,7 @@ extern void __cpu_relax (void); : (fl)) \ : ((fl) | (((private) ^ FUTEX_PRIVATE_FLAG) \ & THREAD_GETMEM (THREAD_SELF, header.private_futex)))) -# endif +# endif #endif diff --git a/libc/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h b/libc/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h index 67222940c..7a176aec3 100644 --- a/libc/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h +++ b/libc/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h @@ -225,17 +225,18 @@ LLL_STUB_UNWIND_INFO_END #define lll_futex_wake(futex, nr, private) \ - do { \ - int __ignore; \ + ({ \ + int __status; \ register __typeof (nr) _nr __asm ("edx") = (nr); \ LIBC_PROBE (lll_futex_wake, 3, futex, nr, private); \ __asm __volatile ("syscall" \ - : "=a" (__ignore) \ + : "=a" (__status) \ : "0" (SYS_futex), "D" (futex), \ "S" (__lll_private_flag (FUTEX_WAKE, private)), \ "d" (_nr) \ : "memory", "cc", "r10", "r11", "cx"); \ - } while (0) + __status; \ + }) /* NB: in the lll_trylock macro we simply return the value in %eax diff --git a/libc/nptl/tst-cond22.c b/libc/nptl/tst-cond22.c index aff38fcc8..bd978e50c 100644 --- a/libc/nptl/tst-cond22.c +++ b/libc/nptl/tst-cond22.c @@ -107,7 +107,7 @@ do_test (void) } printf ("cond = { %d, %x, %lld, %lld, %lld, %p, %u, %u }\n", - c.__data.__lock, c.__data.__futex, c.__data.__total_seq, + c.__data.__lock, c.__data.__futex, c.__data.__total_seq, c.__data.__wakeup_seq, c.__data.__woken_seq, c.__data.__mutex, c.__data.__nwaiters, c.__data.__broadcast_seq); @@ -149,7 +149,7 @@ do_test (void) } printf ("cond = { %d, %x, %lld, %lld, %lld, %p, %u, %u }\n", - c.__data.__lock, c.__data.__futex, c.__data.__total_seq, + c.__data.__lock, c.__data.__futex, c.__data.__total_seq, c.__data.__wakeup_seq, c.__data.__woken_seq, c.__data.__mutex, c.__data.__nwaiters, c.__data.__broadcast_seq); diff --git a/libc/nptl/tst-mutexpp10.c b/libc/nptl/tst-mutexpp10.c index b06acf85c..367b71bb1 100644 --- a/libc/nptl/tst-mutexpp10.c +++ b/libc/nptl/tst-mutexpp10.c @@ -67,7 +67,7 @@ do_test (void) fifo_max + 1); return 1; } - + if (fifo_min > 0 && pthread_mutexattr_setprioceiling (&ma, fifo_min - 1) != EINVAL) { @@ -245,7 +245,7 @@ do_test (void) printf ("unexpected m1 old prioceiling %d != 6\n", prioceiling); return 1; } - + if (pthread_mutex_getprioceiling (&m1, &prioceiling)) { puts ("mutex_getprioceiling m1 failed"); diff --git a/libc/nptl/tst-pthread-attr-affinity.c b/libc/nptl/tst-pthread-attr-affinity.c new file mode 100644 index 000000000..eab0820f9 --- /dev/null +++ b/libc/nptl/tst-pthread-attr-affinity.c @@ -0,0 +1,63 @@ +/* Make sure that pthread_attr_getaffinity_np does not crash when the input + cpuset size is smaller than that in the attribute structure. + + Copyright (C) 2013 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <stdio.h> +#include <sched.h> +#include <errno.h> +#include <sys/param.h> + + +#define RETURN_IF_FAIL(f, ...) \ + ({ \ + int ret = f (__VA_ARGS__); \ + if (ret != 0) \ + { \ + printf ("%s:%d: %s returned %d (errno = %d)\n", __FILE__, __LINE__, \ + #f, ret, errno); \ + return ret; \ + } \ + }) + +static int +do_test (void) +{ + for (int i = 0; i < 10; i++) + { + pthread_attr_t attr; + cpu_set_t *cpuset = CPU_ALLOC (512); + size_t cpusetsize = CPU_ALLOC_SIZE (512); + CPU_ZERO_S (cpusetsize, cpuset); + + RETURN_IF_FAIL (pthread_attr_init, &attr); + RETURN_IF_FAIL (pthread_attr_setaffinity_np, &attr, cpusetsize, cpuset); + CPU_FREE (cpuset); + + cpuset = CPU_ALLOC (1); + cpusetsize = CPU_ALLOC_SIZE (1); + RETURN_IF_FAIL (pthread_attr_getaffinity_np, &attr, cpusetsize, cpuset); + CPU_FREE (cpuset); + } + return 0; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/libc/nptl/tst-stackguard1.c b/libc/nptl/tst-stackguard1.c index 57a48ad29..29c614c0c 100644 --- a/libc/nptl/tst-stackguard1.c +++ b/libc/nptl/tst-stackguard1.c @@ -190,7 +190,7 @@ do_test (void) the 16 runs, something is very wrong. */ int ndifferences = 0; int ndefaults = 0; - for (i = 0; i < N; ++i) + for (i = 0; i < N; ++i) { if (child_stack_chk_guards[i] != child_stack_chk_guards[i+1]) ndifferences++; diff --git a/libc/nptl/tst-umask1.c b/libc/nptl/tst-umask1.c index 96f83cc53..fa2023283 100644 --- a/libc/nptl/tst-umask1.c +++ b/libc/nptl/tst-umask1.c @@ -65,7 +65,7 @@ work (const char *fname, int mask) if ((st.st_mode & mask) != 0) { printf ("mask not successful after %s: %x still set\n", - fcts[i].name, (unsigned int) (st.st_mode & mask)); + fcts[i].name, (unsigned int) (st.st_mode & mask)); result = 1; } } |