Skip to content

Fix get msr index list for demo#80

Merged
chp-io merged 2 commits into
Bareflank:demofrom
enr0n:fix-get-msr-index-list-demo
Oct 22, 2021
Merged

Fix get msr index list for demo#80
chp-io merged 2 commits into
Bareflank:demofrom
enr0n:fix-get-msr-index-list-demo

Conversation

@enr0n
Copy link
Copy Markdown
Contributor

@enr0n enr0n commented Oct 22, 2021

No description provided.

Nick Rosbrook added 2 commits October 22, 2021 11:38
Instead of using a pointer for the indices entry in kvm_msr_list, use a
normal array and define the KVM_MSR_GET_INDEX_LIST ioctl using the
_IOWR_LIST macro (see "shim/linux: add _IOWR_LIST macro").

Define MSR_LIST_MAX_INDICES to be 128, as this leaves some room to keep
the stack frame < 1024 bytes. This may be too low of a max, but is
plenty for our current QEMU and integration testing.

Signed-off-by: Nick Rosbrook <rosbrookn@ainfosec.com>
The KVM API states that when the number of MSRs is greater than the
value set in nmsrs by the caller, the kernel will set the correct value
in nmsrs and return -E2BIG. This behavior was excluded from the first
implementation of KVM_GET_MSR_INDEX_LIST. Define SHIM_2BIG so that other
shim functions can implement this behavior, which is a common pattern in
ioctls.

Signed-off-by: Nick Rosbrook <rosbrookn@ainfosec.com>
@chp-io chp-io merged commit 46961f8 into Bareflank:demo Oct 22, 2021
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