[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#157374: architectures

This bug also affects the mips (and presumably mipsel) architecture.

I enclose a little program which can be used with gdb's help to see the
problem: putting a breakpoint in sigsegv_handler and running this
program, and then from the sigsegv_handler breakpoint:

(gdb) print/x (ucontext_t *) context->uc_mcontext
(gdb) print/x *(struct sigcontext *)(&((ucontext_t *)context)->uc_mcontext)

In only the second case will the slab value (0xdeadbeef) be in the
correct slot. The attached program is for mips, as I rely on Carlos to
be able to translate it to parisc :)


Jesus College, Cambridge, CB5 8BL                           +44 1223 510 299
http://www-jcsu.jesus.cam.ac.uk/~csr21/                  (defun pling-dollar 
(str schar arg) (first (last +))) (make-dispatch-macro-character #\! t)
(set-dispatch-macro-character #\! #\$ #'pling-dollar)
#include <stdio.h>
#include <sys/ucontext.h>
#include <signal.h>
/* c.f. Debian Bug#157374 */
#include <asm/sigcontext.h>

void sigsegv_handler(int signal, siginfo_t *info, void *context) {
/*  fprintf(stderr, "si_addr: %p (should probably be 0x0 [aka \"(nil)\"]\n",info->si_addr);
  fprintf(stderr, "%r1    : 0x%08x (should probably be 0xdeadbeef)\n",
	  ((struct sigcontext *) &(((ucontext_t *) context)->uc_mcontext))->sc_gr[1]); */

int main () {
  int *foo;
  struct sigaction sa;
  sa.sa_sigaction = sigsegv_handler;
  sa.sa_flags = SA_SIGINFO | SA_RESTART;
  sigaction(SIGSEGV, &sa, NULL);
  asm("li $1,0xdeadbeef");
  /*  asm("ldo R%0xdeadbeef(%r1),%r1"); */
  foo = NULL;
  *foo = 3;

Reply to: