Port-evbmips archive

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

GNU_RELRO support broken on mips64e[bl] (Was: "security/sudo" gets SIGBUS on Lemote Yeeloong (LOONGSON))



On 9 Sep 2016 16:58 John D. Baker wrote:
A freshly-built "security/sudo" from pkgsrc-HEAD (20160909) dies with
"Bus error" prior to any authentication attempt.  Rebuilding with
debugging enabled and using 'su' to become root and run it under 'gdb'
reveals:

I observed the same error on ERLITE (evbmips64-eb) with kernel and
userland from current (20160908). However, I tried this again with
yesterday's current, then "Bus error" turned into "Memory fault":

  $ sudo
  trap: pid 28935(sudo): sig 11: cause=0x4 epc=0x7876fe60 va=0x78785321
  registers:
  [ 0]=00000000 [ 1]=00000000 [ 2]=78780000 [ 3]=00000001
  [ 4]=00000003 [ 5]=7fff6cc0 [ 6]=00000000 [ 7]=00000000
  [ 8]=00000000 [ 9]=00000000 [10]=00099960 [11]=0001eb79
  [12]=00000001 [13]=00000062 [14]=787cd000 [15]=787fc4c0
  [16]=787629a4 [17]=787d0000 [18]=787f4794 [19]=00000001
  [20]=787ca480 [21]=ffffffffff7fffff [22]=00800000 [23]=7fff6cc0
  [24]=00162000 [25]=7876fe30 [26]=00000000 [27]=00000000
  [28]=7878d100 [29]=7fff6c10 [30]=00000000 [31]=787629c8
  pid 28935 (sudo), uid 0: exited on signal 11 (core not dumped, err = 1
  Memory fault
  $

Diffs between two kernels are followings:

  -     $NetBSD: trap.c,v 1.241 2016/07/11 18:54:32 skrll Exp $
  +     $NetBSD: trap.c,v 1.243 2016/09/10 13:42:11 skrll Exp $
  -     $NetBSD: netbsd32_netbsd.c,v 1.200 2016/05/13 16:54:36 christos Exp $
  +     $NetBSD: netbsd32_netbsd.c,v 1.202 2016/09/10 08:21:26 skrll Exp $
  -     $NetBSD: netbsd32_socket.c,v 1.42 2015/07/22 14:25:39 maxv Exp $
  +     $NetBSD: netbsd32_socket.c,v 1.43 2016/09/08 18:54:03 martin Exp $
  -     $NetBSD: netbsd32_sysent.c,v 1.121 2015/12/03 10:39:50 pgoyette Exp $
  +     $NetBSD: netbsd32_sysent.c,v 1.122 2016/09/10 08:19:58 skrll Exp $

I found that this failure occurs with binaries compiled with -Wl,-z,relro:

  $ cc hello.c && ./a.out
  Hello, World!
  $ cc -Wl,-z,relro hello.c && ./a.out
  pid 2526(a.out): sig 11: cause=0x80000004
  (snip)
  pid 2526 (a.out), uid 501: exited on signal 11 (core dumped)
  Memory fault
  $

Memory fault does not occur with sudo compiled without that option. Something
is wrong withGNU_RELRO support. Actually, this failure can be avoided when
ld.elf_so is compiled without -DGNU_RELRO option.

Thanks,
Rin


Home | Main Index | Thread Index | Old Index