From: Szabolcs Nagy <szabolcs.nagy@arm.com>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: nd@arm.com, qemu-devel@nongnu.org
Subject: another tst-arm-mte bug: qemu-system segfaults
Date: Fri, 29 May 2020 13:04:28 +0100 [thread overview]
Message-ID: <20200529120427.GB18623@arm.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 818 bytes --]
again i'm using the branch at
https://github.com/rth7680/qemu/tree/tgt-arm-mte
to test armv8.5-a mte, now qemu-system-aarch64 segfaults
and it's easy to reproduce: minimal source and static
linked binary is attached (should be executed on linux
with mte support, i used mte-v4 kernel with reverted
memory property check).
the __aarch64_memchr function referenced is from
https://github.com/ARM-software/optimized-routines
and the bug was originally observed when running the
test executables built with gcc-10 and a config.mk like
SUBS = string
ARCH = aarch64
srcdir = .
CROSS_COMPILE = aarch64-none-linux-gnu-
CC = $(CROSS_COMPILE)gcc
CFLAGS = -std=c99 -pipe -O3
CFLAGS += -march=armv8.5-a+memtag -DWANT_MTE_TEST=1
CFLAGS += -Wall -Wno-missing-braces
CFLAGS += -Werror=implicit-function-declaration
CFLAGS += -g
[-- Attachment #2: bug.c --]
[-- Type: text/x-csrc, Size: 682 bytes --]
#include <stddef.h>
#include <sys/mman.h>
#include <sys/prctl.h>
void *__memchr_aarch64 (const void *, int, size_t);
#define PR_SET_TAGGED_ADDR_CTRL 55
#define PR_TAGGED_ADDR_ENABLE (1UL << 0)
#define PR_MTE_TCF_SHIFT 1
#define PR_MTE_TCF_SYNC (1UL << PR_MTE_TCF_SHIFT)
#define PR_MTE_TAG_SHIFT 3
#define PROT_MTE 0x20
int main (void)
{
int r = prctl (PR_SET_TAGGED_ADDR_CTRL, PR_TAGGED_ADDR_ENABLE | PR_MTE_TCF_SYNC | (0xfffe << PR_MTE_TAG_SHIFT), 0, 0, 0);
if (r < 0) return -1;
char *s = mmap (NULL, 4096, PROT_READ | PROT_WRITE | PROT_MTE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if (s == MAP_FAILED) return -1;
s[0] = 1;
__memchr_aarch64(s, 1, 4096);
return 0;
}
[-- Attachment #3: bug --]
[-- Type: application/octet-stream, Size: 9072 bytes --]
next reply other threads:[~2020-05-29 12:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-29 12:04 Szabolcs Nagy [this message]
2020-06-02 21:08 ` another tst-arm-mte bug: qemu-system segfaults Richard Henderson
2020-06-02 21:58 ` Richard Henderson
2020-06-03 13:50 ` Szabolcs Nagy
2020-06-03 16:21 ` Richard Henderson
2020-06-03 17:17 ` Szabolcs Nagy
2020-06-05 20:26 ` Richard Henderson
2020-06-08 15:12 ` Szabolcs Nagy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200529120427.GB18623@arm.com \
--to=szabolcs.nagy@arm.com \
--cc=nd@arm.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).