Message ID | 20220323170219.710199-1-davide.gardenal@huawei.com |
---|---|
State | Accepted, archived |
Commit | 6d4e6302fa21b1c663b94b05088ecf9b9d544c0a |
Headers | show |
Series | [dunfell] qemu: backport patch fix for CVE-2020-13791 | expand |
On Wed, Mar 23, 2022 at 7:02 AM Davide Gardenal <davidegarde2000@gmail.com> wrote: > > Upstream patch: > https://lists.gnu.org/archive/html/qemu-devel/2020-06/msg00979.html > > CVE: CVE-2020-13791 > > Signed-off-by: Davide Gardenal <davide.gardenal@huawei.com> > --- > meta/recipes-devtools/qemu/qemu.inc | 1 + > .../qemu/qemu/CVE-2020-13791.patch | 40 +++++++++++++++++++ > 2 files changed, 41 insertions(+) > create mode 100644 meta/recipes-devtools/qemu/qemu/CVE-2020-13791.patch > > diff --git a/meta/recipes-devtools/qemu/qemu.inc b/meta/recipes-devtools/qemu/qemu.inc > index ef9bc3f64a..01cda49eee 100644 > --- a/meta/recipes-devtools/qemu/qemu.inc > +++ b/meta/recipes-devtools/qemu/qemu.inc > @@ -92,6 +92,7 @@ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \ > file://CVE-2020-27617.patch \ > file://CVE-2020-28916.patch \ > file://CVE-2021-3682.patch \ > + file://CVE-2020-13791.patch \ > " Note that there is another CVE fix currently on the list for review (CVE-2020-13253) so you'll need to rebase with that patch included and send a v2 since that patch will be merged before yours. > UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar" > > diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2020-13791.patch b/meta/recipes-devtools/qemu/qemu/CVE-2020-13791.patch > new file mode 100644 > index 0000000000..6026f02e54 > --- /dev/null > +++ b/meta/recipes-devtools/qemu/qemu/CVE-2020-13791.patch > @@ -0,0 +1,40 @@ > +Date: Thu, 4 Jun 2020 16:25:24 +0530 > +From: Prasad J Pandit <pjp@fedoraproject.org> > +Subject: [PATCH v3] ati-vga: check address before reading configuration bytes (CVE-2020-13791) > + > +While reading PCI configuration bytes, a guest may send an > +address towards the end of the configuration space. It may lead > +to an OOB access issue. Add check to ensure 'address + size' is > +within PCI configuration space. > + > +CVE: CVE-2020-13791 Also needs the Upstream-status tag and your Signed-off-by Thanks for helping with CVE's! Steve > + > +Reported-by: Ren Ding <rding@gatech.edu> > +Reported-by: Hanqing Zhao <hanqing@gatech.edu> > +Reported-by: Yi Ren <c4tren@gmail.com> > +Suggested-by: BALATON Zoltan <balaton@eik.bme.hu> > +Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org> > +--- > + hw/display/ati.c | 4 +++- > + 1 file changed, 3 insertions(+), 1 deletion(-) > + > +Update v3: avoid modifying 'addr' variable > + -> https://lists.gnu.org/archive/html/qemu-devel/2020-06/msg00834.html > + > +diff --git a/hw/display/ati.c b/hw/display/ati.c > +index 67604e68de..b4d0fd88b7 100644 > +--- a/hw/display/ati.c > ++++ b/hw/display/ati.c > +@@ -387,7 +387,9 @@ static uint64_t ati_mm_read(void *opaque, hwaddr addr, unsigned int size) > + val = s->regs.crtc_pitch; > + break; > + case 0xf00 ... 0xfff: > +- val = pci_default_read_config(&s->dev, addr - 0xf00, size); > ++ if ((addr - 0xf00) + size <= pci_config_size(&s->dev)) { > ++ val = pci_default_read_config(&s->dev, addr - 0xf00, size); > ++ } > + break; > + case CUR_OFFSET: > + val = s->regs.cur_offset; > +-- > +2.26.2 > -- > 2.32.0 > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#163591): https://lists.openembedded.org/g/openembedded-core/message/163591 > Mute This Topic: https://lists.openembedded.org/mt/89980626/3620601 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [steve@sakoman.com] > -=-=-=-=-=-=-=-=-=-=-=- >
diff --git a/meta/recipes-devtools/qemu/qemu.inc b/meta/recipes-devtools/qemu/qemu.inc index ef9bc3f64a..01cda49eee 100644 --- a/meta/recipes-devtools/qemu/qemu.inc +++ b/meta/recipes-devtools/qemu/qemu.inc @@ -92,6 +92,7 @@ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \ file://CVE-2020-27617.patch \ file://CVE-2020-28916.patch \ file://CVE-2021-3682.patch \ + file://CVE-2020-13791.patch \ " UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar" diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2020-13791.patch b/meta/recipes-devtools/qemu/qemu/CVE-2020-13791.patch new file mode 100644 index 0000000000..6026f02e54 --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/CVE-2020-13791.patch @@ -0,0 +1,40 @@ +Date: Thu, 4 Jun 2020 16:25:24 +0530 +From: Prasad J Pandit <pjp@fedoraproject.org> +Subject: [PATCH v3] ati-vga: check address before reading configuration bytes (CVE-2020-13791) + +While reading PCI configuration bytes, a guest may send an +address towards the end of the configuration space. It may lead +to an OOB access issue. Add check to ensure 'address + size' is +within PCI configuration space. + +CVE: CVE-2020-13791 + +Reported-by: Ren Ding <rding@gatech.edu> +Reported-by: Hanqing Zhao <hanqing@gatech.edu> +Reported-by: Yi Ren <c4tren@gmail.com> +Suggested-by: BALATON Zoltan <balaton@eik.bme.hu> +Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org> +--- + hw/display/ati.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +Update v3: avoid modifying 'addr' variable + -> https://lists.gnu.org/archive/html/qemu-devel/2020-06/msg00834.html + +diff --git a/hw/display/ati.c b/hw/display/ati.c +index 67604e68de..b4d0fd88b7 100644 +--- a/hw/display/ati.c ++++ b/hw/display/ati.c +@@ -387,7 +387,9 @@ static uint64_t ati_mm_read(void *opaque, hwaddr addr, unsigned int size) + val = s->regs.crtc_pitch; + break; + case 0xf00 ... 0xfff: +- val = pci_default_read_config(&s->dev, addr - 0xf00, size); ++ if ((addr - 0xf00) + size <= pci_config_size(&s->dev)) { ++ val = pci_default_read_config(&s->dev, addr - 0xf00, size); ++ } + break; + case CUR_OFFSET: + val = s->regs.cur_offset; +-- +2.26.2
Upstream patch: https://lists.gnu.org/archive/html/qemu-devel/2020-06/msg00979.html CVE: CVE-2020-13791 Signed-off-by: Davide Gardenal <davide.gardenal@huawei.com> --- meta/recipes-devtools/qemu/qemu.inc | 1 + .../qemu/qemu/CVE-2020-13791.patch | 40 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 meta/recipes-devtools/qemu/qemu/CVE-2020-13791.patch