ARC: gdbserver using regset interface possibly broken
authorVineet Gupta <vgupta@synopsys.com>
Wed, 27 Feb 2013 10:34:07 +0000 (16:04 +0530)
committerVineet Gupta <vgupta@synopsys.com>
Wed, 27 Feb 2013 14:29:55 +0000 (19:59 +0530)
ptrace regset interface relies on ELF_NGREG for ceiling the size of user
request. So any larger request (even if legit)  would be clipped.

The existing def of ELF_NGREG didn't use user_regs_struct and was
technically one placeholder short (stop_pc) - although the current code
would still work because pt_regs includes a bunch of extra fields,
making
      ELF_NGREG >= sizeof(struct user_regs_struct)/sizeof(long)

But we need to remove this ambiguity, specially since pt_regs should NOT
be directly associated with with anything userspace-ish.

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
arch/arc/include/asm/elf.h

index 147284f..4d42005 100644 (file)
 typedef unsigned long elf_greg_t;
 typedef unsigned long elf_fpregset_t;
 
-
-/* core dump regs is in the order pt_regs, callee_regs, stop_pc (for gdb) */
-#define ELF_NGREG      ((sizeof(struct pt_regs) + sizeof(struct callee_regs) \
-                         + sizeof(unsigned long)) / sizeof(elf_greg_t))
-
+#define ELF_NGREG      (sizeof(struct user_regs_struct) / sizeof(elf_greg_t))
 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
 
 /*