Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Oct 2021 14:57:22 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-arm@FreeBSD.org
Subject:   [Bug 259187] Use of thumb NEON instructions in thread causes SIGILL
Message-ID:  <bug-259187-7@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D259187

            Bug ID: 259187
           Summary: Use of thumb NEON instructions in thread causes SIGILL
           Product: Base System
           Version: 13.0-RELEASE
          Hardware: arm
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: arm
          Assignee: freebsd-arm@FreeBSD.org
          Reporter: fuz@fuz.su
                CC: cognet@FreeBSD.org
             Flags: mfc-stable13?, mfc-stable12?

The following program crashes with a SIGILL on armv7 FreeBSD 13.0-RELEASE. =
 It
does not crash in an armv7 jail on arm64 FreeBSD and does not crash when
compiled without -mthumb.

#include <pthread.h>
#include <stddef.h>

void *a(void *x) {
  (void)x;

  struct {
    int b[4];
  } c =3D c;

  return (NULL);
}

int main() {
  pthread_t d;
  pthread_create(&d, NULL, a, NULL);
  pthread_join(d, NULL);
}

Save the program in a file name min.c, then type

    cc -mthumb min.c -lpthread && ./a.out

to reproduce.  The assembly code for function a() looks as follows:

00020754 <a>:
   20754:       b086            sub     sp, #24
   20756:       9005            str     r0, [sp, #20]
   20758:       4668            mov     r0, sp
   2075a:       f960 0a8f       vld1.32 {d16-d17}, [r0]
   2075e:       f940 0acf       vst1.64 {d16-d17}, [r0]
   20762:       2000            movs    r0, #0
   20764:       b006            add     sp, #24
   20766:       4770            bx      lr

The program crashes at address 2075a at the vld1.32 instruction.

When compiled for ARM mode, the same instruction is used but no crash occur=
s.=20
I do not understand what causes this issue.

It also does not seem to happen when executing the function a() without usi=
ng a
separate thread.

I've used a Raspberry Pi 3B (Cortex-A7) to find this issue.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-259187-7>