1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-30 22:43:12 +03:00
* sysdeps/sparc/sparc64/dl-machine.h (elf_machine_rela):
	Ensure relocation doesn't clobber any bits outside of the
	immediate field for R_SPARC_TLS_LE_HIX22, R_SPARC_WDISP30,
	R_SPARC_HI22 and R_SPARC_H44.
This commit is contained in:
Ulrich Drepper
2006-09-09 11:21:48 +00:00
parent 346e6ad401
commit 2b6a801eed
8 changed files with 40 additions and 21 deletions

View File

@ -1,5 +1,11 @@
2006-09-07 Jakub Jelinek <jakub@redhat.com> 2006-09-07 Jakub Jelinek <jakub@redhat.com>
[BZ #1006]
* sysdeps/sparc/sparc64/dl-machine.h (elf_machine_rela):
Ensure relocation doesn't clobber any bits outside of the
immediate field for R_SPARC_TLS_LE_HIX22, R_SPARC_WDISP30,
R_SPARC_HI22 and R_SPARC_H44.
[BZ #2775] [BZ #2775]
* malloc/malloc.c (sYSMALLOc): Only call grow_heap if * malloc/malloc.c (sYSMALLOc): Only call grow_heap if
(long) (MINSIZE + nb - old_size) is positive. (long) (MINSIZE + nb - old_size) is positive.

View File

@ -1,11 +1,21 @@
2006-09-08 Jakub Jelinek <jakub@redhat.com>
* tst-cond22.c: Include pthread.h instead of pthreadP.h.
Include stdlib.h.
* sysdeps/pthread/pthread_cond_wait.c (__condvar_cleanup): Only
increase FUTEX if increasing WAKEUP_SEQ. Fix comment typo.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S: Likewise.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S: Likewise.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S: Likewise.
2006-09-08 Ulrich Drepper <drepper@redhat.com> 2006-09-08 Ulrich Drepper <drepper@redhat.com>
[BZ #3123] [BZ #3123]
* sysdeps/pthread/pthread_cond_wait.c (__condvar_cleanup): Don't * sysdeps/pthread/pthread_cond_wait.c (__condvar_cleanup): Don't
increment WAKEUP_SEQ if this would increase the value beyond TOTAL_SEQ. increment WAKEUP_SEQ if this would increase the value beyond TOTAL_SEQ.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.c: Likewise. * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S: Likewise.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.c: Likewise. * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S: Likewise.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.c: Likewise. * sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S: Likewise.
* Makefile (tests): Add tst-cond22. * Makefile (tests): Add tst-cond22.
* tst-cond22.c: New file. * tst-cond22.c: New file.

View File

@ -51,13 +51,15 @@ __condvar_cleanup (void *arg)
{ {
/* This thread is not waiting anymore. Adjust the sequence counters /* This thread is not waiting anymore. Adjust the sequence counters
appropriately. We do not increment WAKEUP_SEQ if this would appropriately. We do not increment WAKEUP_SEQ if this would
bump it over the value of TOTAL_SEQ> This can happen if a thread bump it over the value of TOTAL_SEQ. This can happen if a thread
was woken and then canceled. */ was woken and then canceled. */
if (cbuffer->cond->__data.__wakeup_seq if (cbuffer->cond->__data.__wakeup_seq
< cbuffer->cond->__data.__total_seq) < cbuffer->cond->__data.__total_seq)
++cbuffer->cond->__data.__wakeup_seq; {
++cbuffer->cond->__data.__wakeup_seq;
++cbuffer->cond->__data.__futex;
}
++cbuffer->cond->__data.__woken_seq; ++cbuffer->cond->__data.__woken_seq;
++cbuffer->cond->__data.__futex;
} }
cbuffer->cond->__data.__nwaiters -= 1 << COND_CLOCK_BITS; cbuffer->cond->__data.__nwaiters -= 1 << COND_CLOCK_BITS;

View File

@ -406,7 +406,7 @@ __condvar_tw_cleanup:
cmpl 20(%esp), %eax cmpl 20(%esp), %eax
jne 3f jne 3f
/* We increment the woken_seq counter only if it is lower than /* We increment the wakeup_seq counter only if it is lower than
total_seq. If this is not the case the thread was woken and total_seq. If this is not the case the thread was woken and
then canceled. In this case we ignore the signal. */ then canceled. In this case we ignore the signal. */
movl total_seq(%ebx), %eax movl total_seq(%ebx), %eax
@ -419,10 +419,9 @@ __condvar_tw_cleanup:
6: addl $1, wakeup_seq(%ebx) 6: addl $1, wakeup_seq(%ebx)
adcl $0, wakeup_seq+4(%ebx) adcl $0, wakeup_seq+4(%ebx)
addl $1, cond_futex(%ebx)
7: addl $1, cond_futex(%ebx) 7: addl $1, woken_seq(%ebx)
addl $1, woken_seq(%ebx)
adcl $0, woken_seq+4(%ebx) adcl $0, woken_seq+4(%ebx)
3: subl $(1 << clock_bits), cond_nwaiters(%ebx) 3: subl $(1 << clock_bits), cond_nwaiters(%ebx)

View File

@ -297,7 +297,7 @@ __condvar_w_cleanup:
cmpl 12(%esp), %eax cmpl 12(%esp), %eax
jne 3f jne 3f
/* We increment the woken_seq counter only if it is lower than /* We increment the wakeup_seq counter only if it is lower than
total_seq. If this is not the case the thread was woken and total_seq. If this is not the case the thread was woken and
then canceled. In this case we ignore the signal. */ then canceled. In this case we ignore the signal. */
movl total_seq(%ebx), %eax movl total_seq(%ebx), %eax
@ -310,9 +310,9 @@ __condvar_w_cleanup:
6: addl $1, wakeup_seq(%ebx) 6: addl $1, wakeup_seq(%ebx)
adcl $0, wakeup_seq+4(%ebx) adcl $0, wakeup_seq+4(%ebx)
addl $1, cond_futex(%ebx)
7: addl $1, cond_futex(%ebx) 7: addl $1, woken_seq(%ebx)
addl $1, woken_seq(%ebx)
adcl $0, woken_seq+4(%ebx) adcl $0, woken_seq+4(%ebx)
3: subl $(1 << clock_bits), cond_nwaiters(%ebx) 3: subl $(1 << clock_bits), cond_nwaiters(%ebx)

View File

@ -67,15 +67,15 @@ __condvar_cleanup:
cmpl 4(%r8), %edx cmpl 4(%r8), %edx
jne 3f jne 3f
/* We increment the woken_seq counter only if it is lower than /* We increment the wakeup_seq counter only if it is lower than
total_seq. If this is not the case the thread was woken and total_seq. If this is not the case the thread was woken and
then canceled. In this case we ignore the signal. */ then canceled. In this case we ignore the signal. */
movq total_seq(%rdi), %rax movq total_seq(%rdi), %rax
cmpq wakeup_seq(%rdi), %rax cmpq wakeup_seq(%rdi), %rax
jbe 6f jbe 6f
incq wakeup_seq(%rdi) incq wakeup_seq(%rdi)
6: incq woken_seq(%rdi)
incl cond_futex(%rdi) incl cond_futex(%rdi)
6: incq woken_seq(%rdi)
3: subl $(1 << clock_bits), cond_nwaiters(%rdi) 3: subl $(1 << clock_bits), cond_nwaiters(%rdi)

View File

@ -1,5 +1,6 @@
#include <pthreadP.h> #include <pthread.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
static pthread_barrier_t b; static pthread_barrier_t b;

View File

@ -1,5 +1,5 @@
/* Machine-dependent ELF dynamic relocation inline functions. Sparc64 version. /* Machine-dependent ELF dynamic relocation inline functions. Sparc64 version.
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
@ -623,7 +623,8 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
value = sym->st_value - sym_map->l_tls_offset value = sym->st_value - sym_map->l_tls_offset
+ reloc->r_addend; + reloc->r_addend;
if (r_type == R_SPARC_TLS_LE_HIX22) if (r_type == R_SPARC_TLS_LE_HIX22)
*reloc_addr = (*reloc_addr & 0xffc00000) | ((~value) >> 10); *reloc_addr = (*reloc_addr & 0xffc00000)
| (((~value) >> 10) & 0x3fffff);
else else
*reloc_addr = (*reloc_addr & 0xffffe000) | (value & 0x3ff) *reloc_addr = (*reloc_addr & 0xffffe000) | (value & 0x3ff)
| 0x1c00; | 0x1c00;
@ -653,7 +654,7 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
case R_SPARC_WDISP30: case R_SPARC_WDISP30:
*(unsigned int *) reloc_addr = *(unsigned int *) reloc_addr =
((*(unsigned int *)reloc_addr & 0xc0000000) | ((*(unsigned int *)reloc_addr & 0xc0000000) |
((value - (Elf64_Addr) reloc_addr) >> 2)); (((value - (Elf64_Addr) reloc_addr) >> 2) & 0x3fffffff));
break; break;
/* MEDLOW code model relocs */ /* MEDLOW code model relocs */
@ -665,7 +666,7 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
case R_SPARC_HI22: case R_SPARC_HI22:
*(unsigned int *) reloc_addr = *(unsigned int *) reloc_addr =
((*(unsigned int *)reloc_addr & 0xffc00000) | ((*(unsigned int *)reloc_addr & 0xffc00000) |
(value >> 10)); ((value >> 10) & 0x3fffff));
break; break;
case R_SPARC_OLO10: case R_SPARC_OLO10:
*(unsigned int *) reloc_addr = *(unsigned int *) reloc_addr =
@ -677,7 +678,7 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
case R_SPARC_H44: case R_SPARC_H44:
*(unsigned int *) reloc_addr = *(unsigned int *) reloc_addr =
((*(unsigned int *)reloc_addr & 0xffc00000) | ((*(unsigned int *)reloc_addr & 0xffc00000) |
(value >> 22)); ((value >> 22) & 0x3fffff));
break; break;
case R_SPARC_M44: case R_SPARC_M44:
*(unsigned int *) reloc_addr = *(unsigned int *) reloc_addr =