* [Bug 1905356] [NEW] No check for unaligned data access in ARM32 instructions
@ 2020-11-24 5:05 JIANG Muhui
2020-11-24 23:46 ` [Bug 1905356] " Richard Henderson
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: JIANG Muhui @ 2020-11-24 5:05 UTC (permalink / raw)
To: qemu-devel
Public bug reported:
hi
According to the ARM documentation, there are alignment requirements of
load/store instructions. Alignment fault should be raised if the
alignment check is failed. However, it seems that QEMU doesn't implement
this, which is against the documentation of ARM. For example, the
instruction LDRD/STRD/LDREX/STREX must check the address is word
alignment no matter what value the SCTLR.A is.
I attached a testcase, which contains an instruction at VA 0x10240: ldrd
r0,[pc.#1] in the main function. QEMU can successfully load the data in
the unaligned address. The test is done in QEMU 5.1.0. I can provide
more testcases for the other instructions if you need. Many thanks.
To patch this, we need a check while we translate the instruction to
tcg. If the address is unaligned, a signal number (i.e., SIGBUS) should
be raised.
Regards
Muhui
** Affects: qemu
Importance: Undecided
Status: New
** Attachment added: "case_ldrd_arm"
https://bugs.launchpad.net/bugs/1905356/+attachment/5437364/+files/case_ldrd_arm
** Description changed:
hi
According to the ARM documentation, there are alignment requirements of
load/store instructions. Alignment fault should be raised if the
alignment check is failed. However, it seems that QEMU doesn't implement
this, which is against the documentation of ARM. For example, the
instruction LDRD/STRD/LDREX/STREX must check the address is word
alignment no matter what value the SCTLR.A is.
- I attached a testcase, which contains a instruction at VA 0x10240: ldrd
+ I attached a testcase, which contains an instruction at VA 0x10240: ldrd
r0,[pc.#1] in the main function. QEMU can successfully load the data in
the unaligned address. The test is done in QEMU 5.1.0. I can provide
more testcases for the other instructions if you need. Many thanks.
To patch this, we need a check while we translate the instruction to
tcg. If the address is unaligned, a signal number (i.e., SIGBUS) should
be raised.
Regards
Muhui
--
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1905356
Title:
No check for unaligned data access in ARM32 instructions
Status in QEMU:
New
Bug description:
hi
According to the ARM documentation, there are alignment requirements
of load/store instructions. Alignment fault should be raised if the
alignment check is failed. However, it seems that QEMU doesn't
implement this, which is against the documentation of ARM. For
example, the instruction LDRD/STRD/LDREX/STREX must check the address
is word alignment no matter what value the SCTLR.A is.
I attached a testcase, which contains an instruction at VA 0x10240:
ldrd r0,[pc.#1] in the main function. QEMU can successfully load the
data in the unaligned address. The test is done in QEMU 5.1.0. I can
provide more testcases for the other instructions if you need. Many
thanks.
To patch this, we need a check while we translate the instruction to
tcg. If the address is unaligned, a signal number (i.e., SIGBUS)
should be raised.
Regards
Muhui
To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1905356/+subscriptions
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug 1905356] Re: No check for unaligned data access in ARM32 instructions
2020-11-24 5:05 [Bug 1905356] [NEW] No check for unaligned data access in ARM32 instructions JIANG Muhui
@ 2020-11-24 23:46 ` Richard Henderson
2020-11-25 3:18 ` Richard Henderson
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Richard Henderson @ 2020-11-24 23:46 UTC (permalink / raw)
To: qemu-devel
We don't implement SCTLR.A, but you're right that we should be
checking the mandatory alignments.
Note! Any fix will only apply to system mode (qemu-system-arm)
and not user-only mode (qemu-arm).
** Changed in: qemu
Status: New => Confirmed
--
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1905356
Title:
No check for unaligned data access in ARM32 instructions
Status in QEMU:
Confirmed
Bug description:
hi
According to the ARM documentation, there are alignment requirements
of load/store instructions. Alignment fault should be raised if the
alignment check is failed. However, it seems that QEMU doesn't
implement this, which is against the documentation of ARM. For
example, the instruction LDRD/STRD/LDREX/STREX must check the address
is word alignment no matter what value the SCTLR.A is.
I attached a testcase, which contains an instruction at VA 0x10240:
ldrd r0,[pc.#1] in the main function. QEMU can successfully load the
data in the unaligned address. The test is done in QEMU 5.1.0. I can
provide more testcases for the other instructions if you need. Many
thanks.
To patch this, we need a check while we translate the instruction to
tcg. If the address is unaligned, a signal number (i.e., SIGBUS)
should be raised.
Regards
Muhui
To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1905356/+subscriptions
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug 1905356] Re: No check for unaligned data access in ARM32 instructions
2020-11-24 5:05 [Bug 1905356] [NEW] No check for unaligned data access in ARM32 instructions JIANG Muhui
2020-11-24 23:46 ` [Bug 1905356] " Richard Henderson
@ 2020-11-25 3:18 ` Richard Henderson
2020-11-25 3:35 ` JIANG Muhui
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Richard Henderson @ 2020-11-25 3:18 UTC (permalink / raw)
To: qemu-devel
** Changed in: qemu
Assignee: (unassigned) => Richard Henderson (rth)
--
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1905356
Title:
No check for unaligned data access in ARM32 instructions
Status in QEMU:
Confirmed
Bug description:
hi
According to the ARM documentation, there are alignment requirements
of load/store instructions. Alignment fault should be raised if the
alignment check is failed. However, it seems that QEMU doesn't
implement this, which is against the documentation of ARM. For
example, the instruction LDRD/STRD/LDREX/STREX must check the address
is word alignment no matter what value the SCTLR.A is.
I attached a testcase, which contains an instruction at VA 0x10240:
ldrd r0,[pc.#1] in the main function. QEMU can successfully load the
data in the unaligned address. The test is done in QEMU 5.1.0. I can
provide more testcases for the other instructions if you need. Many
thanks.
To patch this, we need a check while we translate the instruction to
tcg. If the address is unaligned, a signal number (i.e., SIGBUS)
should be raised.
Regards
Muhui
To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1905356/+subscriptions
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug 1905356] Re: No check for unaligned data access in ARM32 instructions
2020-11-24 5:05 [Bug 1905356] [NEW] No check for unaligned data access in ARM32 instructions JIANG Muhui
2020-11-24 23:46 ` [Bug 1905356] " Richard Henderson
2020-11-25 3:18 ` Richard Henderson
@ 2020-11-25 3:35 ` JIANG Muhui
2020-11-25 4:04 ` Richard Henderson
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: JIANG Muhui @ 2020-11-25 3:35 UTC (permalink / raw)
To: qemu-devel
Thanks for confirmation.
Btw: I was wondering why the fix will only apply to system mode rather
than user-only mode. Unaligned data access is not permitted in user
level programs, either.
--
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1905356
Title:
No check for unaligned data access in ARM32 instructions
Status in QEMU:
Confirmed
Bug description:
hi
According to the ARM documentation, there are alignment requirements
of load/store instructions. Alignment fault should be raised if the
alignment check is failed. However, it seems that QEMU doesn't
implement this, which is against the documentation of ARM. For
example, the instruction LDRD/STRD/LDREX/STREX must check the address
is word alignment no matter what value the SCTLR.A is.
I attached a testcase, which contains an instruction at VA 0x10240:
ldrd r0,[pc.#1] in the main function. QEMU can successfully load the
data in the unaligned address. The test is done in QEMU 5.1.0. I can
provide more testcases for the other instructions if you need. Many
thanks.
To patch this, we need a check while we translate the instruction to
tcg. If the address is unaligned, a signal number (i.e., SIGBUS)
should be raised.
Regards
Muhui
To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1905356/+subscriptions
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug 1905356] Re: No check for unaligned data access in ARM32 instructions
2020-11-24 5:05 [Bug 1905356] [NEW] No check for unaligned data access in ARM32 instructions JIANG Muhui
` (2 preceding siblings ...)
2020-11-25 3:35 ` JIANG Muhui
@ 2020-11-25 4:04 ` Richard Henderson
2020-11-25 4:47 ` Richard Henderson
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Richard Henderson @ 2020-11-25 4:04 UTC (permalink / raw)
To: qemu-devel
Because for user-only, we cheat and use host load/store
operations directly. This makes for much faster emulation
but imposes a number of limitations -- including ignoring
of the alignment bits on hosts that have native unaligned
accesses.
As a corollary, when running user-only on a host that
enforces alignment, you cannot emulate a guest that
*allows* unaligned accesses.
--
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1905356
Title:
No check for unaligned data access in ARM32 instructions
Status in QEMU:
Confirmed
Bug description:
hi
According to the ARM documentation, there are alignment requirements
of load/store instructions. Alignment fault should be raised if the
alignment check is failed. However, it seems that QEMU doesn't
implement this, which is against the documentation of ARM. For
example, the instruction LDRD/STRD/LDREX/STREX must check the address
is word alignment no matter what value the SCTLR.A is.
I attached a testcase, which contains an instruction at VA 0x10240:
ldrd r0,[pc.#1] in the main function. QEMU can successfully load the
data in the unaligned address. The test is done in QEMU 5.1.0. I can
provide more testcases for the other instructions if you need. Many
thanks.
To patch this, we need a check while we translate the instruction to
tcg. If the address is unaligned, a signal number (i.e., SIGBUS)
should be raised.
Regards
Muhui
To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1905356/+subscriptions
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug 1905356] Re: No check for unaligned data access in ARM32 instructions
2020-11-24 5:05 [Bug 1905356] [NEW] No check for unaligned data access in ARM32 instructions JIANG Muhui
` (3 preceding siblings ...)
2020-11-25 4:04 ` Richard Henderson
@ 2020-11-25 4:47 ` Richard Henderson
2021-05-05 5:31 ` Thomas Huth
2021-08-25 7:12 ` Thomas Huth
6 siblings, 0 replies; 8+ messages in thread
From: Richard Henderson @ 2020-11-25 4:47 UTC (permalink / raw)
To: qemu-devel
Proposed patches:
https://patchew.org/QEMU/20201125040642.2339476-1-richard.henderson@linaro.org/
--
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1905356
Title:
No check for unaligned data access in ARM32 instructions
Status in QEMU:
Confirmed
Bug description:
hi
According to the ARM documentation, there are alignment requirements
of load/store instructions. Alignment fault should be raised if the
alignment check is failed. However, it seems that QEMU doesn't
implement this, which is against the documentation of ARM. For
example, the instruction LDRD/STRD/LDREX/STREX must check the address
is word alignment no matter what value the SCTLR.A is.
I attached a testcase, which contains an instruction at VA 0x10240:
ldrd r0,[pc.#1] in the main function. QEMU can successfully load the
data in the unaligned address. The test is done in QEMU 5.1.0. I can
provide more testcases for the other instructions if you need. Many
thanks.
To patch this, we need a check while we translate the instruction to
tcg. If the address is unaligned, a signal number (i.e., SIGBUS)
should be raised.
Regards
Muhui
To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1905356/+subscriptions
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug 1905356] Re: No check for unaligned data access in ARM32 instructions
2020-11-24 5:05 [Bug 1905356] [NEW] No check for unaligned data access in ARM32 instructions JIANG Muhui
` (4 preceding siblings ...)
2020-11-25 4:47 ` Richard Henderson
@ 2021-05-05 5:31 ` Thomas Huth
2021-08-25 7:12 ` Thomas Huth
6 siblings, 0 replies; 8+ messages in thread
From: Thomas Huth @ 2021-05-05 5:31 UTC (permalink / raw)
To: qemu-devel
Richard's patches have been merged (see
https://git.qemu.org/?p=qemu.git;a=commitdiff;h=4d753eb5fb03ee7bc71ec
and the following ones), so I'm setting the state to "Fix committed"
now.
** Changed in: qemu
Status: Confirmed => Fix Committed
--
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1905356
Title:
No check for unaligned data access in ARM32 instructions
Status in QEMU:
Fix Committed
Bug description:
hi
According to the ARM documentation, there are alignment requirements
of load/store instructions. Alignment fault should be raised if the
alignment check is failed. However, it seems that QEMU doesn't
implement this, which is against the documentation of ARM. For
example, the instruction LDRD/STRD/LDREX/STREX must check the address
is word alignment no matter what value the SCTLR.A is.
I attached a testcase, which contains an instruction at VA 0x10240:
ldrd r0,[pc.#1] in the main function. QEMU can successfully load the
data in the unaligned address. The test is done in QEMU 5.1.0. I can
provide more testcases for the other instructions if you need. Many
thanks.
To patch this, we need a check while we translate the instruction to
tcg. If the address is unaligned, a signal number (i.e., SIGBUS)
should be raised.
Regards
Muhui
To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1905356/+subscriptions
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug 1905356] Re: No check for unaligned data access in ARM32 instructions
2020-11-24 5:05 [Bug 1905356] [NEW] No check for unaligned data access in ARM32 instructions JIANG Muhui
` (5 preceding siblings ...)
2021-05-05 5:31 ` Thomas Huth
@ 2021-08-25 7:12 ` Thomas Huth
6 siblings, 0 replies; 8+ messages in thread
From: Thomas Huth @ 2021-08-25 7:12 UTC (permalink / raw)
To: qemu-devel
** Changed in: qemu
Status: Fix Committed => Fix Released
--
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1905356
Title:
No check for unaligned data access in ARM32 instructions
Status in QEMU:
Fix Released
Bug description:
hi
According to the ARM documentation, there are alignment requirements
of load/store instructions. Alignment fault should be raised if the
alignment check is failed. However, it seems that QEMU doesn't
implement this, which is against the documentation of ARM. For
example, the instruction LDRD/STRD/LDREX/STREX must check the address
is word alignment no matter what value the SCTLR.A is.
I attached a testcase, which contains an instruction at VA 0x10240:
ldrd r0,[pc.#1] in the main function. QEMU can successfully load the
data in the unaligned address. The test is done in QEMU 5.1.0. I can
provide more testcases for the other instructions if you need. Many
thanks.
To patch this, we need a check while we translate the instruction to
tcg. If the address is unaligned, a signal number (i.e., SIGBUS)
should be raised.
Regards
Muhui
To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1905356/+subscriptions
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-08-25 7:22 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-24 5:05 [Bug 1905356] [NEW] No check for unaligned data access in ARM32 instructions JIANG Muhui
2020-11-24 23:46 ` [Bug 1905356] " Richard Henderson
2020-11-25 3:18 ` Richard Henderson
2020-11-25 3:35 ` JIANG Muhui
2020-11-25 4:04 ` Richard Henderson
2020-11-25 4:47 ` Richard Henderson
2021-05-05 5:31 ` Thomas Huth
2021-08-25 7:12 ` Thomas Huth
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).