[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 3/3] tests/tcg: Add the PROT_NONE gdbstub test
From: |
Ilya Leoshkevich |
Subject: |
Re: [PATCH v3 3/3] tests/tcg: Add the PROT_NONE gdbstub test |
Date: |
Thu, 25 Jan 2024 03:39:49 +0100 |
On Mon, Jan 22, 2024 at 11:19:05PM +0000, Alex Bennée wrote:
> Ilya Leoshkevich <iii@linux.ibm.com> writes:
>
> > On Mon, Jan 22, 2024 at 03:54:32PM +0000, Alex Bennée wrote:
> >> Ilya Leoshkevich <iii@linux.ibm.com> writes:
> >>
> >> > Make sure that qemu gdbstub, like gdbserver, allows reading from and
> >> > writing to PROT_NONE pages.
> >> >
> >> > Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> >> > ---
> >> > tests/tcg/multiarch/Makefile.target | 9 +++++-
> >> > tests/tcg/multiarch/gdbstub/prot-none.py | 22 +++++++++++++
> >> > tests/tcg/multiarch/prot-none.c | 40 ++++++++++++++++++++++++
> >> > 3 files changed, 70 insertions(+), 1 deletion(-)
> >> > create mode 100644 tests/tcg/multiarch/gdbstub/prot-none.py
> >> > create mode 100644 tests/tcg/multiarch/prot-none.c
> >
> > [...]
> >
> >> > +def run_test():
> >> > + """Run through the tests one by one"""
> >> > + gdb.Breakpoint("break_here")
> >> > + gdb.execute("continue")
> >> > + val = gdb.parse_and_eval("*(char[2] *)q").string()
> >>
> >> Better traceback:
> >>
> >> Breakpoint 1, break_here (q=0x400000802fff) at
> >> /home/alex/lsrc/qemu.git/tests/tcg/multiarch/prot-none.c:14
> >> 14 }
> >> GDB Exception:
> >> Traceback (most recent call last):
> >> File "/home/alex/lsrc/qemu.git/tests/guest-debug/test_gdbstub.py",
> >> line 42, in main
> >> test()
> >> File "./tests/tcg/multiarch/gdbstub/prot-none.py", line 14, in run_test
> >> val = gdb.parse_and_eval("*(char[2] *)q").string()
> >> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> >> gdb.MemoryError: Cannot access memory at address 0x400000802fff
> >> Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux
> >> Type "help", "copyright", "credits" or "license" for more information.
> >> (InteractiveConsole)
> >> >>>
> >
> > Thanks for the debug output. This shows that the feature being tested
> > doesn't work (the value of `q` looks sane to me). May I ask what host
> > distro is this? I tried on x86_64 Fedora 38 and x86_64 Ubuntu 22.04 so
> > far, and the test was successful.
>
> Debian Bookworm (x86_64) with gdb-multiarch installed.
> >
> > [...]
>
> --
> Alex Bennée
> Virtualisation Tech Lead @ Linaro
Hm, I tried that (in a VM, in case the kernel is somehow involved) and
that worked too:
Breakpoint 1, break_here (q=0x400000802fff) at
/qemu/tests/tcg/multiarch/prot-none.c:14
14 }
PASS: 42 == 42
I wonder what else can be different. Can it be that in your case the
test runs without /proc? Or perhaps some additional LSM is enabled?
[PATCH v3 1/3] linux-user: Allow gdbstub to ignore page protection, Ilya Leoshkevich, 2024/01/15
[PATCH v3 2/3] tests/tcg: Factor out gdbstub test functions, Ilya Leoshkevich, 2024/01/15