This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Problem with x32 pointer_guard
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Date: Thu, 17 May 2012 16:05:46 -0700
- Subject: Problem with x32 pointer_guard
Hi,
sysdeps/x86_64/__longjmp.S has
ENTRY(__longjmp)
/* Restore registers. */
mov (JB_RSP*8)(%rdi),%R8_LP
movq (JB_RBP*8)(%rdi),%r9
mov (JB_PC*8)(%rdi),%RDX_LP
#ifdef PTR_DEMANGLE
PTR_DEMANGLE (%R8_LP)
PTR_DEMANGLE (%r9)
PTR_DEMANGLE (%RDX_LP)
#endif
We are demangle 64-bit register:
# define PTR_DEMANGLE(var) asm ("ror $2*" LP_SIZE "+1, %0\n" \
"xor %%fs:%c2, %0" \
: "=r" (var) \
: "0" (var), \
"i" (offsetof (tcbhead_t, \
pointer_guard)))
But we have
typedef struct
{
void *tcb; /* Pointer to the TCB. Not necessarily the
thread descriptor used by libpthread. */
dtv_t *dtv;
void *self; /* Pointer to the thread descriptor. */
int multiple_threads;
int gscope_flag;
uintptr_t sysinfo;
uintptr_t stack_guard;
uintptr_t pointer_guard;
unsigned long int vgetcpu_cache[2];
# ifndef __ASSUME_PRIVATE_FUTEX
int private_futex;
# else
int __unused1;
# endif
We are reading 32 bits beyond pointer_guard. What should we do?
One option is to use __syscall_long_t on pointer_guard.
X32 has an unused field. We can do
typedef struct
{
void *tcb; /* Pointer to the TCB. Not necessarily the
thread descriptor used by libpthread. */
dtv_t *dtv;
void *self; /* Pointer to the thread descriptor. */
int multiple_threads;
int gscope_flag;
uintptr_t sysinfo;
uintptr_t stack_guard;
__syscall_ulong_t pointer_guard;
unsigned long int vgetcpu_cache[2];
#ifndef __ILP32__
# ifndef __ASSUME_PRIVATE_FUTEX
int private_futex;
# else
int __unused1;
# endif
#endif
Only t vgetcpu_cache offsets are changed. Any comments?
Thanks.
--
H.J.