[PATCH v7 36/39] selftests/arm64: Add GCS signal tests

Mark Brown broonie at kernel.org
Thu Jan 18 13:10:43 PST 2024


On Sat, Dec 16, 2023 at 11:12:37PM -0300, Thiago Jung Bauermann wrote:
> Mark Brown <broonie at kernel.org> writes:

> > +/* This should be includable from some standard header, but which? */
> > +#ifndef SEGV_CPERR
> > +#define SEGV_CPERR 10
> > +#endif

> One suggestion is include/uapi/asm-generic/siginfo.h. It already has
> SEGV_MTEAERR and SEGV_MTESERR, as well as si_codes specific to other
> arches.

Sadly the testsuite is being very clever with redefining siginfo_t which
means it conflicts with that header.  I'll update the comment.

> > +	if (!get_current_context(td, &context.uc, sizeof(context))) {
> > +		fprintf(stderr, "Failed getting context\n");
> > +		return 1;
> > +	}

> At this point, before any function call is made, can the test check that
> *(gcspr + 8) == 0? This would detect the issue I mentioned in
> patch 24 of gcs_restore_signal() not zeroing the location of the cap.

Sure.

> > +	if (gcs->gcspr != gcspr) {
> > +		fprintf(stderr, "Got GCSPR %llx but expected %lx\n",
> > +			gcs->gcspr, gcspr);
> > +		return 1;
> > +	}

> I suggest adding a new check here to ensure that gcs->reserved == 0.

This would mean that you couldn't use an old kselftest build to verify
a new kernel that starts using the reserved bits.  It's niche but it
does seem like something that should work.
-------------- 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-riscv/attachments/20240118/44c74595/attachment.sig>


More information about the linux-riscv mailing list