* [PATCH] tests/tcg: fix out-of-bounds access in test-avx
@ 2023-10-20 7:21 Paolo Bonzini
2023-10-20 15:37 ` Richard Henderson
0 siblings, 1 reply; 2+ messages in thread
From: Paolo Bonzini @ 2023-10-20 7:21 UTC (permalink / raw)
To: qemu-devel
This can cause differences between native and QEMU execution, due
to ASLR.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
tests/tcg/i386/test-avx.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/tests/tcg/i386/test-avx.c b/tests/tcg/i386/test-avx.c
index c39c0e5bce8..910b0673535 100644
--- a/tests/tcg/i386/test-avx.c
+++ b/tests/tcg/i386/test-avx.c
@@ -236,12 +236,15 @@ v4di val_i64[] = {
v4di deadbeef = {0xa5a5a5a5deadbeefull, 0xa5a5a5a5deadbeefull,
0xa5a5a5a5deadbeefull, 0xa5a5a5a5deadbeefull};
-v4di indexq = {0x000000000000001full, 0x000000000000008full,
- 0xffffffffffffffffull, 0xffffffffffffff5full};
-v4di indexd = {0x00000002000000efull, 0xfffffff500000010ull,
- 0x0000000afffffff0ull, 0x000000000000000eull};
+/* &gather_mem[0x10] is 512 bytes from the base; indices must be >=-64, <64
+ * to account for scaling by 8 */
+v4di indexq = {0x000000000000001full, 0x000000000000003dull,
+ 0xffffffffffffffffull, 0xffffffffffffffdfull};
+v4di indexd = {0x00000002ffffffcdull, 0xfffffff500000010ull,
+ 0x0000003afffffff0ull, 0x000000000000000eull};
v4di gather_mem[0x20];
+_Static_assert(sizeof(gather_mem) == 1024);
void init_f16reg(v4di *r)
{
--
2.41.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] tests/tcg: fix out-of-bounds access in test-avx
2023-10-20 7:21 [PATCH] tests/tcg: fix out-of-bounds access in test-avx Paolo Bonzini
@ 2023-10-20 15:37 ` Richard Henderson
0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 2023-10-20 15:37 UTC (permalink / raw)
To: Paolo Bonzini, qemu-devel
On 10/20/23 00:21, Paolo Bonzini wrote:
> This can cause differences between native and QEMU execution, due
> to ASLR.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> tests/tcg/i386/test-avx.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
>
> diff --git a/tests/tcg/i386/test-avx.c b/tests/tcg/i386/test-avx.c
> index c39c0e5bce8..910b0673535 100644
> --- a/tests/tcg/i386/test-avx.c
> +++ b/tests/tcg/i386/test-avx.c
> @@ -236,12 +236,15 @@ v4di val_i64[] = {
>
> v4di deadbeef = {0xa5a5a5a5deadbeefull, 0xa5a5a5a5deadbeefull,
> 0xa5a5a5a5deadbeefull, 0xa5a5a5a5deadbeefull};
> -v4di indexq = {0x000000000000001full, 0x000000000000008full,
> - 0xffffffffffffffffull, 0xffffffffffffff5full};
> -v4di indexd = {0x00000002000000efull, 0xfffffff500000010ull,
> - 0x0000000afffffff0ull, 0x000000000000000eull};
> +/* &gather_mem[0x10] is 512 bytes from the base; indices must be >=-64, <64
> + * to account for scaling by 8 */
> +v4di indexq = {0x000000000000001full, 0x000000000000003dull,
> + 0xffffffffffffffffull, 0xffffffffffffffdfull};
> +v4di indexd = {0x00000002ffffffcdull, 0xfffffff500000010ull,
> + 0x0000003afffffff0ull, 0x000000000000000eull};
>
> v4di gather_mem[0x20];
> +_Static_assert(sizeof(gather_mem) == 1024);
>
> void init_f16reg(v4di *r)
> {
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-10-20 15:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-20 7:21 [PATCH] tests/tcg: fix out-of-bounds access in test-avx Paolo Bonzini
2023-10-20 15:37 ` Richard Henderson
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).