[Bug 259187] Use of thumb NEON instructions in thread causes SIGILL

[email protected]
Newsgroups gmane.os.freebsd.devel.arm
Message-ID <[email protected]/bugzilla/>
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=259187

            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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
             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 = 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 occurs. 
I do not understand what causes this issue.

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

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

-- 
You are receiving this mail because:
You are the assignee for the bug.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.