From: Richard Henderson <richard.henderson@linaro.org>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
root@wjsota.com, qemu-discuss@nongnu.org
Cc: QEMU Developers <qemu-devel@nongnu.org>, qemu-arm <qemu-arm@nongnu.org>
Subject: Re: QEMU emulating ARM Neoverse N1 unexpectectly emulates `retaa`
Date: Tue, 17 Jun 2025 18:44:05 -0700 [thread overview]
Message-ID: <3e1e6a7f-18d4-4667-b1a7-6857bdc3de66@linaro.org> (raw)
In-Reply-To: <7d1ddf7e-b16c-4820-958c-0d03bf8479d1@linaro.org>
On 6/15/25 22:09, Philippe Mathieu-Daudé wrote:
> Hi Solomon,
>
> Cc'ing the qemu-arm@ list.
>
> On 14/6/25 06:51, root@wjsota.com wrote:
>> Hi!
>>
>> Is `qemu-aarch64 -cpu neoverse-n1` supposed to emulate the `retaa` instruction?
>>
>> I have a binary called `main_pac` compiled from https://learn.arm.com/learning-paths/
>> servers-and-cloud-computing/pac/example/ .
>>
>> The compiling command is `aarch64-linux-gnu-gcc -march=armv8.5-a -fPIC -pedantic -Wall -
>> Wextra -ggdb3 -O0 -mbranch-protection=standard -fno-stack-protector -fPIE -static main.c
>> -o main_pac`. The binary includes the `paciasp` and `retaa` instructions associated with
>> ARM PAC.
>>
>> ```
>> (gdb) disas main
>> Dump of assembler code for function main:
>> 0x0000000000400858 <+0>: paciasp
>> 0x000000000040085c <+4>: stp x29, x30, [sp, #-32]!
>> […]
>> 0x0000000000400898 <+64>: ldp x29, x30, [sp], #32
>> 0x000000000040089c <+68>: retaa
>> End of assembler dump.
>> (gdb) quit
>> ```
>>
>> When emulated using `qemu-aarch64 -cpu neoverse-n1` , the program completes without issues.
>> ```
>> user@dell-op7020:~/learning/arm_learning_path_pac$ qemu-aarch64 -cpu neoverse-n1
>> main_pac test
>> Hello World!
>> user@dell-op7020:~/learning/arm_learning_path_pac$
>> ```
>>
>> This is the case for two versions I tested:
>> - v9.2.1 (Debian 1:9.2.1+ds-1ubuntu5)
>> - v10.0.50 (v10.0.0-1610-gd9ce74873a)
>>
>>
>> The expected behavior is for an Illegal Instruction exception to occur. Citing the Arm
>> A-profile A64 Instruction Set Architect Version 2025-03, the `retaa` instruction should
>> return an Undefined Instruction error when the PAC feature is not implemented.
>> ```
>> if !IsFeatureImplemented(FEAT_PAuth) then EndOfDecode(Decode_UNDEF);
Yes, trans_RETA() is missing the pauth check.
r~
prev parent reply other threads:[~2025-06-18 1:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1235E663-AD2F-499E-8CF9-16E54A1C01DD@wjsota.com>
2025-06-16 5:09 ` QEMU emulating ARM Neoverse N1 unexpectectly emulates `retaa` Philippe Mathieu-Daudé
2025-06-18 1:44 ` Richard Henderson [this message]
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=3e1e6a7f-18d4-4667-b1a7-6857bdc3de66@linaro.org \
--to=richard.henderson@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-discuss@nongnu.org \
--cc=root@wjsota.com \
/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).