[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4e25df0e-000c-4af7-a34f-ba831623aab8@xen.org>
Date: Fri, 28 Jun 2024 15:25:15 +0100
From: Paul Durrant <xadimgnik@...il.com>
To: Pei Li <peili.dev@...il.com>, David Woodhouse <dwmw2@...radead.org>,
Sean Christopherson <seanjc@...gle.com>, Paolo Bonzini
<pbonzini@...hat.com>, Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>, Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>, Bill Wendling
<morbo@...gle.com>, Justin Stitt <justinstitt@...gle.com>
Cc: kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
skhan@...uxfoundation.org, linux-kernel-mentees@...ts.linuxfoundation.org,
syzkaller-bugs@...glegroups.com, llvm@...ts.linux.dev,
syzbot+fd555292a1da3180fc82@...kaller.appspotmail.com
Subject: Re: [PATCH v2] kvm: Fix warning in__kvm_gpc_refresh
On 27/06/2024 16:03, Pei Li wrote:
> Check for invalid hva address stored in data and return -EINVAL before
> calling into __kvm_gpc_activate().
>
> Reported-by: syzbot+fd555292a1da3180fc82@...kaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=fd555292a1da3180fc82
> Tested-by: syzbot+fd555292a1da3180fc82@...kaller.appspotmail.com
> Signed-off-by: Pei Li <peili.dev@...il.com>
> ---
> Syzbot reports a warning message in __kvm_gpc_refresh(). This warning
> requires at least one of gpa and uhva to be valid.
> WARNING: CPU: 0 PID: 5090 at arch/x86/kvm/../../../virt/kvm/pfncache.c:259 __kvm_gpc_refresh+0xf17/0x1090 arch/x86/kvm/../../../virt/kvm/pfncache.c:259
>
> We are calling it from kvm_gpc_activate_hva(). This function always calls
> __kvm_gpc_activate() with INVALID_GPA. Thus, uhva must be valid to
> disable this warning.
>
> This patch checks for invalid hva address and return -EINVAL before
> calling __kvm_gpc_activate().
>
> syzbot has tested the proposed patch and the reproducer did not trigger
> any issue.
>
> Tested on:
>
> commit: afcd4813 Merge tag 'mm-hotfixes-stable-2024-06-26-17-2..
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=1427e301980000
> kernel config: https://syzkaller.appspot.com/x/.config?x=e40800950091403a
> dashboard link: https://syzkaller.appspot.com/bug?extid=fd555292a1da3180fc82
> compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
> patch: https://syzkaller.appspot.com/x/patch.diff?x=13838f3e980000
>
> Note: testing is done by a robot and is best-effort only.
> ---
> Changes in v2:
> - Adapted Sean's suggestion to check for valid address before calling
> into __kvm_gpc_activate().
> - Link to v1: https://lore.kernel.org/r/20240625-bug5-v1-1-e072ed5fce85@gmail.com
> ---
> arch/x86/kvm/xen.c | 2 +-
> virt/kvm/pfncache.c | 3 +++
> 2 files changed, 4 insertions(+), 1 deletion(-)
>
Reviewed-by: Paul Durrant <paul@....org>
Powered by blists - more mailing lists