134 Commits

Author SHA1 Message Date
Huawei Technologies Co., Ltd
f69b207970 target/arm: Enable ARMv8.2-ATS1E1 in -cpu max
This includes enablement of ARMv8.1-PAN.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200208125816.14954-17-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry-picked from commit e0fe7309a7c21ef2386de50d37c86aea0d671c08)
Signed-off-by: Peng Liang <liangpeng10@huawei.com>
2020-11-02 21:28:15 +08:00
Huawei Technologies Co., Ltd
ade77d7741 target/arm: Move DBGDIDR into ARMISARegisters
We're going to want to read the DBGDIDR register from KVM in
a subsequent commit, which means it needs to be in the
ARMISARegisters sub-struct. Move it.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200214175116.9164-12-peter.maydell@linaro.org
(cherry-picked from commit 4426d3617d64922d97b74ed22e67e33b6fb7de0a)
Signed-off-by: Peng Liang <liangpeng10@huawei.com>
2020-11-02 21:28:15 +08:00
Huawei Technologies Co., Ltd
659f2bd0b4 target/arm: Stop assuming DBGDIDR always exists
The AArch32 DBGDIDR defines properties like the number of
breakpoints, watchpoints and context-matching comparators.  On an
AArch64 CPU, the register may not even exist if AArch32 is not
supported at EL1.

Currently we hard-code use of DBGDIDR to identify the number of
breakpoints etc; this works for all our TCG CPUs, but will break if
we ever add an AArch64-only CPU.  We also have an assert() that the
AArch32 and AArch64 registers match, which currently works only by
luck for KVM because we don't populate either of these ID registers
from the KVM vCPU and so they are both zero.

Clean this up so we have functions for finding the number
of breakpoints, watchpoints and context comparators which look
in the appropriate ID register.

This allows us to drop the "check that AArch64 and AArch32 agree
on the number of breakpoints etc" asserts:
 * we no longer look at the AArch32 versions unless that's the
   right place to be looking
 * it's valid to have a CPU (eg AArch64-only) where they don't match
 * we shouldn't have been asserting the validity of ID registers
   in a codepath used with KVM anyway

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200214175116.9164-11-peter.maydell@linaro.org
(cherry-picked from commit 88ce6c6ee85d902f59dc65afc3ca86b34f02b9ed)
Signed-off-by: Peng Liang <liangpeng10@huawei.com>
2020-11-02 21:28:14 +08:00
Huawei Technologies Co., Ltd
37878d12c4 target/arm: Add _aa64_ and _any_ versions of pmu_8_1 isar checks
Add the 64-bit version of the "is this a v8.1 PMUv3?"
ID register check function, and the _any_ version that
checks for either AArch32 or AArch64 support. We'll use
this in a later commit.

We don't (yet) do any isar_feature checks on ID_AA64DFR1_EL1,
but we move id_aa64dfr1 into the ARMISARegisters struct with
id_aa64dfr0, for consistency.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20200214175116.9164-10-peter.maydell@linaro.org
(cherry-picked from commit 2a609df87d9b886fd38a190a754dbc241ff707e8)
Signed-off-by: Peng Liang <liangpeng10@huawei.com>
2020-11-02 21:28:14 +08:00
Huawei Technologies Co., Ltd
4f98db7187 target/arm: Define an aa32_pmu_8_1 isar feature test function
Instead of open-coding a check on the ID_DFR0 PerfMon ID register
field, create a standardly-named isar_feature for "does AArch32 have
a v8.1 PMUv3" and use it.

This entails moving the id_dfr0 field into the ARMISARegisters struct.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20200214175116.9164-9-peter.maydell@linaro.org
(cherry-picked from commit a617953855b65a602d36364b9643f7e5bc31288e)
Signed-off-by: Peng Liang <liangpeng10@huawei.com>
2020-11-02 21:28:14 +08:00
Huawei Technologies Co., Ltd
3333d474e1 target/arm: Use FIELD macros for clearing ID_DFR0 PERFMON field
We already define FIELD macros for ID_DFR0, so use them in the
one place where we're doing direct bit value manipulation.

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20200214175116.9164-8-peter.maydell@linaro.org
(cherry-picked from commit d52c061e541982a3663ad5c65bd3b518dbe85b87)
Signed-off-by: Peng Liang <liangpeng10@huawei.com>
2020-11-02 21:28:14 +08:00
Huawei Technologies Co., Ltd
0aa9d98ac5 target/arm: Add and use FIELD definitions for ID_AA64DFR0_EL1
Add FIELD() definitions for the ID_AA64DFR0_EL1 and use them
where we currently have hard-coded bit values.

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20200214175116.9164-7-peter.maydell@linaro.org
(cherry-picked from commit ceb2744b47a1ef4184dca56a158eb3156b6eba36)
Signed-off-by: Peng Liang <liangpeng10@huawei.com>
2020-11-02 21:28:14 +08:00
Huawei Technologies Co., Ltd
b963c46486 target/arm: Add ID_AA64MMFR2_EL1
Add definitions for all of the fields, up to ARMv8.5.
Convert the existing RESERVED register to a full register.
Query KVM for the value of the register for the host.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200208125816.14954-18-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry-picked from commit 64761e10af2742a916c08271828890274137b9e8)
Signed-off-by: Peng Liang <liangpeng10@huawei.com>
2020-11-02 21:28:14 +08:00
Huawei Technologies Co., Ltd
84b0f39ed6 target/arm: Add isar_feature tests for PAN + ATS1E1
Include definitions for all of the bits in ID_MMFR3.
We already have a definition for ID_AA64MMFR1.PAN.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200208125816.14954-4-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry-picked from commit 3d6ad6bb466f487bcc861f99e2c9054230df1076)
Signed-off-by: Peng Liang <liangpeng10@huawei.com>
2020-11-02 21:28:14 +08:00
openeuler-ci-bot
75b8d121cd !137 Automatically generate code patches with openeuler
From: @zhendongchen
Reviewed-by: @yorifang
Signed-off-by: @yorifang
2020-10-22 16:33:53 +08:00
Euler Robot
b73cb9d02e spec: Update release version with !26
increase release verison by one

Signed-off-by: Euler Robot <euler.robot@huawei.com>
2020-10-22 16:29:45 +08:00
Euler Robot
0c27d06fc9 spec: Update patch and changelog with !26
pci: check bus pointer before dereference
hw/ide: check null block before _cancel_dma_sync

Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
2020-10-22 16:29:38 +08:00
Prasad J Pandit
ac10c577b6 hw/ide: check null block before _cancel_dma_sync
fix CVE-2020-25743

patch link: https://lists.nongnu.org/archive/html/qemu-devel/2020-09/msg05967.html

When canceling an i/o operation via ide_cancel_dam_sync(),
a block pointer may be null. Add check to avoid null pointer
dereference.

 -> https://ruhr-uni-bochum.sciebo.de/s/NNWP2GfwzYKeKwE?path=%2Fide_nullptr1
 ==1803100==Hint: address points to the zero page.
 #0 blk_bs ../block/block-backend.c:714
 #1 blk_drain ../block/block-backend.c:1715
 #2 ide_cancel_dma_sync ../hw/ide/core.c:723
 #3 bmdma_cmd_writeb ../hw/ide/core.c:723
 #4 bmdma_write ../hw/ide/pci.c:298
 #5 memory_region_write_accessor ../softmmu/memory.c:483
 #6 access_with_adjusted_size ../softmmu/memory.c:544
 #7 memory_region_dispatch_write ../softmmu/memory.c:1465
 #8 flatview_write_continue ../exe.c:3176
 ...

Reported-by: Ruhr-University <bugs-syssec@rub.de>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
2020-10-22 16:29:38 +08:00
Prasad J Pandit
10dbd7f711 pci: check bus pointer before dereference
fix CVE-2020-25742

patch link: https://lists.nongnu.org/archive/html/qemu-devel/2020-09/msg05294.html

While mapping IRQ level in pci_change_irq_level() routine,
it does not check if pci_get_bus() returned a valid pointer.
It may lead to a NULL pointer dereference issue. Add check to
avoid it.

  -> https://ruhr-uni-bochum.sciebo.de/s/NNWP2GfwzYKeKwE?path=%2Flsi_nullptr1
     ==1183858==Hint: address points to the zero page.
     #0 pci_change_irq_level hw/pci/pci.c:259
     #1 pci_irq_handler hw/pci/pci.c:1445
     #2 pci_set_irq hw/pci/pci.c:1463
     #3 lsi_set_irq hw/scsi/lsi53c895a.c:488
     #4 lsi_update_irq hw/scsi/lsi53c895a.c:523
     #5 lsi_script_scsi_interrupt hw/scsi/lsi53c895a.c:554
     #6 lsi_execute_script hw/scsi/lsi53c895a.c:1149
     #7 lsi_reg_writeb hw/scsi/lsi53c895a.c:1984
     #8 lsi_io_write hw/scsi/lsi53c895a.c:2146
     ...

Reported-by: Ruhr-University <bugs-syssec@rub.de>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
2020-10-22 16:29:38 +08:00
openeuler-ci-bot
eabdfdd7c7 !134 qemu: backport patches from openEuler-20.03-LTS
From: @zhendongchen
Reviewed-by: @yorifang
Signed-off-by: @yorifang
2020-10-10 17:14:11 +08:00
Euler Robot
66e514cb45 spec: Update release version with !14
increase release verison by one

Signed-off-by: Euler Robot <euler.robot@huawei.com>
2020-10-10 15:46:31 +08:00
Euler Robot
632df052b8 spec: Update patch and changelog with !14
hw/net/xgmac: Fix buffer overflow in xgmac_enet_send()
hw/net/net_tx_pkt: fix assertion failure in net_tx_pkt_add_raw_fragment()
sm501: Convert printf + abort to qemu_log_mask
sm501: Shorten long variable names in sm501_2d_operation
sm501: Use BIT(x) macro to shorten constant
sm501: Clean up local variables in sm501_2d_operation
sm501: Replace hand written implementation with pixman where possible

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Mauro Matteo Cascella <mcascell@redhat.com>
2020-10-10 15:46:22 +08:00
BALATON Zoltan
7215180b05 sm501: Replace hand written implementation with pixman where possible
Besides being faster this should also prevent malicious guests to
abuse 2D engine to overwrite data or cause a crash.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Message-id: 58666389b6cae256e4e972a32c05cf8aa51bffc0.1590089984.git.balaton@eik.bme.hu
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2020-10-10 15:46:07 +08:00
BALATON Zoltan
766ddaa416 sm501: Clean up local variables in sm501_2d_operation
Make variables local to the block they are used in to make it clearer
which operation they are needed for.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: ae59f8138afe7f6a5a4a82539d0f61496a906b06.1590089984.git.balaton@eik.bme.hu
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2020-10-10 15:45:52 +08:00
BALATON Zoltan
277037225c sm501: Use BIT(x) macro to shorten constant
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 124bf5de8d7cf503b32b377d0445029a76bfbd49.1590089984.git.balaton@eik.bme.hu
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2020-10-10 15:44:05 +08:00
BALATON Zoltan
ef912f6629 sm501: Shorten long variable names in sm501_2d_operation
This increases readability and cleans up some confusing naming.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Message-id: b9b67b94c46e945252a73c77dfd117132c63c4fb.1590089984.git.balaton@eik.bme.hu
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2020-10-10 15:43:49 +08:00
BALATON Zoltan
50dcc20a59 sm501: Convert printf + abort to qemu_log_mask
Some places already use qemu_log_mask() to log unimplemented features
or errors but some others have printf() then abort(). Convert these to
qemu_log_mask() and avoid aborting to prevent guests to easily cause
denial of service.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 305af87f59d81e92f2aaff09eb8a3603b8baa322.1590089984.git.balaton@eik.bme.hu
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2020-10-10 15:43:32 +08:00
Mauro Matteo Cascella
c30f07cade hw/net/net_tx_pkt: fix assertion failure in net_tx_pkt_add_raw_fragment()
An assertion failure issue was found in the code that processes network packets
while adding data fragments into the packet context. It could be abused by a
malicious guest to abort the QEMU process on the host. This patch replaces the
affected assert() with a conditional statement, returning false if the current
data fragment exceeds max_raw_frags.

Reported-by: Alexander Bulekov <alxndr@bu.edu>
Reported-by: Ziming Zhang <ezrakiez@gmail.com>
Reviewed-by: Dmitry Fleytman <dmitry.fleytman@gmail.com>
Signed-off-by: Mauro Matteo Cascella <mcascell@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
2020-10-10 15:43:18 +08:00
Mauro Matteo Cascella
2a884f8abb hw/net/xgmac: Fix buffer overflow in xgmac_enet_send()
A buffer overflow issue was reported by Mr. Ziming Zhang, CC'd here. It
occurs while sending an Ethernet frame due to missing break statements
and improper checking of the buffer size.

Reported-by: Ziming Zhang <ezrakiez@gmail.com>
Signed-off-by: Mauro Matteo Cascella <mcascell@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Jason Wang <jasowang@redhat.com>
2020-10-10 15:43:01 +08:00
AlexChen
06f886beec qemu: rename some patches for slirp
Signed-off-by: AlexChen <alex.chen@huawei.com>
2020-10-10 15:42:27 +08:00
AlexChen
a7b090aaca qemu: enrich commit info for some patchs
Signed-off-by: AlexChen <alex.chen@huawei.com>
2020-10-10 15:41:56 +08:00
Jiajie Li
74e366ee0f Fix CVE-2020-25085 & CVE-2020-25084
Signed-off-by Jiajie Li <lijiajie11@huawei.com>
2020-10-10 15:41:09 +08:00
Jiajie Li
3b04b46775 Drop bogus IPv6 messages
Drop IPv6 message shorter than what's mentioned in the payload
  length header (+ the size of the IPv6 header). They're invalid and could
  lead to data leakage in icmp6_send_echoreply().
2020-10-10 15:40:02 +08:00
openeuler-ci-bot
cce9e18917 !88 fix hw/usb/core.c fix buffer overflow in do_token_setup
Merge pull request !88 from lijiajie128/openEuler-20.03-LTS
2020-08-27 21:06:22 +08:00
lijiajie
514ab9213b update qemu.spec with hw-usb-core-fix-overflow.patch 2020-08-27 20:43:36 +08:00
lijiajie
22b067020e hw/usb/core.c fix buffer overflow in do_token_setup() function
Store calculated setup_len in a local variable, verify it, and only
write it to the struct(USBDevice->setup_len)in case it passed the
sanity checks.

This prevent other code (do_token_{in,out}function specifically)
from working with invalid USBDevice->setup_len values and overruning
the USBDevice->setup_buf[] buffer.

Fixes: CVE-2020-14364
2020-08-27 20:34:42 +08:00
openeuler-ci-bot
e6824283ca !74 hw/arm/acpi: enable SHPC native hot plug
Merge pull request !74 from 金泽宇/openEuler-20.03-LTS
2020-08-13 09:54:08 +08:00
Zeyu Jin
2bfc4806b3 hw/arm/acpi: enable SHPC native hot plug
backport from upstream:
https://git.qemu.org/?p=qemu.git;a=commit;h=e04c13cdcf5befd9d08df38d4d34494a802cdf63

Signed-off-by: Zeyu Jin <jinzeyu@huawei.com>
2020-08-12 14:14:30 +08:00
openeuler-ci-bot
00d4a81e22 !69 LTS分支增加qemu.spec rdb支持
Merge pull request !69 from 金泽宇/openEuler-20.03-LTS
2020-08-12 09:31:40 +08:00
Zeyu Jin
b7af38f23a spec: increase build-requirement of rbd-devel
Rbd support is default in qemu configure, so we should also add rbd support in qemu.spec .

Signed-off-by: jinzeyu <jinzeyu@huawei.com>
2020-08-11 20:47:23 +08:00
openeuler-ci-bot
c80e7e61dc !61 Enable werror for qemu and fix a building warning
Merge pull request !61 from FangYing/openEuler-20.03-LTS
2020-08-04 17:38:23 +08:00
Ying Fang
b2456150ba spec: enable Werror by default
enable Werror by default so that we can check compilation warnnings

Signed-off-by: Ying Fang <fangying1@huawei.com>
2020-08-04 15:30:36 +08:00
Ying Fang
8583518dca migration: add missing ram.h for migration/socket.c
ram.h is missing for migration/socket.c, let's add it.
Later we will enable werror for qemu.spec

Signed-off-by: Ying Fang <fangying1@huawei.com>
2020-08-04 15:12:22 +08:00
openeuler-ci-bot
7e5fd29f2c !59 [bugfix] pick several patches from upstream that fix CVE
Merge pull request !59 from zhanghailiang/openEuler-20.03-LTS
2020-07-29 17:05:08 +08:00
zhanghailiang
82b842349a qemu: pick serveral patches from upstream that fix CVE
Fix CVE-2020-13361, CVE-2020-13659, CVE-2020-13800, CVE-2020-13362

Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
2020-07-25 13:25:59 +08:00
openeuler-ci-bot
f55df4e982 !56 [bugfix] fix two patches format and one CVE bug
Merge pull request !56 from zhanghailiang/openEuler-20.03-LTS
2020-06-20 17:12:02 +08:00
zhanghailiang
a8e410c7ce spec: increase release number
Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
2020-06-20 15:42:02 +08:00
zhanghailiang
7a630f65f1 target/arm: Fix PAuth sbox functions
Fix CVE-2020-10702 bug

Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
2020-06-20 15:41:47 +08:00
zhanghailiang
aa9682be92 patch: fix patch format problem which can lead git am failed
Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
2020-06-20 15:41:33 +08:00
openeuler-ci-bot
65a86d3003 !52 Add kvm_adjvtimer vcpu property for Cortex-A72
Merge pull request !52 from FangYing/openEuler-20.03-LTS
2020-05-29 14:08:03 +08:00
Ying Fang
dcba4d91a4 spec: Update release version
increase release version by one

Signed-off-by: Ying Fang <fangying1@huawei.com>
2020-05-29 11:16:19 +08:00
Ying Fang
12087330c1 target/arm: Add the kvm_adjvtime vcpu property for Cortex-A72
Add the kvm_adjvtime vcpu property for ARM Cortex-A72 cpu model,
so that virtual time adjust will be enabled for it.

Signed-off-by: Ying Fang <fangying1@huawei.com>
2020-05-29 11:15:45 +08:00
Ying Fang
cdc4c75a8b Revert "target/arm: add ths missing GENERIC_TIMER"
This reverts commit 665d6b61fd86629272885e281410f512f8e7f32e.
2020-05-29 11:09:01 +08:00
XuYandong
ae7185c91d !51 [bugfix] add missing GENERIC_TIMER for cpu64
Merge pull request !51 from zhanghailiang/openEuler-20.03-LTS
2020-05-28 21:10:40 +08:00
zhanghailiang
665d6b61fd target/arm: add ths missing GENERIC_TIMER
Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
2020-05-28 20:19:41 +08:00