Skip to content

Conversation

Th0rOnDoR
Copy link

No description provided.

/*
* Used to retrieve for a domain using coco
*/
int libxl_domain_attestation(libxl_ctx *ctx, uint32_t domain_id, FILE *file, bool is_mmonce_file, char *mmonce);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

domain_id -> domid

I don't think exposing FILE * in the ABI is wise, if streaming something is absolutely necessary, a fd would be preferable.

DEFINE_XEN_GUEST_HANDLE(coco_prepare_initial_mem_t);

struct coco_attestation_report {
uint32_t handle; /* IN */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be domid_t domid; instead

void* address; /* In */
uint8_t mnonce[16]; /* In */
uint32_t len; /* In/Out */
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's (almost) the same struct as the previous one

}

report.handle = domain_id;
report.address = &result;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

userland virtual addresses (e.g pointers) in hypercalls is incorrect even though it often works (but can randomly fail depending on how the process memory is managed)

char resp[208];

d = get_domain_by_id(report.handle);
rc = d->coco_ops->domain_attestation_report(d, report, resp);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need to check that :

  • domain actually exists (d != NULL); report -ENOENT otherwise
  • domain is confidential computing (is_coco_domain); report -EINVAL otherwise
  • d->coco_ops && d->coco_ops->domain_attestation_report (so that platforms that don't support it don't cause NULL dereference); report -EOPNOTSUPP (or -ENODEV?) otherwise

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants