On Tue, 2024-01-30 at 09:01 +1000, Richard Henderson wrote: > From: Ilya Leoshkevich <i...@linux.ibm.com> > > Make sure that qemu gdbstub, like gdbserver, allows reading from and > writing to PROT_NONE pages. > > Signed-off-by: Ilya Leoshkevich <i...@linux.ibm.com> > Message-Id: <20240129093410.3151-4-...@linux.ibm.com> > Signed-off-by: Richard Henderson <richard.hender...@linaro.org> > --- > tests/tcg/multiarch/prot-none.c | 40 > ++++++++++++++++++++++++ > tests/tcg/multiarch/Makefile.target | 9 +++++- > tests/tcg/multiarch/gdbstub/prot-none.py | 36 +++++++++++++++++++++ > 3 files changed, 84 insertions(+), 1 deletion(-) > create mode 100644 tests/tcg/multiarch/prot-none.c > create mode 100644 tests/tcg/multiarch/gdbstub/prot-none.py
[...] > diff --git a/tests/tcg/multiarch/gdbstub/prot-none.py > b/tests/tcg/multiarch/gdbstub/prot-none.py > new file mode 100644 > index 0000000000..e829d3ebc5 > --- /dev/null > +++ b/tests/tcg/multiarch/gdbstub/prot-none.py > @@ -0,0 +1,36 @@ > +"""Test that GDB can access PROT_NONE pages. > + > +This runs as a sourced script (via -x, via run-test.py). > + > +SPDX-License-Identifier: GPL-2.0-or-later > +""" > +import ctypes > +from test_gdbstub import main, report > + > + > +def probe_proc_self_mem(): > + buf = ctypes.create_string_buffer(b'aaa') > + try: > + with open("/proc/self/mem", "rb") as fp: > + fp.seek(ctypes.addressof(buf)) > + return fp.read(3) == b'aaa' > + except OSError: > + return False > + > + > +def run_test(): > + """Run through the tests one by one""" > + if not probe_proc_self_mem: I noticed that I made an embarrassing typo here: this should be `not probe_proc_self_mem()`. I posted a v5 with the correction. [...]