Mark Brown broonie@kernel.org writes:
+static int preserve_gcs_context(struct gcs_context __user *ctx) +{
- int err = 0;
 - u64 gcspr;
 - /*
 * We will add a cap token to the frame, include it in the* GCSPR_EL0 we report to support stack switching via* sigreturn.*/- gcs_preserve_current_state();
 - gcspr = current->thread.gcspr_el0;
 - if (task_gcs_el0_enabled(current))
 gcspr -= 8;- __put_user_error(GCS_MAGIC, &ctx->head.magic, err);
 - __put_user_error(sizeof(*ctx), &ctx->head.size, err);
 - __put_user_error(gcspr, &ctx->gcspr, err);
 - __put_user_error(current->thread.gcs_el0_mode,
 &ctx->features_enabled, err);
Other preserve_<foo>_context() functions zero the reserved fields in ctx. I suggest doing the same here. It helps with backward compatibility.
- return err;
 +}