From: Mirsad Todorovac <mtodorovac69@gmail.com>
To: Sean Christopherson <seanjc@google.com>
Cc: kvm@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
linux-kernel@vger.kernel.org,
Boris Ostrovsky <boris.ostrovsky@oracle.com>
Subject: Re: [BUG] 6.10 stable: arch/x86/kvm/xen.c:1486:44: error: use of uninitialized value ‘port’ [CWE-457]
Date: Fri, 19 Jul 2024 21:53:45 +0200 [thread overview]
Message-ID: <34df3c7d-9f39-4878-80a9-72f5d2d858db@gmail.com> (raw)
In-Reply-To: <ZpqiyxAuobYjkjC-@google.com>
On 7/19/24 19:30, Sean Christopherson wrote:
> On Fri, Jul 19, 2024, Mirsad Todorovac wrote:
>> Hi, all,
>>
>> While building stable tree version of 6.10, the following error occurred:
>>
>> In line 1421 defines:
>>
>> 1421 evtchn_port_t port, *ports;
>>
>> The ports becomes &port in line 1470, but neither port nor *ports is assigned a value
>> until line 1486 where port is used:
>>
>> 1485 if (sched_poll.nr_ports == 1)
>> 1486 → vcpu->arch.xen.poll_evtchn = port;
>>
>> The visual inspection proves that the compiler is again right (GCC 12.3.0).
>
> Nope, the compiler is wrong. If sched_poll.nr_ports > 0, then kvm_read_guest_virt()
> will fill ports[sched_poll.nr_ports]. If kvm_read_guest_virt() fails to do so,
> it will return an error and the above code will never be reached.
>
> if (kvm_read_guest_virt(vcpu, (gva_t)sched_poll.ports, ports,
> sched_poll.nr_ports * sizeof(*ports), &e)) {
> *r = -EFAULT;
> return true;
> }
Hi again,
I see what you mean.
Apparently, this dependency is not visible by the compiler, and this makes static analysers of
dubious value ...
I might need some advice on how to contribute to the Q/A of the kernel proper and testing suite
...
Best regards,
Mirsad Todorovac
prev parent reply other threads:[~2024-07-19 19:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-19 17:23 Mirsad Todorovac
2024-07-19 17:30 ` Sean Christopherson
2024-07-19 19:53 ` Mirsad Todorovac [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=34df3c7d-9f39-4878-80a9-72f5d2d858db@gmail.com \
--to=mtodorovac69@gmail.com \
--cc=boris.ostrovsky@oracle.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®