On Sat, Dec 16, 2023 at 11:12:37PM -0300, Thiago Jung Bauermann wrote: > Mark Brown <broonie@xxxxxxxxxx> 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.
Attachment:
signature.asc
Description: PGP signature