[PATCH v7 34/39] kselftest/arm64: Add a GCS test program built with the system libc

Mark Brown broonie at kernel.org
Fri Dec 15 06:59:51 PST 2023


On Thu, Dec 14, 2023 at 11:50:11PM -0300, Thiago Jung Bauermann wrote:
> Mark Brown <broonie at kernel.org> writes:

> > +	ret = process_vm_writev(child, &local_iov, 1, &remote_iov, 1, 0);
> > +	if (ret == -1)
> > +		ksft_print_msg("process_vm_readv() failed: %s (%d)\n",
> > +			       strerror(errno), errno);

> The comment and the error message say "process_vm_readv()", but the
> function actually called is process_vm_writev(). Is this intended?

No, that's a rebasing issue.

> If I swap process_vm_readv() and process_vm_writev(), then the read
> succeeds but the write fails:
> 
> #  RUN           global.ptrace_read_write ...
> # Child: 1996
> # Child GCSPR 0xffffa7fcffd8, flags 1, locked 0
> # process_vm_writev() failed: Bad address (14)
> # libc-gcs.c:291:ptrace_read_write:Expected ret (-1) == sizeof(rval) (8)
> # libc-gcs.c:293:ptrace_read_write:Expected val (281473500358268) == ptrace(PTRACE_PEEKDATA, child, (void *)gcspr, NULL) (0)
> # ptrace_read_write: Test failed at step #1
> #          FAIL  global.ptrace_read_write
> not ok 4 global.ptrace_read_write

Yeah, I did notice something had happened with the writes but didn't
investigate yet.

> Also, it's strange that the tests defined after map_gcs.stack_overflow
> don't run when I execute this test program. I'm doing:

> $ ./run_kselftest.sh -t arm64:libc-gcs

> I.e., these tests aren't being run in my FVP:

> > +FIXTURE_VARIANT_ADD(map_invalid_gcs, too_small)
> > +FIXTURE_VARIANT_ADD(map_invalid_gcs, unligned_1)
> > +FIXTURE_VARIANT_ADD(map_invalid_gcs, unligned_2)
> > +FIXTURE_VARIANT_ADD(map_invalid_gcs, unligned_3)
> > +FIXTURE_VARIANT_ADD(map_invalid_gcs, unligned_4)
> > +FIXTURE_VARIANT_ADD(map_invalid_gcs, unligned_5)
> > +FIXTURE_VARIANT_ADD(map_invalid_gcs, unligned_6)
> > +FIXTURE_VARIANT_ADD(map_invalid_gcs, unligned_7)
> > +TEST_F(map_invalid_gcs, do_map)
> > +FIXTURE_VARIANT_ADD(invalid_mprotect, exec)
> > +FIXTURE_VARIANT_ADD(invalid_mprotect, bti)
> > +FIXTURE_VARIANT_ADD(invalid_mprotect, exec_bti)
> > +TEST_F(invalid_mprotect, do_map)
> > +TEST_F(invalid_mprotect, do_map_read)

I'm seeing all of those appearing.  I'm not sure what to say there -
that's all kselftest framework stuff, I'd expect the framework to say
something about what it's doing if it decides to skip and I can't think
why it would decide to skip.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20231215/632ebdef/attachment.sig>


More information about the linux-arm-kernel mailing list