* [PATCH v2 0/2] target/i386: Make sure that vsyscall's tb->size != 0
@ 2021-05-19 4:57 Ilya Leoshkevich
2021-05-19 4:57 ` [PATCH v2 1/2] " Ilya Leoshkevich
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Ilya Leoshkevich @ 2021-05-19 4:57 UTC (permalink / raw)
To: Cornelia Huck, Peter Maydell, Paolo Bonzini, Richard Henderson,
Eduardo Habkost
Cc: Christian Borntraeger, qemu-devel, Ilya Leoshkevich
This series for the s390-next tree fixes [1]. Patch 1 is the fix, patch
2 is the new test to avoid similar regressions in the future.
[1] https://lists.nongnu.org/archive/html/qemu-devel/2021-05/msg02962.html
v1: https://lists.gnu.org/archive/html/qemu-devel/2021-05/msg03219.html
v1 -> v2: Fixed a problem with compiling the new test on centos7. `make
docker-all-tests` does not spot any other issues with the
updated patch (it does fail though: a number of iotests have
problems, there is a build problem with musl, etc, but this
all happens without the patch too).
Ilya Leoshkevich (2):
target/i386: Make sure that vsyscall's tb->size != 0
tests/tcg/x86_64: add vsyscall smoke test
target/i386/tcg/translate.c | 1 +
tests/tcg/x86_64/Makefile.target | 6 +++++-
tests/tcg/x86_64/vsyscall.c | 12 ++++++++++++
3 files changed, 18 insertions(+), 1 deletion(-)
create mode 100644 tests/tcg/x86_64/vsyscall.c
--
2.31.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/2] target/i386: Make sure that vsyscall's tb->size != 0
2021-05-19 4:57 [PATCH v2 0/2] target/i386: Make sure that vsyscall's tb->size != 0 Ilya Leoshkevich
@ 2021-05-19 4:57 ` Ilya Leoshkevich
2021-05-19 4:57 ` [PATCH v2 2/2] tests/tcg/x86_64: add vsyscall smoke test Ilya Leoshkevich
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Ilya Leoshkevich @ 2021-05-19 4:57 UTC (permalink / raw)
To: Cornelia Huck, Peter Maydell, Paolo Bonzini, Richard Henderson,
Eduardo Habkost
Cc: Christian Borntraeger, qemu-devel, Ilya Leoshkevich
tb_gen_code() assumes that tb->size must never be zero, otherwise it
may produce spurious exceptions. For x86_64 this may happen when
creating a translation block for the vsyscall page.
Fix by pretending that vsyscall translation blocks have at least one
instruction.
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
target/i386/tcg/translate.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c
index 880bc45561..b5a2b981e2 100644
--- a/target/i386/tcg/translate.c
+++ b/target/i386/tcg/translate.c
@@ -8572,6 +8572,7 @@ static void i386_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
*/
if ((dc->base.pc_next & TARGET_PAGE_MASK) == TARGET_VSYSCALL_PAGE) {
gen_exception(dc, EXCP_VSYSCALL, dc->base.pc_next);
+ dc->base.pc_next = dc->pc + 1;
return;
}
#endif
--
2.31.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/2] tests/tcg/x86_64: add vsyscall smoke test
2021-05-19 4:57 [PATCH v2 0/2] target/i386: Make sure that vsyscall's tb->size != 0 Ilya Leoshkevich
2021-05-19 4:57 ` [PATCH v2 1/2] " Ilya Leoshkevich
@ 2021-05-19 4:57 ` Ilya Leoshkevich
2021-05-19 16:42 ` Richard Henderson
2021-05-19 11:14 ` [PATCH v2 0/2] target/i386: Make sure that vsyscall's tb->size != 0 Cornelia Huck
2021-05-19 17:13 ` Cornelia Huck
3 siblings, 1 reply; 6+ messages in thread
From: Ilya Leoshkevich @ 2021-05-19 4:57 UTC (permalink / raw)
To: Cornelia Huck, Peter Maydell, Paolo Bonzini, Richard Henderson,
Eduardo Habkost
Cc: Christian Borntraeger, qemu-devel, Ilya Leoshkevich
Having a small test will prevent trivial regressions in the future.
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
tests/tcg/x86_64/Makefile.target | 6 +++++-
tests/tcg/x86_64/vsyscall.c | 12 ++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
create mode 100644 tests/tcg/x86_64/vsyscall.c
diff --git a/tests/tcg/x86_64/Makefile.target b/tests/tcg/x86_64/Makefile.target
index 20bf96202a..2151ea6302 100644
--- a/tests/tcg/x86_64/Makefile.target
+++ b/tests/tcg/x86_64/Makefile.target
@@ -3,14 +3,18 @@
# x86_64 tests - included from tests/tcg/Makefile.target
#
# Currently we only build test-x86_64 and test-i386-ssse3 from
-# $(SRC)/tests/tcg/i386/
+# $(SRC_PATH)/tests/tcg/i386/
#
include $(SRC_PATH)/tests/tcg/i386/Makefile.target
+X86_64_TESTS += vsyscall
TESTS=$(MULTIARCH_TESTS) $(X86_64_TESTS) test-x86_64
QEMU_OPTS += -cpu max
test-x86_64: LDFLAGS+=-lm -lc
test-x86_64: test-i386.c test-i386.h test-i386-shift.h test-i386-muldiv.h
$(CC) $(CFLAGS) $< -o $@ $(LDFLAGS)
+
+vsyscall: $(SRC_PATH)/tests/tcg/x86_64/vsyscall.c
+ $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS)
diff --git a/tests/tcg/x86_64/vsyscall.c b/tests/tcg/x86_64/vsyscall.c
new file mode 100644
index 0000000000..786b047053
--- /dev/null
+++ b/tests/tcg/x86_64/vsyscall.c
@@ -0,0 +1,12 @@
+#include <stdio.h>
+#include <time.h>
+
+#define VSYSCALL_PAGE 0xffffffffff600000
+#define TIME_OFFSET 0x400
+typedef time_t (*time_func)(time_t *);
+
+int main(void)
+{
+ printf("%ld\n", ((time_func)(VSYSCALL_PAGE + TIME_OFFSET))(NULL));
+ return 0;
+}
--
2.31.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/2] target/i386: Make sure that vsyscall's tb->size != 0
2021-05-19 4:57 [PATCH v2 0/2] target/i386: Make sure that vsyscall's tb->size != 0 Ilya Leoshkevich
2021-05-19 4:57 ` [PATCH v2 1/2] " Ilya Leoshkevich
2021-05-19 4:57 ` [PATCH v2 2/2] tests/tcg/x86_64: add vsyscall smoke test Ilya Leoshkevich
@ 2021-05-19 11:14 ` Cornelia Huck
2021-05-19 17:13 ` Cornelia Huck
3 siblings, 0 replies; 6+ messages in thread
From: Cornelia Huck @ 2021-05-19 11:14 UTC (permalink / raw)
To: Ilya Leoshkevich
Cc: Peter Maydell, Eduardo Habkost, Richard Henderson, qemu-devel,
Christian Borntraeger, Paolo Bonzini
On Wed, 19 May 2021 06:57:36 +0200
Ilya Leoshkevich <iii@linux.ibm.com> wrote:
> This series for the s390-next tree fixes [1]. Patch 1 is the fix, patch
> 2 is the new test to avoid similar regressions in the future.
>
> [1] https://lists.nongnu.org/archive/html/qemu-devel/2021-05/msg02962.html
>
> v1: https://lists.gnu.org/archive/html/qemu-devel/2021-05/msg03219.html
> v1 -> v2: Fixed a problem with compiling the new test on centos7. `make
> docker-all-tests` does not spot any other issues with the
> updated patch (it does fail though: a number of iotests have
> problems, there is a build problem with musl, etc, but this
> all happens without the patch too).
>
> Ilya Leoshkevich (2):
> target/i386: Make sure that vsyscall's tb->size != 0
> tests/tcg/x86_64: add vsyscall smoke test
>
> target/i386/tcg/translate.c | 1 +
> tests/tcg/x86_64/Makefile.target | 6 +++++-
> tests/tcg/x86_64/vsyscall.c | 12 ++++++++++++
> 3 files changed, 18 insertions(+), 1 deletion(-)
> create mode 100644 tests/tcg/x86_64/vsyscall.c
>
Passes my tests and CI now.
Can I get an ack on patch 2? :)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/2] tests/tcg/x86_64: add vsyscall smoke test
2021-05-19 4:57 ` [PATCH v2 2/2] tests/tcg/x86_64: add vsyscall smoke test Ilya Leoshkevich
@ 2021-05-19 16:42 ` Richard Henderson
0 siblings, 0 replies; 6+ messages in thread
From: Richard Henderson @ 2021-05-19 16:42 UTC (permalink / raw)
To: Ilya Leoshkevich, Cornelia Huck, Peter Maydell, Paolo Bonzini,
Eduardo Habkost
Cc: Christian Borntraeger, qemu-devel
On 5/18/21 11:57 PM, Ilya Leoshkevich wrote:
> Having a small test will prevent trivial regressions in the future.
>
> Signed-off-by: Ilya Leoshkevich<iii@linux.ibm.com>
> ---
> tests/tcg/x86_64/Makefile.target | 6 +++++-
> tests/tcg/x86_64/vsyscall.c | 12 ++++++++++++
> 2 files changed, 17 insertions(+), 1 deletion(-)
> create mode 100644 tests/tcg/x86_64/vsyscall.c
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/2] target/i386: Make sure that vsyscall's tb->size != 0
2021-05-19 4:57 [PATCH v2 0/2] target/i386: Make sure that vsyscall's tb->size != 0 Ilya Leoshkevich
` (2 preceding siblings ...)
2021-05-19 11:14 ` [PATCH v2 0/2] target/i386: Make sure that vsyscall's tb->size != 0 Cornelia Huck
@ 2021-05-19 17:13 ` Cornelia Huck
3 siblings, 0 replies; 6+ messages in thread
From: Cornelia Huck @ 2021-05-19 17:13 UTC (permalink / raw)
To: Ilya Leoshkevich
Cc: Peter Maydell, Eduardo Habkost, Richard Henderson, qemu-devel,
Christian Borntraeger, Paolo Bonzini
On Wed, 19 May 2021 06:57:36 +0200
Ilya Leoshkevich <iii@linux.ibm.com> wrote:
> This series for the s390-next tree fixes [1]. Patch 1 is the fix, patch
> 2 is the new test to avoid similar regressions in the future.
>
> [1] https://lists.nongnu.org/archive/html/qemu-devel/2021-05/msg02962.html
>
> v1: https://lists.gnu.org/archive/html/qemu-devel/2021-05/msg03219.html
> v1 -> v2: Fixed a problem with compiling the new test on centos7. `make
> docker-all-tests` does not spot any other issues with the
> updated patch (it does fail though: a number of iotests have
> problems, there is a build problem with musl, etc, but this
> all happens without the patch too).
>
> Ilya Leoshkevich (2):
> target/i386: Make sure that vsyscall's tb->size != 0
> tests/tcg/x86_64: add vsyscall smoke test
>
> target/i386/tcg/translate.c | 1 +
> tests/tcg/x86_64/Makefile.target | 6 +++++-
> tests/tcg/x86_64/vsyscall.c | 12 ++++++++++++
> 3 files changed, 18 insertions(+), 1 deletion(-)
> create mode 100644 tests/tcg/x86_64/vsyscall.c
>
Thanks, queued to s390-next.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-05-19 17:23 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-19 4:57 [PATCH v2 0/2] target/i386: Make sure that vsyscall's tb->size != 0 Ilya Leoshkevich
2021-05-19 4:57 ` [PATCH v2 1/2] " Ilya Leoshkevich
2021-05-19 4:57 ` [PATCH v2 2/2] tests/tcg/x86_64: add vsyscall smoke test Ilya Leoshkevich
2021-05-19 16:42 ` Richard Henderson
2021-05-19 11:14 ` [PATCH v2 0/2] target/i386: Make sure that vsyscall's tb->size != 0 Cornelia Huck
2021-05-19 17:13 ` Cornelia Huck
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).