Bug ID 1193139
Summary [x86_64, 32-bit] mpx support broken
Classification openSUSE
Product openSUSE Distribution
Version Leap 15.3
Hardware x86
OS Other
Status NEW
Severity Normal
Priority P5 - None
Component Kernel
Assignee kernel-bugs@opensuse.org
Reporter tdevries@suse.com
QA Contact qa-bugs@suse.de
Found By ---
Blocker ---

Consider test-case mpx-out-of-bounds.c (
https://01.org/blogs/2016/intel-mpx-linux ):
...
$ cat mpx-out-of-bounds.c      
#include <string.h>
#include <stdio.h>
#include <stdlib.h>

#define noinline __attribute__((noinline))

char dog[] = "dog";
char password[] = "secr3t";

noinline
char dog_letter(int nr)
{
        return dog[nr];
}

int main(int argc, char **argv)
{
        int max = sizeof(dog);
        int i;

        if (argc >= 2)
                max = atoi(argv[1]);

        for (i = 0; i < max; i++)
                printf("dog[%d]: '%c'\n", i, dog_letter(i));

        return 0;
}
...

With -m64:
...
$ gcc -Wall -o mpx-out-of-bounds mpx-out-of-bounds.c -mmpx
-fcheck-pointer-bounds
$ ./mpx-out-of-bounds 10 
dog[0]: 'd'
dog[1]: 'o'
dog[2]: 'g'
dog[3]: ''
Saw a #BR! status 1 at 0x400634
dog[4]: 's'
Saw a #BR! status 1 at 0x400634
dog[5]: 'e'
Saw a #BR! status 1 at 0x400634
dog[6]: 'c'
Saw a #BR! status 1 at 0x400634
dog[7]: 'r'
Saw a #BR! status 1 at 0x400634
dog[8]: '3'
Saw a #BR! status 1 at 0x400634
dog[9]: 't'
...


With -m32:
...
$ gcc -m32 -Wall -o mpx-out-of-bounds mpx-out-of-bounds.c -mmpx
-fcheck-pointer-bounds
$ ./mpx-out-of-bounds 10 2>&1 | more
Saw a #BR! status 4157798670 at 0x8048492
Unexpected status with bound exception: 4157798670
Saw a #BR! status 4157798670 at 0x8048492
Unexpected status with bound exception: 4157798670
Saw a #BR! status 4157798670 at 0x8048492
Unexpected status with bound exception: 4157798670
Saw a #BR! status 4157798670 at 0x8048492
Unexpected status with bound exception: 4157798670
Saw a #BR! status 4157798670 at 0x8048492
Unexpected status with bound exception: 4157798670
Saw a #BR! status 4157798670 at 0x8048492
Unexpected status with bound exception: 4157798670
Saw a #BR! status 4157798670 at 0x8048492
Unexpected status with bound exception: 4157798670
Saw a #BR! status 4157798670 at 0x8048492
Unexpected status with bound exception: 4157798670
Saw a #BR! status 4157798670 at 0x8048492
Unexpected status with bound exception: 4157798670
Saw a #BR! status 4157798670 at 0x8048492
Unexpected status with bound exception: 4157798670
Saw a #BR! status 4157798670 at 0x8048492
Unexpected status with bound exception: 4157798670
<etc>
...

From what I understand, the problem starts the moment a first mpx instruction
is executed, which should trigger an exception that is caught by the kernel to
allocate some related tables.


You are receiving this mail because: