Commit Graph

65092 Commits

Author SHA1 Message Date
Eric Blake 3e99ebb9d3 nbd/server: Ignore write errors when replying to NBD_OPT_ABORT
Commit 37ec36f6 intentionally ignores errors when trying to reply
to an NBD_OPT_ABORT request for plaintext clients, but did not make
the same change for a TLS server.  Since NBD_OPT_ABORT is
documented as being a potential for an EPIPE when the client hangs
up without waiting for our reply, we don't need to pollute the
server's output with that failure.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20181117223221.2198751-1-eblake@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2018-11-19 11:16:46 -06:00
Daniel P. Berrangé 0b0bb124bb nbd: fix whitespace in server error message
A space was missing after the option number was printed:

  Option 0x8not permitted before TLS

becomes

  Option 0x8 not permitted before TLS

This fixes

  commit 3668328303
  Author: Eric Blake <eblake@redhat.com>
  Date:   Fri Oct 14 13:33:09 2016 -0500

    nbd: Send message along with server NBD_REP_ERR errors

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20181116155325.22428-2-berrange@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
[eblake: move lone space to next line]
Signed-off-by: Eric Blake <eblake@redhat.com>
2018-11-19 10:08:19 -06:00
Mao Zhongyi 4a9e751f61 qemu-iotests: Modern shell scripting (use $() instead of ``)
Various shell files contain a mix between obsolete ``
and modern $(); It would be nice to convert to using
$() everywhere.  For now, just do the qemu-iotests directory.

Cc: kwolf@redhat.com
Cc: mreitz@redhat.com
Cc: eblake@redhat.com
Suggested-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
Message-Id: <20181024094051.4470-4-maozhongyi@cmss.chinamobile.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
[eblake: tweak commit message]
Signed-off-by: Eric Blake <eblake@redhat.com>
2018-11-19 10:08:19 -06:00
Mao Zhongyi e8d81a61e1 qemu-iotests: convert `pwd` and $(pwd) to $PWD
POSIX requires $PWD to be reliable, and we expect all
shells used by qemu scripts to be relatively close to
POSIX.  Thus, it is smarter to avoid forking the pwd
executable for something that is already available in
the environment.

So replace it with the following:

sed -i 's/\(`pwd`\|\$(pwd)\)/$PWD/g' $(git grep -l pwd)

Then delete a pointless line assigning PWD to itself.

Cc: kwolf@redhat.com
Cc: mreitz@redhat.com
Cc: eblake@redhat.com
Suggested-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
Message-Id: <20181024094051.4470-2-maozhongyi@cmss.chinamobile.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
[eblake: touch up commit message, reorder series, tweak a couple more files]
Signed-off-by: Eric Blake <eblake@redhat.com>
2018-11-19 10:08:19 -06:00
Mao Zhongyi bf22957309 qemu-iotests: remove unused variable 'here'
Running
git grep '\$here' tests/qemu-iotests

has 0 hits, which means we are setting a variable that has
no use.  It appears that commit e8f8624d removed the last
use.  So execute the following cmd to remove all of
the 'here=...' lines as dead code.

sed -i '/^here=/d' $(git grep -l '^here=' tests/qemu-iotests)

Cc: kwolf@redhat.com
Cc: mreitz@redhat.com
Cc: eblake@redhat.com
Suggested-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
Message-Id: <20181024094051.4470-3-maozhongyi@cmss.chinamobile.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
[eblake: touch up commit message, reorder series, rebase to master]
Signed-off-by: Eric Blake <eblake@redhat.com>
2018-11-19 10:08:19 -06:00
Peter Maydell e6ebbd46b6 Block layer patches:
- file-posix: Fix shared permission locks after reopen
 - block: Fix error path for failed .bdrv_reopen_prepare
 - qcow2: Catch invalid allocations when the image becomes too large
 - vvfat/fdc/nvme: Fix segfaults and leaks
 -----BEGIN PGP SIGNATURE-----
 
 iQIcBAABAgAGBQJb8siCAAoJEH8JsnLIjy/WQewQAMYEJqC7Q6djnUXcA7SxDCZs
 ECvL0AGK2Sc88AiaeqyvB9oArwcLJmTMgk3OW3qGRK22nG3Pydjym0+AtK1R5zGF
 xscn6N3Pz1wkGjJ0PFU3H7FpAPAh+4fULkYAyouZDxZROTRG/AVXXKdWosfDCNQX
 5Uh99MCD2xyTNBxyBkxl5MDh0KIaosKVuhYo0/YSE57yyhFnn5VUCunk6OR+5mD/
 aqVeZky59I5TrWOwWDpkf95Ej+Wajy9lMEEO+wjx6jiqlikfEONi319pXZx3pFfc
 Y82P96hapgj+mVv4+6LbelYTnIyVWGj90+I1gKeR1flTAWFl7DXahfGfLwCyuGd/
 4y24jaq/Z4wNFfaF+F29V+b85O7h3exOj+an6WeEMsCMoG6XeZbJn485PMeKNVMN
 iMPZ84smqFubhR5K0VCt//RhfFBHmgYd3SIBa1Jvrcax3mGHkNvJkBzbS5q4+elw
 KCa11L6F8ct2LeQI798bvZkDp88Na23peBQPTY3N/uc4RJgpLLs+Y13PcE6Dsu1P
 U82fN2Zn6Zd/sVWwduUJbZ3ur5m7UxgTmOuCTGzNzZMTuc+Sryuc3UlK/uitvT5l
 Su7eobC2QjsBatBZT2ohL9iXxf4lX2EPR5VYVhQdwLXfA1ygm5AUSsa7N2mUWfxH
 O8m9AJZWvNTmcovsW79s
 =XG6S
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging

Block layer patches:

- file-posix: Fix shared permission locks after reopen
- block: Fix error path for failed .bdrv_reopen_prepare
- qcow2: Catch invalid allocations when the image becomes too large
- vvfat/fdc/nvme: Fix segfaults and leaks

# gpg: Signature made Mon 19 Nov 2018 14:28:18 GMT
# gpg:                using RSA key 7F09B272C88F2FD6
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>"
# Primary key fingerprint: DC3D EB15 9A9A F95D 3D74  56FE 7F09 B272 C88F 2FD6

* remotes/kevin/tags/for-upstream:
  iotests: Test file-posix locking and reopen
  file-posix: Fix shared locks on reopen commit
  block: Always abort reopen after prepare succeeded
  iotests: Add new test 220 for max compressed cluster offset
  qcow2: Don't allow overflow during cluster allocation
  qcow2: Document some maximum size constraints
  vvfat: Fix memory leak
  fdc: fix segfault in fdctrl_stop_transfer() when DMA is disabled
  nvme: fix oob access issue(CVE-2018-16847)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-11-19 14:31:48 +00:00
Max Reitz 6d0a4a0fb5 iotests: Test file-posix locking and reopen
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2018-11-19 14:32:04 +01:00
Max Reitz 577a133988 file-posix: Fix shared locks on reopen commit
s->locked_shared_perm is the set of bits locked in the file, which is
the inverse of the permissions actually shared.  So we need to pass them
as they are to raw_apply_lock_bytes() instead of inverting them again.

Reported-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2018-11-19 14:32:01 +01:00
Max Reitz 9ad08c4456 block: Always abort reopen after prepare succeeded
bdrv_reopen_multiple() does not invoke bdrv_reopen_abort() for the
element of the reopen queue for which bdrv_reopen_prepare() failed,
because it assumes that the prepare function will have rolled back all
changes already.

However, bdrv_reopen_prepare() does not do this in every case: It may
notice an error after BlockDriver.bdrv_reopen_prepare() succeeded, and
it will not invoke BlockDriver.bdrv_reopen_abort() then; and neither
will bdrv_reopen_multiple(), as explained above.

This is wrong because we must always call .bdrv_reopen_commit() or
.bdrv_reopen_abort() after .bdrv_reopen_prepare() has succeeded.
Otherwise, the block driver has no chance to undo what it has done in
its implementation of .bdrv_reopen_prepare().

To fix this, bdrv_reopen_prepare() has to call .bdrv_reopen_abort() if
it wants to return an error after .bdrv_reopen_prepare() has succeeded.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2018-11-19 14:31:48 +01:00
Eric Blake 3b94c343f9 iotests: Add new test 220 for max compressed cluster offset
If you have a capable file system (tmpfs is good, ext4 not so much;
run ./check with TEST_DIR pointing to a good location so as not
to skip the test), it's actually possible to create a qcow2 file
that expands to a sparse 512T image with just over 38M of content.
The test is not the world's fastest (qemu crawling through 256M
bits of refcount table to find the next cluster to allocate takes
several seconds, as does qemu-img check reporting millions of
leaked clusters); but it DOES catch the problem that the previous
patch just fixed where writing a compressed cluster to a full
image ended up overwriting the wrong cluster.

Suggested-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2018-11-19 12:51:40 +01:00
Eric Blake 77d6a21558 qcow2: Don't allow overflow during cluster allocation
Our code was already checking that we did not attempt to
allocate more clusters than what would fit in an INT64 (the
physical maximimum if we can access a full off_t's worth of
data).  But this does not catch smaller limits enforced by
various spots in the qcow2 image description: L1 and normal
clusters of L2 are documented as having bits 63-56 reserved
for other purposes, capping our maximum offset at 64PB (bit
55 is the maximum bit set).  And for compressed images with
2M clusters, the cap drops the maximum offset to bit 48, or
a maximum offset of 512TB.  If we overflow that offset, we
would write compressed data into one place, but try to
decompress from another, which won't work.

It's actually possible to prove that overflow can cause image
corruption without this patch; I'll add the iotests separately
in the next commit.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2018-11-19 12:51:40 +01:00
Eric Blake d3e1a7eb4c qcow2: Document some maximum size constraints
Although off_t permits up to 63 bits (8EB) of file offsets, in
practice, we're going to hit other limits first.  Document some
of those limits in the qcow2 spec (some are inherent, others are
implementation choices of qemu), and how choice of cluster size
can influence some of the limits.

While we cannot map any uncompressed virtual cluster to any
address higher than 64 PB (56 bits) (due to the current L1/L2
field encoding stopping at bit 55), qemu's cap of 8M for the
refcount table can still access larger host addresses for some
combinations of large clusters and small refcount_order.  For
comparison, ext4 with 4k blocks caps files at 16PB.

Another interesting limit: for compressed clusters, the L2 layout
requires an ever-smaller maximum host offset as cluster size gets
larger, down to a 512 TB maximum with 2M clusters.  In particular,
note that with a cluster size of 8k or smaller, the L2 entry for
a compressed cluster could technically point beyond the 64PB mark,
but when you consider that with 8k clusters and refcount_order = 0,
you cannot access beyond 512T without exceeding qemu's limit of an
8M cap on the refcount table, it is unlikely that any image in the
wild has attempted to do so.  To be safe, let's document that bits
beyond 55 in a compressed cluster must be 0.

Signed-off-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2018-11-19 12:51:40 +01:00
Kevin Wolf 443ba6befa vvfat: Fix memory leak
Don't leak 'cluster' in the mapping == NULL case. Found by Coverity
(CID 1055918).

Fixes: 8d9401c279
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Liam Merwick <liam.merwick@oracle.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2018-11-19 12:51:40 +01:00
Mark Cave-Ayland 441f6692ec fdc: fix segfault in fdctrl_stop_transfer() when DMA is disabled
Commit c8a35f1cf0 "fdc: use IsaDma interface instead of global DMA_*
functions" accidentally introduced a segfault in fdctrl_stop_transfer() for
non-DMA transfers.

If fdctrl->dma_chann has not been configured then the fdctrl->dma interface
reference isn't initialised during isabus_fdc_realize(). Unfortunately
fdctrl_stop_transfer() unconditionally references the DMA interface when
finishing the transfer causing a NULL pointer dereference.

Fix the issue by adding a check in fdctrl_stop_transfer() so that the DMA
interface reference and release method is only invoked if fdctrl->dma_chann
has been set.

(This issue was discovered by Martin testing a recent change in the NetBSD
installer under qemu-system-sparc)

Cc: qemu-stable@nongnu.org
Reported-by: Martin Husemann <martin@duskware.de>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Hervé Poussineau <hpoussin@reactos.org>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2018-11-19 12:51:22 +01:00
Li Qiang 5e3c0220d7 nvme: fix oob access issue(CVE-2018-16847)
Currently, the nvme_cmb_ops mr doesn't check the addr and size.
This can lead an oob access issue. This is triggerable in the guest.
Add check to avoid this issue.

Fixes CVE-2018-16847.

Reported-by: Li Qiang <liq3ea@gmail.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Li Qiang <liq3ea@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2018-11-19 12:51:16 +01:00
Cornelia Huck 9436e082de MAINTAINERS: clarify some of the tags
The MAINTAINERS file is a bit sparse on information about what
the different designators are. Let's add some more information
to give contributors a better idea about what the different
roles are.

Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-id: 20181026105711.29605-1-cohuck@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-11-19 11:19:23 +00:00
Peter Maydell d1b3b1ee9d MIPS queue for QEMU 3.1-rc2 - v2
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJb8F5WAAoJENSXKoln91plAtoH/1aBwQbI8BhiKDxD1KZOSQMD
 Sefn15AuRECfM2Helfzr/3rHPhXa7OWCjI10Z7pNMxAy3wpAjPec6eeVzfRx0xDJ
 3vIkUuFQCzjHl5BloKdlsRPJC2/mTrwtvpLUF8g3D/pUpZoLyMF5f1mo4tVn9yz3
 TRRajkLIRaPJQ3aA/q4BJYYYebVD7treLi+HGMhvRYQmdcaVZAXvGsYnAHIHqU6u
 jNJm6w15SkoqR7u8/7rVrLLdR8jyB7XfBK7uih9O5kYcdkH5oa8QEE2khYtRfPw0
 g2MmYmGSnZKQzCWK0aGzNhnP5QPgjy733WmbnLKqnelKvYnV74B1ZCuoA1J6bX0=
 =2r8m
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/amarkovic/tags/mips-queue-november-2018-v2' into staging

MIPS queue for QEMU 3.1-rc2 - v2

# gpg: Signature made Sat 17 Nov 2018 18:30:46 GMT
# gpg:                using RSA key D4972A8967F75A65
# gpg: Good signature from "Aleksandar Markovic <amarkovic@wavecomp.com>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 8526 FBF1 5DA3 811F 4A01  DD75 D497 2A89 67F7 5A65

* remotes/amarkovic/tags/mips-queue-november-2018-v2:
  MAINTAINERS: Add Stefan Markovic as a MIPS reviewer
  target/mips: Disable R5900 support
  target/mips: Rename MMI-related functions
  target/mips: Rename MMI-related opcodes
  target/mips: Rename MMI-related masks
  target/mips: Guard check_insn with INSN_R5900 check
  target/mips: Guard check_insn_opc_user_only with INSN_R5900 check
  target/mips: Fix decoding mechanism of special R5900 opcodes
  target/mips: Fix decoding mechanism of R5900 DIV1 and DIVU1
  target/mips: Fix decoding mechanism of R5900 MFLO1, MFHI1, MTLO1 and MTHI1
  linux-user: Update MIPS specific prctl() implementation

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-11-19 10:23:45 +00:00
Peter Maydell d06491098b RISC-V Patches for 3.1-rc2
This pull request contains four patches that aren't really related to
 each other aside from all being bug fixes that I think should go in for
 3.1.0:
 
 * The second half of Alistair's memory leak patch set that I missed last
   week.
 * A fix to make fclass.d availiable only on RV64IFD systems (without
   this it's availiable on RV32IFD systems, truncating the result).
 * A fix to make sfence.vm availiable only in priv-1.9.1, and sfence.vma
   only availiable in priv-1.10.
 * A change to respect fences in user-mode emulators, which were
   previously treated as NOPs.
 
 As usual, this builds and boot Linux for me.  I don't think I have
 anything else planned for 3.1.0, but I may be wrong as things are a bit
 hectic this week.
 -----BEGIN PGP SIGNATURE-----
 
 iQJHBAABCAAxFiEEAM520YNJYN/OiG3470yhUCzLq0EFAlvrYtYTHHBhbG1lckBk
 YWJiZWx0LmNvbQAKCRDvTKFQLMurQdF+EACA9fVWBbXmJfsOeWq1887zGXt+Txdf
 KKxWc9JNf6Zo/QLziGinSDAt8UNTtHzckVePdlSAJIiNuvDLf4AtQT8wSjPGeVzS
 IMauZnXe/gz15iqPGLOUmaz9B/UrkV4T5wmFwnNv7T00dBFWIKESez7QJgjPih/e
 zmDgUw+FG6A/SGHBkL60xxhv2+2ZkXhtwaB9tzqeKmqebaJDOgEGT6roQDffbW0C
 jKiRXmBQVFWfmmi1HXfs8NFGmMDgV1vBAr/3dd7F2tZU7lZBhFp/KUkY5VhMC+2y
 CNU7Ug1OyIE6haoPgui2FqlQV95CL7zkqkwEZqdaqzgXAQAxtWsJjMwZl4vCuumu
 DmTEhunvt7/aMqsB2iQgVAXDgKX79qI5xLzc04en0I/BppT1991BWJfyQSyucQyb
 vBF5iLBudsxzAWAB6TSWu7lsBECTYci+QJ/z7ZvvOpTaT8mm0Rc0aEfm0PVpVLIk
 hxZAMdbbPKl3q2e69//w/nw5jHfWk2cAPWcfpFvGWyweD3xLiy60S+++nzWjwJy3
 9mXW7MjW6iFGYTGDUWOQ5207NJ/tISxBsmck81+aPHfb6bPxpIJicZnchfzoWdop
 ahw9XbOsnBZdY18csgeNBQh5UVKZcVGvxeCfjtO/XlIw+kUB3wPbu+bQ+3vUSeV+
 Ubfw/T0n/GerUg==
 =Y5YG
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/riscv/tags/riscv-for-master-3.1-rc2' into staging

RISC-V Patches for 3.1-rc2

This pull request contains four patches that aren't really related to
each other aside from all being bug fixes that I think should go in for
3.1.0:

* The second half of Alistair's memory leak patch set that I missed last
  week.
* A fix to make fclass.d availiable only on RV64IFD systems (without
  this it's availiable on RV32IFD systems, truncating the result).
* A fix to make sfence.vm availiable only in priv-1.9.1, and sfence.vma
  only availiable in priv-1.10.
* A change to respect fences in user-mode emulators, which were
  previously treated as NOPs.

As usual, this builds and boot Linux for me.  I don't think I have
anything else planned for 3.1.0, but I may be wrong as things are a bit
hectic this week.

# gpg: Signature made Tue 13 Nov 2018 23:48:38 GMT
# gpg:                using RSA key EF4CA1502CCBAB41
# gpg: Good signature from "Palmer Dabbelt <palmer@dabbelt.com>"
# gpg:                 aka "Palmer Dabbelt <palmer@sifive.com>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 00CE 76D1 8349 60DF CE88  6DF8 EF4C A150 2CCB AB41

* remotes/riscv/tags/riscv-for-master-3.1-rc2:
  RISC-V: Respect fences for user-only emulators
  target/riscv: Fix sfence.vm/a both available in any priv version
  target/riscv: Fix FCLASS_D being treated as RV64 only
  hw/riscv/virt: Free the test device tree node name

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-11-19 09:35:27 +00:00
Aleksandar Markovic 90b27c4c3b MAINTAINERS: Add Stefan Markovic as a MIPS reviewer
Add Stefan Markovic as a MIPS reviewer. He had several key
contributions to QEMU for MIPS this year. He is a meticulous
person with the ability to think and act on many levels.

Reviewed-by: Stefan Markovic <smarkovic@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
2018-11-17 19:29:34 +01:00
Aleksandar Markovic 823f2897bd target/mips: Disable R5900 support
Disable R5900 support. There are some outstanding issues related
to ABI support and emulation accuracy, that were not understood
well during review process. Disable to avoid backward compatibility
issues.

Reverts commit ed4f49ba9b.

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
2018-11-17 19:29:34 +01:00
Aleksandar Markovic 874b287970 target/mips: Rename MMI-related functions
Rename MMI-related functions.

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Stefan Markovic <smarkovic@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
2018-11-17 19:29:34 +01:00
Aleksandar Markovic baa609db75 target/mips: Rename MMI-related opcodes
Rename MMI-related opcodes.

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Stefan Markovic <smarkovic@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
2018-11-17 19:29:34 +01:00
Aleksandar Markovic c8341e0000 target/mips: Rename MMI-related masks
Rename MMI-related masks.

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Stefan Markovic <smarkovic@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
2018-11-17 19:29:34 +01:00
Fredrik Noring 992e8176d3 target/mips: Guard check_insn with INSN_R5900 check
Explicitely mark handling of PREF instruction for R5900 as
treating the same as NOP.

Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Fredrik Noring <noring@nocrew.org>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
2018-11-17 19:29:34 +01:00
Fredrik Noring 55fc7a69aa target/mips: Guard check_insn_opc_user_only with INSN_R5900 check
Avoid using check_opc_user_only() as a decision making code wrt
various architectures. Use ctx->insn_flags checks instead.

Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Fredrik Noring <noring@nocrew.org>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
2018-11-17 19:29:34 +01:00
Fredrik Noring 9dc324ce66 target/mips: Fix decoding mechanism of special R5900 opcodes
MOVN, MOVZ, MFHI, MFLO, MTHI, MTLO, MULT, MULTU, DIV, DIVU, DMULT,
DMULTU, DDIV, DDIVU and JR are decoded in decode_opc_special_tx79
instead of the generic decode_opc_special_legacy.

Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Fredrik Noring <noring@nocrew.org>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
2018-11-17 19:29:34 +01:00
Fredrik Noring c42171c3bf target/mips: Fix decoding mechanism of R5900 DIV1 and DIVU1
DIV1 and DIVU1 are generated in gen_div1_tx79 instead of the generic
gen_muldiv.

Signed-off-by: Fredrik Noring <noring@nocrew.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
2018-11-17 19:29:34 +01:00
Fredrik Noring 86efbfb619 target/mips: Fix decoding mechanism of R5900 MFLO1, MFHI1, MTLO1 and MTHI1
MFLO1, MFHI1, MTLO1 and MTHI1 are generated in gen_HILO1_tx79 instead of
the generic gen_HILO.

Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Fredrik Noring <noring@nocrew.org>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
2018-11-17 19:29:34 +01:00
Stefan Markovic 6456c51081 linux-user: Update MIPS specific prctl() implementation
Perform needed checks before actual prctl() PR_SET_FP_MODE and
PR_GET_FP_MODE work based on kernel implementation. Also, update
necessary hflags.

Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Stefan Markovic <smarkovic@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
2018-11-17 19:29:34 +01:00
Peter Maydell 83c496599c ui: add rendernode arg for egl-headless (fixes permission issues with libvirt)
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJb7sYrAAoJEEy22O7T6HE4BooP+QE7Y+2aiCuFMN86D5AbHrDj
 WgDhh82L/RY75KhASH10fTI6+R5hXM6gqxXQTK6Jo4mdytvzubp6vcb6XfZ+IVw1
 X9/naOA67IpqOeeb0WTScbK106K+t7bYZjdv8qwEWmgPHqbW31C2MaFa//19BCP+
 xVShANXl+i1LCyp4TbJQR99fr2HQxHG5n0d/8FUvTH/iofqf75jCZzXw6PdkLN0J
 kajvO+MpQQi2W4xAHt8+SrVI3KFK9YvIxWFDbuN4Okhh426UDQYKmFUrXWYisnB6
 eE9ljEI3+KrNsoPtV1jThHXSYvDN6/yrdAvootxt8/N4rVET2bMcL/9TKKtWO6YN
 NRrPANf8Rw/GRVoD2LyM8KneTT1Oc1ub5u7RUJLxFlkD0fDyIqOS74hBCKvdpVj8
 T4llZiwISpuG75krztV7r1/EpCk2nhBrigYnnYwlBaFhTEg2xITsSxATcxtBVKpu
 fzenzGMwrSJdhh1D1A5eAd3DK6VZpljtwkCmN6Gem0L8WRKStpNlcxay0q9aFwYD
 E8YFRCBRJo/p93SAT3IX2CnsfRraUrCLJHOoBEyZ0W1J2xmM0nVg/Lj0XSxpCpL5
 u2W1yBghjE+s2rtRMklzcir+le4cH7Jm08vUwhGoEtlynLHSmHh7vDr46xnglGTE
 mdAZRRCxLWsqNdWeUpSc
 =v9N4
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kraxel/tags/fixes-31-20181116-pull-request' into staging

ui: add rendernode arg for egl-headless (fixes permission issues with libvirt)

# gpg: Signature made Fri 16 Nov 2018 13:29:15 GMT
# gpg:                using RSA key 4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/fixes-31-20181116-pull-request:
  help: Provide help for egl-headless
  ui: Allow specifying 'rendernode' display option for egl-headless
  qapi: Add "rendernode" display option for egl-headless

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-11-16 13:53:01 +00:00
Erik Skultety 144aaa990e help: Provide help for egl-headless
EGL headless has been missing from QEMU's help or man page, we should
mention that such a thing exists, especially since projects like libvirt
might rely on that. This patch also adds the newly introduced option for
egl-headless 'rendernode'.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Message-id: 87ef678b0934d3abba66c46c9e65b57119d29295.1542362949.git.eskultet@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2018-11-16 11:44:22 +01:00
Erik Skultety 91e61947eb ui: Allow specifying 'rendernode' display option for egl-headless
As libvirt can't predict which rendernode QEMU would pick, it
won't adjust the permissions on the device, hence QEMU getting
"Permission denied" when opening the DRI device. Therefore, enable
'rendernode' option for egl-headless display type.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1648236

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Message-id: 27f4617f19aa1072114f10f1aa9dd199735ef982.1542362949.git.eskultet@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2018-11-16 11:44:22 +01:00
Erik Skultety d4dc4ab133 qapi: Add "rendernode" display option for egl-headless
Unlike SPICE, egl-headless doesn't offer a way of specifying the DRM
node used for OpenGL, hence QEMU always selecting the first one that is
available. Thus, add the 'rendernode' option for egl-headless to QAPI.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Message-id: 7658e15eca72d520e7a5fb1c2e724702d83d4f7f.1542362949.git.eskultet@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2018-11-16 11:44:22 +01:00
Peter Maydell 6ea4161e64 -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
 
 iQEcBAABAgAGBQJb7jvSAAoJEO8Ells5jWIRizgH/0rSNEVWis7Cvf1BxXcuAbkY
 S3LYgBxVJUhvsjB5Mx7/FRYWSUB/D7Q35cZMFNU66G5ZOAm7YlF7Q7XHDuCWd+mH
 U+HhRKFZLe6YFVgsukLBui+8GRxD+H0Olpd2i3W7+pYC+oNTeVDhAio/K3d4yv4G
 oVM+Lpo3O+NE3nPIcnpKFHOwRcPYnX2bNR+QinKhpUYFwzcKDOggqvI/62S58zgk
 Kh6uYixxtcGfMXx5utNmOzF2m25AfcsC6oRbSDUnQCeRQgIz82OA1haqFhrw+sFK
 YoBJEGHw1ua9C3CuaU60EENEdAs5VvNauBdpuX7jj3BrgP9u06exbxwVRFprLKY=
 =c83S
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/jasowang/tags/net-pull-request' into staging

# gpg: Signature made Fri 16 Nov 2018 03:38:58 GMT
# gpg:                using RSA key EF04965B398D6211
# gpg: Good signature from "Jason Wang (Jason Wang on RedHat) <jasowang@redhat.com>"
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 215D 46F4 8246 689E C77F  3562 EF04 965B 398D 6211

* remotes/jasowang/tags/net-pull-request:
  net/filter-rewriter.c: Fix coverity static analysis issue

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-11-16 10:01:04 +00:00
Zhang Chen 013a62020a net/filter-rewriter.c: Fix coverity static analysis issue
The original code just follow the TCP state diagram,
but in this case, we can skip the TCPS_TIME_WAIT state to simplify
the implementation.

Signed-off-by: Zhang Chen <zhangckid@gmail.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
2018-11-16 11:08:26 +08:00
Peter Maydell d835c61924 Merge tpm 2018/11/15 v1
-----BEGIN PGP SIGNATURE-----
 
 iQEcBAABAgAGBQJb7XzBAAoJEHWtZYAqC0IR3EsIAM6zSEaYlo5fh/VX4KCorYDT
 4nb8agEgVdEP4qdRG2PGPeSvN3D63IEgAhR8dugUs8bGey1MU9SEctb5BR5XdJ3c
 WEh6x7kNazN7Gsu1R5j0ApBnKh7jfObBVgKMc0c3i2TmAQMypwiZY6GJuLcvgAhV
 NJHf8ldu6ephOwForYqerItTD3Cf2Pe0rmggRTEL5LFLgfGW2oem+fwSWLHbyjoC
 qKoQDNZ1d+DatJIz92iygUeF1TDhhOa9+QCW3HujAw5v2DFSbSDtlsU7yf5AKJ11
 /g91DQOK37vEd9Bhu9Z4bEeeoV2DHGCY18WpV4KESG1GYix14kVhd5goxF3A0II=
 =Sw53
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/stefanberger/tags/pull-tpm-2018-11-15-1' into staging

Merge tpm 2018/11/15 v1

# gpg: Signature made Thu 15 Nov 2018 14:03:45 GMT
# gpg:                using RSA key 75AD65802A0B4211
# gpg: Good signature from "Stefan Berger <stefanb@linux.vnet.ibm.com>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: B818 B9CA DF90 89C2 D5CE  C66B 75AD 6580 2A0B 4211

* remotes/stefanberger/tags/pull-tpm-2018-11-15-1:
  tests: tpm: Use g_test_message rather than fprintf
  tpm: use loop iterator to set sts data field

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-11-15 14:18:25 +00:00
Peter Maydell bba390cb9e linux-user/sparc/signal.c: Remove dead code
Coverity complains (CID 1390847) about some dead code in
do_sigreturn(). This is an if (err) clause that can never be
true, copied from the kernel (where __get_user returns an error).
The one code path that could report an error is in the
currently commented-out pseudocode for handling FPU register
restoring, so move the if into that comment (and fix the
broken indent in the comment in the process).

(The new position for the error check is also the semantically
correct one -- we should not restore the signal mask from
the signal frame if we get an error here, so the check must
be done before set_sigmask(), not after.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-id: 20181115114616.26265-1-peter.maydell@linaro.org
2018-11-15 13:06:40 +00:00
Michael Roth 3fccd3f26e make-release: add skiboot .version file
This is needed to build skiboot from tarball-distributed sources
since the git data the make_release.sh script relies on to generate
it is not available.

Cc: qemu-stable@nongnu.org
Reported-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20181109161352.29873-1-mdroth@linux.vnet.ibm.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-11-15 13:03:57 +00:00
Peter Maydell 5eb48906d4 Testing tweaks:
- split MacOSX build
   - fix for readdir() failures in check-tcg
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEZoWumedRZ7yvyN81+9DbCVqeKkQFAlvsHkgACgkQ+9DbCVqe
 KkRgbwf/aR3fPac1aM4wP0feREWvP5uFDkH1lJH4YEOHMip56gRuvyg3caiHmUoz
 55+klOYvYFsjk6omCtCneqaPxdHzqdExHlniG7yURWOEnR7RFhjBxNwfBoyfG1Eh
 ILl3qsquZs5FjoutAEbCekHn8fvokkZDY4f60zrAXdVZmbzt74Qz3YAAXB3Qyuey
 DNnUbfNwOJlhMiM5VACjetxSWikPcGiWOdNcIDBlT0J3SRpo+BE0Dh7JODpxwLDi
 Zp9M18fMZnflREoxjOPklp0dSKZqEF+7OywlgpiZ2DIVm8NT84R4q6aYgOFHKCIa
 6BmFJ0kqMbn9sYD7vyVFj4S6MpPbQw==
 =Rczg
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/stsquad/tags/pull-testing-fixes-for-3.1-141118-1' into staging

Testing tweaks:

  - split MacOSX build
  - fix for readdir() failures in check-tcg

# gpg: Signature made Wed 14 Nov 2018 13:08:24 GMT
# gpg:                using RSA key FBD0DB095A9E2A44
# gpg: Good signature from "Alex Bennée (Master Work Key) <alex.bennee@linaro.org>"
# Primary key fingerprint: 6685 AE99 E751 67BC AFC8  DF35 FBD0 DB09 5A9E 2A44

* remotes/stsquad/tags/pull-testing-fixes-for-3.1-141118-1:
  tests/tcg/multiarch: fix 32bit linux-test on 64bit host
  .travis.yml: split MacOSX builds and reduce target list

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-11-15 11:26:48 +00:00
Peter Maydell 18d30e7b59 Fix error handling during zpci device creation.
-----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEEw9DWbcNiT/aowBjO3s9rk8bwL68FAlvr9CsSHGNvaHVja0By
 ZWRoYXQuY29tAAoJEN7Pa5PG8C+vtDoP/j3m/iwzmSclKQlnipcg3QQQ8Lv65TAU
 nTF8Oq+F6FEG5h2WoaMWSnG6hhycxxA1sbKlPNNmGwJscb9FaGLtxFmg5UTfwZUk
 NXenftO35rjP98b9bUTJVvXncSraFG8lZjwuKbEg0fJbZ0mr+D1W6OgS+FGp1Moz
 pcyfI4rTnJN167++k56LD72rse7c3GKFOVbtSq5bXrUFD3bo7hGSKJ+RRmDigVFi
 CicFLoc87P2XLVSroAygarK9FMCCNufqKPKjZdU0TZHg5WChLiw72ZtZYwO80ZuJ
 fcQ8L013oMpcytF82ZgQ9voTDgoHRc321IJqCeTFLwSSOVKbHa3uQ/s9wuu41X84
 Xy9GNB01StjNqz/RO88/Q/1HBbhhrnPzcl1oIMSvTh2fFkjSAPZpfuKVv7znNonU
 XTwUfBTadcSSf1D5r3ggqtfdtu9KYoh2hE55C/eRFXH6pF6SKgSOfqr/yedauzmN
 gwyPjBdySB3OUPdjMzZRMBAtp3/y3sXeoGKBkyumkc+RxnJzwNEt6GtkG99Pde1i
 5tW4DCdvmJJDiMPID+acpZ8qKv4/Ccs30mq4OONbEufjrPPgP+nP7Z7JB2NZAmua
 jBzjELXyDWe5Pu+EJgP8wOOtT+Q6Gue8wMf6r95Y7vYSmu2tnEdTo2ump3SQx46F
 PNVTH023qsYZ
 =jqHW
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20181114' into staging

Fix error handling during zpci device creation.

# gpg: Signature made Wed 14 Nov 2018 10:08:43 GMT
# gpg:                using RSA key DECF6B93C6F02FAF
# gpg: Good signature from "Cornelia Huck <conny@cornelia-huck.de>"
# gpg:                 aka "Cornelia Huck <huckc@linux.vnet.ibm.com>"
# gpg:                 aka "Cornelia Huck <cornelia.huck@de.ibm.com>"
# gpg:                 aka "Cornelia Huck <cohuck@kernel.org>"
# gpg:                 aka "Cornelia Huck <cohuck@redhat.com>"
# Primary key fingerprint: C3D0 D66D C362 4FF6 A8C0  18CE DECF 6B93 C6F0 2FAF

* remotes/cohuck/tags/s390x-20181114:
  s390x/pci: properly fail if the zPCI device cannot be created

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-11-15 10:01:16 +00:00
Stefan Berger 5e58b58c47 tests: tpm: Use g_test_message rather than fprintf
Display a message during the test using g_test_message rather
than fprintf.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
2018-11-14 16:12:24 -05:00
Prasad J Pandit 6a50bb98f2 tpm: use loop iterator to set sts data field
When TIS request is done, set 'sts' data field across all localities.

Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2018-11-14 15:47:24 -05:00
Laurent Vivier 1f442da51e tests/tcg/multiarch: fix 32bit linux-test on 64bit host
Fix:

  TEST    linux-test on i386
  .../tests/tcg/multiarch/linux-test.c:201: readdir

readdir() calls getdents64() to have the list of the entries in a
directory, and getdents64() can return 64bit d_off values (with ext4,
for instance) that will not fit in the 32bit d_off field of the
readdir() dirent structure.

To avoid that, use readdir64() to use a 64bit d_off field too.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2018-11-14 11:07:06 +00:00
Alex Bennée adcf96830d .travis.yml: split MacOSX builds and reduce target list
We have reached the point where the MacOSX build was regularly timing
out. So as before I've reduced the target list to "major"
architectures to try and bring the build time down. I've added an
additional MacOSX build with the latest XCode with a minimal list of
"most likely" targets on MacOS.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2018-11-14 10:20:23 +00:00
Palmer Dabbelt 3502dc824a
RISC-V: Respect fences for user-only emulators
Our current fence implementation ignores fences for the user-only
configurations.  This is incorrect but unlikely to manifest: it requires
multi-threaded user-only code that takes advantage of the weakness in
the host's memory model and can be inlined by TCG.

This patch simply treats fences the same way for all our emulators.
I've given it to testing as I don't want to construct a test that would
actually trigger the failure.

Our fence implementation has an additional deficiency where we map all
RISC-V fences to full fences.  Now that we have a formal memory model
for RISC-V we can start to take advantage of the strength bits on our
fence instructions.  This requires a bit more though, so I'm going to
split it out because the implementation is still correct without taking
advantage of these weaker fences.

Thanks to Richard Henderson for pointing out both of the issues.

Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2018-11-13 15:12:15 -08:00
Bastian Koppelmann 6573777306
target/riscv: Fix sfence.vm/a both available in any priv version
sfence.vm has been replaced in priv v1.10 spec by sfence.vma.

Reported-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
2018-11-13 15:12:15 -08:00
Bastian Koppelmann 40cf6a54c9
target/riscv: Fix FCLASS_D being treated as RV64 only
Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
2018-11-13 15:12:15 -08:00
Alistair Francis 632fb2792b
hw/riscv/virt: Free the test device tree node name
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
2018-11-13 15:12:13 -08:00
Peter Maydell cb968d275c Update version for v3.1.0-rc1 release
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-11-13 18:16:14 +00:00
David Hildenbrand b6e67ecc7b s390x/pci: properly fail if the zPCI device cannot be created
Right now, errors during realize()/pre_plug/plug of the zPCI device
would result in QEMU crashing instead of failing nicely when creating
a zPCI device for a PCI device.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Collin Walling <walling@linux.ibm.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20181113121710.18490-1-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
2018-11-13 16:46:55 +01:00