Skip to content
This repository has been archived by the owner on Jan 26, 2024. It is now read-only.

get-report.c: fix compilation error with >= 6.4 kernels #41

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 33 additions & 2 deletions src/get-report.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,37 @@ struct options {
bool do_help;
};

/*
* Layout of snp_guest_request_ioctl
* since kernel v6.4:
* struct snp_guest_request_ioctl {
*
* __u8 msg_version;
*
* __u64 req_data;
* __u64 resp_data;
*
* union {
* __u64 exitinfo2;
* struct {
* __u32 fw_error;
* __u32 vmm_error;
* };
* };
* };
*/
struct guest_request_ioctl {
/* message version number (must be non-zero) */
__u8 msg_version;

/* Request and response structure address */
__u64 req_data;
__u64 resp_data;

__u64 fw_err;
};


void print_usage(void)
{
fprintf(stderr,
Expand Down Expand Up @@ -257,7 +288,7 @@ int get_report(const uint8_t *data, size_t data_size,
int fd = -1;
struct snp_report_req req;
struct snp_report_resp resp;
struct snp_guest_request_ioctl guest_req;
struct guest_request_ioctl guest_req;
struct msg_report_resp *report_resp = (struct msg_report_resp *)&resp.data;

if (!report) {
Expand Down Expand Up @@ -334,7 +365,7 @@ int get_extended_report(const uint8_t *data, size_t data_size,
int fd = -1;
struct snp_ext_report_req req;
struct snp_report_resp resp;
struct snp_guest_request_ioctl guest_req;
struct guest_request_ioctl guest_req;
struct msg_report_resp *report_resp = (struct msg_report_resp *)&resp.data;
struct cert_table certs_data;
size_t page_size = 0, nr_pages = 0;
Expand Down