Commit 3376ca3
KVM: x86: Fix KVM_GET_MSRS stack info leak
Commit 6abe9c1 ("KVM: X86: Move ignore_msrs handling upper the
stack") changed the 'ignore_msrs' handling, including sanitizing return
values to the caller. This was fine until commit 12bc213 ("KVM:
X86: Do the same ignore_msrs check for feature msrs") which allowed
non-existing feature MSRs to be ignored, i.e. to not generate an error
on the ioctl() level. It even tried to preserve the sanitization of the
return value. However, the logic is flawed, as '*data' will be
overwritten again with the uninitialized stack value of msr.data.
Fix this by simplifying the logic and always initializing msr.data,
vanishing the need for an additional error exit path.
Fixes: 12bc213 ("KVM: X86: Do the same ignore_msrs check for feature msrs")
Signed-off-by: Mathias Krause <[email protected]>
Reviewed-by: Xiaoyao Li <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Sean Christopherson <[email protected]>1 parent 05519c8 commit 3376ca3
1 file changed
+5
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1704 | 1704 | | |
1705 | 1705 | | |
1706 | 1706 | | |
| 1707 | + | |
| 1708 | + | |
1707 | 1709 | | |
1708 | 1710 | | |
1709 | 1711 | | |
1710 | | - | |
1711 | | - | |
1712 | | - | |
1713 | | - | |
1714 | | - | |
1715 | | - | |
1716 | | - | |
1717 | | - | |
1718 | | - | |
| 1712 | + | |
| 1713 | + | |
1719 | 1714 | | |
1720 | 1715 | | |
1721 | 1716 | | |
1722 | | - | |
| 1717 | + | |
1723 | 1718 | | |
1724 | 1719 | | |
1725 | 1720 | | |
| |||
0 commit comments