All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] i386: avoid null pointer dereference
@ 2015-12-18  6:05 P J P
  2016-01-04 15:49 ` P J P
  0 siblings, 1 reply; 4+ messages in thread
From: P J P @ 2015-12-18  6:05 UTC (permalink / raw)
  To: qemu-devel; +Cc: Ling Liu

    Hello,

A null pointer dereference issue was reported by Mr Ling Liu, CC'd here. It 
occurs while doing I/O port write operations via hmp interface. In that, 
'current_cpu' remains null as it is not called from cpu_exec loop, which 
results in the said issue.

Below is a proposed (tested)patch to fix this issue; Does it look okay?

===
>From ae88a4947fab9a148cd794f8ad2d812e7f5a1d0f Mon Sep 17 00:00:00 2001
From: Prasad J Pandit <pjp@fedoraproject.org>
Date: Fri, 18 Dec 2015 11:16:07 +0530
Subject: [PATCH] i386: avoid null pointer dereference

When I/O port write operation is called from hmp interface,
'current_cpu' remains null, as it is not called from cpu_exec()
loop. This leads to a null pointer dereference in vapic_write
routine. Add check to avoid it.

Reported-by: Ling Liu <liuling-it@360.cn>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
---
  hw/i386/kvmvapic.c | 4 ++++
  1 file changed, 4 insertions(+)

diff --git a/hw/i386/kvmvapic.c b/hw/i386/kvmvapic.c
index c6d34b2..18157c7 100644
--- a/hw/i386/kvmvapic.c
+++ b/hw/i386/kvmvapic.c
@@ -634,6 +634,10 @@ static int vapic_prepare(VAPICROMState *s)
  static void vapic_write(void *opaque, hwaddr addr, uint64_t data,
                          unsigned int size)
  {
+    if (!current_cpu) {
+        return;
+    }
+
      CPUState *cs = current_cpu;
      X86CPU *cpu = X86_CPU(cs);
      CPUX86State *env = &cpu->env;
-- 
2.4.3
===


Thank you.
--
Prasad J Pandit / Red Hat Product Security Team
47AF CE69 3A90 54AA 9045 1053 DD13 3D32 FE5B 041F

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] i386: avoid null pointer dereference
  2015-12-18  6:05 [Qemu-devel] [PATCH] i386: avoid null pointer dereference P J P
@ 2016-01-04 15:49 ` P J P
  2016-01-07 12:38   ` Paolo Bonzini
  0 siblings, 1 reply; 4+ messages in thread
From: P J P @ 2016-01-04 15:49 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel, Ling Liu

+-- On Fri, 18 Dec 2015, P J P wrote --+
| A null pointer dereference issue was reported by Mr Ling Liu, CC'd here. It
| occurs while doing I/O port write operations via hmp interface. In that,
| 'current_cpu' remains null as it is not called from cpu_exec loop, which
| results in the said issue.

Ping..! -> https://patchwork.ozlabs.org/patch/558748/
--
Prasad J Pandit / Red Hat Product Security Team
47AF CE69 3A90 54AA 9045 1053 DD13 3D32 FE5B 041F

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] i386: avoid null pointer dereference
  2016-01-04 15:49 ` P J P
@ 2016-01-07 12:38   ` Paolo Bonzini
  2016-01-07 13:30     ` P J P
  0 siblings, 1 reply; 4+ messages in thread
From: Paolo Bonzini @ 2016-01-07 12:38 UTC (permalink / raw)
  To: P J P; +Cc: qemu-devel, Ling Liu



On 04/01/2016 16:49, P J P wrote:
> +-- On Fri, 18 Dec 2015, P J P wrote --+
> | A null pointer dereference issue was reported by Mr Ling Liu, CC'd here. It
> | occurs while doing I/O port write operations via hmp interface. In that,
> | 'current_cpu' remains null as it is not called from cpu_exec loop, which
> | results in the said issue.
> 
> Ping..! -> https://patchwork.ozlabs.org/patch/558748/

I was on vacation until today.  I'll send a pull request some time next
week.

Paolo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] i386: avoid null pointer dereference
  2016-01-07 12:38   ` Paolo Bonzini
@ 2016-01-07 13:30     ` P J P
  0 siblings, 0 replies; 4+ messages in thread
From: P J P @ 2016-01-07 13:30 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel, Ling Liu

+-- On Thu, 7 Jan 2016, Paolo Bonzini wrote --+
| On 04/01/2016 16:49, P J P wrote:
| > Ping..! -> https://patchwork.ozlabs.org/patch/558748/
| 
| I was on vacation until today.  I'll send a pull request some time next
| week.

Sure okay, thank you.
--
Prasad J Pandit / Red Hat Product Security Team
47AF CE69 3A90 54AA 9045 1053 DD13 3D32 FE5B 041F

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-01-07 13:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-18  6:05 [Qemu-devel] [PATCH] i386: avoid null pointer dereference P J P
2016-01-04 15:49 ` P J P
2016-01-07 12:38   ` Paolo Bonzini
2016-01-07 13:30     ` P J P

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.