]> xenbits.xensource.com Git - people/iwj/xen.git/log
people/iwj/xen.git
6 years ago/etc/default/xen: Handle with ucf
Ian Jackson [Wed, 27 Feb 2019 16:37:32 +0000 (16:37 +0000)]
/etc/default/xen: Handle with ucf

We reintroduced this file in
  "d/xen-utils-common.install: ship /etc/default/xen"
  eg 2f34db35dd27abb4280d38ebc4464c21f64df8c9

But I had forgotten that this file was previously shipped and handled
by ucf; and we have machinery to try to remove it.

This leaves the following possible cases:
(a) stretch: file handled by ucf
(b) older buster: file not shipped, ucf postinst action not done
   | file remains recorded by ucf and ucfr, but that the original
   | version of the file is no longer present on the user's machine
(c) newer buster: file shipped, file recorded by ucf with one
   old version and as dpkg conffile by newer version

(a) and (b) will be handled correctly by just using ucf in the normal
way.

(c) xxx needs testing

So:
 * Drop the special call to ucf-remove-fixup; retain the call to ucf
 * Switch to shipping the file in /usr/share as expected by ucf

We do not remove the file's entry from not-installed - see the
comment relating to #831786.

Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
6 years agochangelog: start 3~
Ian Jackson [Wed, 27 Feb 2019 16:45:00 +0000 (16:45 +0000)]
changelog: start 3~

6 years agotools/xl/bash-completion: also complete 'xen'
Hans van Kranenburg [Sun, 10 Feb 2019 17:26:45 +0000 (18:26 +0100)]
tools/xl/bash-completion: also complete 'xen'

We have the `xen` alias for xl in Debian, since in the past it was a
command that could execute either xl or xm.

Now, it always does xl, so, complete the same stuff for it as we have
for xl.

Signed-off-by: Hans van Kranenburg <hans@knorrie.org>
[git-debrebase split: mixed commit: debian part]

6 years agod/not-installed: work around dh-exec bug
Hans van Kranenburg [Sun, 24 Feb 2019 17:23:51 +0000 (18:23 +0100)]
d/not-installed: work around dh-exec bug

dh-exec breaks dh_missing by failing to register the installed files.
Put a workaround in place.

Closes: #923013
Signed-off-by: Hans van Kranenburg <hans@knorrie.org>
6 years agod/[..]/grub.d/xen.cfg: dom0_mem max IS needed
Hans van Kranenburg [Fri, 22 Feb 2019 16:06:29 +0000 (17:06 +0100)]
d/[..]/grub.d/xen.cfg: dom0_mem max IS needed

I misread the upstream documentation. Adding max: for x86 is actually
necessary to not have it "attempt to allocate enough page tables to
cover all of *host* RAM which can exhaust its actual memory allocation".

Signed-off-by: Hans van Kranenburg <hans@knorrie.org>
6 years agochangelog: finalise -2
Ian Jackson [Fri, 22 Feb 2019 16:07:41 +0000 (16:07 +0000)]
changelog: finalise -2

Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
6 years agoPackaging change: override lintian warning about fsimage.so rpath.
Ian Jackson [Fri, 22 Feb 2019 15:50:00 +0000 (15:50 +0000)]
Packaging change: override lintian warning about fsimage.so rpath.

This warning is spurious.  Normally .debs should not set rpath but in
this case it is needed.

Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
6 years agochangelog: start -2~
Ian Jackson [Fri, 22 Feb 2019 15:49:01 +0000 (15:49 +0000)]
changelog: start -2~

Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
6 years agochangelog: finalise for release to sid/buster
Ian Jackson [Fri, 22 Feb 2019 15:11:55 +0000 (15:11 +0000)]
changelog: finalise for release to sid/buster

Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
6 years agochangelog: Remove a trailing space
Ian Jackson [Fri, 22 Feb 2019 15:10:23 +0000 (15:10 +0000)]
changelog: Remove a trailing space

Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
6 years agochangelog: manually edit, preparatory to release
Ian Jackson [Fri, 22 Feb 2019 14:40:57 +0000 (14:40 +0000)]
changelog: manually edit, preparatory to release

Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
6 years agochangelog: gbp dch --ignore-branch --since=a8ba67214681b6c5a5d7486550585116f1690ed0
Ian Jackson [Fri, 22 Feb 2019 14:15:47 +0000 (14:15 +0000)]
changelog: gbp dch --ignore-branch --since=a8ba67214681b6c5a5d7486550585116f1690ed0

On top of bd06240ecc, which was before the gdr new-upstream
The --since is the last edit to d/changelog

(Cherry picked onto my current master, dealing with conflicts.)

Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
6 years agoUpdate changelog for new upstream 4.11.1+26-g87f51bf366
Ian Jackson [Fri, 22 Feb 2019 14:00:19 +0000 (14:00 +0000)]
Update changelog for new upstream 4.11.1+26-g87f51bf366

[git-debrebase changelog: new upstream 4.11.1+26-g87f51bf366]

6 years agoUpdate to upstream 4.11.1+26-g87f51bf366
Ian Jackson [Fri, 22 Feb 2019 14:00:19 +0000 (14:00 +0000)]
Update to upstream 4.11.1+26-g87f51bf366

[git-debrebase anchor: new upstream 4.11.1+26-g87f51bf366, merge]

6 years agoxencommons xenstored startup: Use --pid-file $F not --pid-file=$F
Ian Jackson [Fri, 22 Feb 2019 12:26:31 +0000 (12:26 +0000)]
xencommons xenstored startup: Use --pid-file $F not --pid-file=$F

The ocaml libraries in stretch understands only the variant
with separate arguments.  So a build of this package for stretch
produces an error message and C xenstored instead of oxenstored.

Fix this here even in the buster branch since it makes backporting
easier.

Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
6 years agoxendomains init script; Add should-dependency on nfs-kernel-server
Ian Jackson [Thu, 21 Feb 2019 17:34:39 +0000 (17:34 +0000)]
xendomains init script; Add should-dependency on nfs-kernel-server

Perhaps the guests use the hosts's NFS server, as in the case reported
in #826871.

In any case, it seems much more likely that on a system which is an
NFS server and also a Xen host, that the guests depend on the NFS,
rather than vice versa.

The obvious exception would be a driver domain.  Driver domains
probably need to be handled separately anyway, since they must start
before other domains.  (And anyway they are not particularly
well-handled by the current packaging.)

Closes: #826871
Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
6 years agoxendomains init script; Add dependency on $network
Ian Jackson [Thu, 21 Feb 2019 17:32:01 +0000 (17:32 +0000)]
xendomains init script; Add dependency on $network

xendomains generally needs to start after the bridge is set up.

In
  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=798510#20
it was reported that for that user this improves things.

We expect that this change may help with (or at least mask) some other
starup races such as that in the original report for #798510.

Closes: #798510
Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
6 years agohotplug-common: Strip arch-specific libdir from config file
Ian Jackson [Thu, 21 Feb 2019 16:08:12 +0000 (16:08 +0000)]
hotplug-common: Strip arch-specific libdir from config file

Closes: #862236
Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
6 years agodebian/rules: Fix tiny typo
Ian Jackson [Thu, 21 Feb 2019 16:02:24 +0000 (16:02 +0000)]
debian/rules: Fix tiny typo

Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
6 years agoxen init script: don't fail when being run in domU
Hans van Kranenburg [Sun, 17 Feb 2019 05:03:46 +0000 (06:03 +0100)]
xen init script: don't fail when being run in domU

When installing xen-utils-V in a driver domain domU, it drags in
xen-utils-common, which also contains the init script for xenstored and
xenconsoled.

Installing the package will fail right away, because it exits non-zero
after checking whether it's running in a xen dom0 or not:

 systemd[1]: Starting LSB: Xen daemons...
 xen[7215]: Starting Xen daemons: (warning).
 systemd[1]: xen.service: Control process exited, code=exited, status=255/EXCEPTION
 systemd[1]: xen.service: Failed with result 'exit-code'.
 systemd[1]: Failed to start LSB: Xen daemons.
 dpkg: error processing package xen-utils-common (--configure):
  installed xen-utils-common package post-installation script subprocess returned error exit status 1

Since there's nothing to be fixed, there should not be a warning. It's
totally fine to skip xenstored, xenconsoled and qemu steps in this case,
so just exit cleanly.

Link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=922033
Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Signed-off-by: Hans van Kranenburg <hans@knorrie.org>
Acked-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
6 years agod/[..]/grub.d/xen.cfg: improve docs even more
Hans van Kranenburg [Sun, 10 Feb 2019 23:01:11 +0000 (00:01 +0100)]
d/[..]/grub.d/xen.cfg: improve docs even more

Ok, I finally tried this, and it's really great that I now have correct
(different) linux kernel options generated for just linux and xen+dom0.

Do more cosmetics and reorganizing to make this wall of comments better
parseable by the eye. It was not obvious to me where sections started
and ended, and I like to have first the explanation and then at the end
the actual variables you can set.

Signed-off-by: Hans van Kranenburg <hans@knorrie.org>
Acked-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
6 years agod/x-u-common.install: install completion as as xl
Hans van Kranenburg [Sun, 10 Feb 2019 17:28:42 +0000 (18:28 +0100)]
d/x-u-common.install: install completion as as xl

...and not as xl.sh. All other files in that completions directory also
don't have .sh. This is just cosmetics, but it annoys me. And we have
dh-exec in here now anyway. :]

Signed-off-by: Hans van Kranenburg <hans@knorrie.org>
6 years agoxen init script: move init_dom0 into xenstored start
Hans van Kranenburg [Sun, 10 Feb 2019 15:35:20 +0000 (16:35 +0100)]
xen init script: move init_dom0 into xenstored start

Executing this is only necessary after starting xenstored. In all other
cases it just prints noop spam to stderr.

    -# /usr/lib/xen-4.11/bin/xen-init-dom0 >/dev/null
    Dom0 is already set up

I don't want to silence stderr, so just move the code into the end of
the xenstored start function.

Also, add a hint that the compatibility if/else part should be removed
after the Buster release.

Signed-off-by: Hans van Kranenburg <hans@knorrie.org>
Acked-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
6 years agoxen init script: rewrite xenstored start logic
Hans van Kranenburg [Sat, 9 Feb 2019 23:37:55 +0000 (00:37 +0100)]
xen init script: rewrite xenstored start logic

We're adding oxenstored, and we want use it by default in Xen 4.11.

When doing a Debian upgrade from Stretch to Buster, the xen-utils-common
package will be upgraded to the new version, but it still needs to
support running the Xen 4.8 hypervisor and utils, because the user might
not have rebooted yet, or might boot into the 4.8 hypervisor again
because there were troubles running 4.11.

So, this means that oxenstored might or might not be available, and we
have to deal with that.

See comments in the code for more explanation about the new program
flow.

Also...
* Allow the user to explicitly configure a xenstored binary in
/etc/default/xen.
* Use if statements rather than constructs using || and && to make the
program flow a bit easier to understand.
* Remove the confuscating madness of having 1 as a success return code.
* Don't print the xenstored progress message if we're not touching it.

Signed-off-by: Hans van Kranenburg <hans@knorrie.org>
Acked-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
6 years agod/xen-utils-common.install: ship /etc/default/xen
Hans van Kranenburg [Sat, 9 Feb 2019 17:05:31 +0000 (18:05 +0100)]
d/xen-utils-common.install: ship /etc/default/xen

This file has been in the package before, it contained TOOLSTACK= to
switch between xm and xl. It was abandoned and never cleaned up, so old
installs still have this file.

Ship it again.

Signed-off-by: Hans van Kranenburg <hans@knorrie.org>
Acked-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
6 years agooxenstored: Build it
Ian Jackson [Fri, 1 Feb 2019 16:49:33 +0000 (16:49 +0000)]
oxenstored: Build it

 * Add the relevant build dependencies

     ocaml-native-compilers is good on stretch because it
     will get us better output code.  In buster the
     ocaml-native-compilers package is merged into ocaml-nox.
     In bullseye we can drop ocaml-native-compilers from the list.

 * Drop the rules line that disables the ocaml build.

 * Ship /etc/xen/oxenstored.conf.

 * Placate dh_missing about ocaml development libraries.

Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
[add trailing comma, fix typo, change bulleseye line]
Signed-off-by: Hans van Kranenburg <hans@knorrie.org>
6 years agoxen init script: Tidy up wrong/missing Xen version error handling
Ian Jackson [Thu, 7 Feb 2019 16:07:03 +0000 (16:07 +0000)]
xen init script: Tidy up wrong/missing Xen version error handling

We no longer want to discard the stderr from xen-dir, and treat this
as a success.  All the reasons why this failure might previously have
been thought tolerable have been dealt with.

Specifically, we will no longer reach this code if we are not running
under Xen, or if we ran this init script on behalf of a xen-utils-V
package for some V different to the running Xen version.

We know we are running under Xen, and that either we're running not as
a result of a maint script, or as a result of a xen-utils-V maint
script for the running Xen version, or as a result of some other maint
script (of which we don't think there are any, but it presumably
expects this code to work).

So if xen-dir fails, let it print its error message, and also exit
nonzero.  And don't mention not running under Xen in our
log_warning_msg.

Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
Acked-by: Hans van Kranenburg <hans@knorrie.org>
6 years agoxen init script: Do nothing if running for wrong Xen package
Ian Jackson [Thu, 7 Feb 2019 15:56:49 +0000 (15:56 +0000)]
xen init script: Do nothing if running for wrong Xen package

See the big comment.  We think that this is responsible for various
bugs and, particularly, reports of mysteriously missing xenconsoled.

For example, this bug would mean that after a Xen version upgrade,
autoremoval of an obsolete xen-utils-V package would stop the running
xenconsoled.  This is obviously awkward to track down, and could occur
many weeks or months after the upgrade.

Closes: #851654
Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
Acked-by: Hans van Kranenburg <hans@knorrie.org>
6 years agoxen init script: silently exit status 0 if not running under xen
Ian Jackson [Thu, 7 Feb 2019 15:54:49 +0000 (15:54 +0000)]
xen init script: silently exit status 0 if not running under xen

This script should not complain at all if we are not running under
Xen.  Check this right at the start.

This will enable improvements to the following code, which will no
longer have to deal with the `not running under Xen' case.

Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
Acked-by: Hans van Kranenburg <hans@knorrie.org>
6 years agoxen version/upgrade handling: Improve an error message
Ian Jackson [Thu, 7 Feb 2019 15:24:06 +0000 (15:24 +0000)]
xen version/upgrade handling: Improve an error message

When xen-dir cannot find xen-utils, mention that this might be because
xen-utils-<RUNNING-XEN-VERSION> was already removed.

This is generally helpful, but it does not solve the `missing
xenconsoled' problems because 1. it only changes messages and
2. actually in the init script, the error message is currently
discarded anyway (!)

But, anyway, it is an improvemennt.

Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
Acked-by: Hans van Kranenburg <hans@knorrie.org>
6 years agodebian/.gitignore: ignore more debhelper snippets
Hans van Kranenburg [Sun, 3 Feb 2019 21:39:38 +0000 (22:39 +0100)]
debian/.gitignore: ignore more debhelper snippets

Stuff like:

debian/xen-utils-common.preinst.debhelper
debian/xen-utils-common.prerm.debhelper

6 years agodebian/xen-utils-common.*: remove more xend cruft
Hans van Kranenburg [Sun, 3 Feb 2019 14:41:29 +0000 (15:41 +0100)]
debian/xen-utils-common.*: remove more xend cruft

Ah, these files are still present on my dom0, while they're obsolete and
not shipped any more. Have them removed, so that they don't confuse the
user.

(Someone might run into old documentation about xend and see that the
files are there, and try setting options, which don't do anything
etc...)

Unpacking xen-utils-common (4.11.1-2~) over (4.11.1-2~) ...
Setting up xen-utils-common (4.11.1-2~) ...
Obsolete conffile /etc/default/xend has been modified by you.
Saving as /etc/default/xend.dpkg-bak ...
Removing obsolete conffile /etc/xen/xend-config.sxp ...
Removing obsolete conffile /etc/xen/xend-pci-permissive.sxp ...
Removing obsolete conffile /etc/xen/xend-pci-quirks.sxp ...
[...]

6 years agodebian/control: bump debhelper builddep to 10
Hans van Kranenburg [Fri, 1 Feb 2019 15:22:13 +0000 (16:22 +0100)]
debian/control: bump debhelper builddep to 10

The debian/compat file contains '10', so make sure that there's actually
a debhelper being dragged in that can do everything needed.

This fixes the lintian warning:
    package-needs-versioned-debhelper-build-depends

6 years agod/xen-utils-V...: override xen-shim-syms lintian
Hans van Kranenburg [Fri, 1 Feb 2019 15:16:26 +0000 (16:16 +0100)]
d/xen-utils-V...: override xen-shim-syms lintian

This is ok, it's not a file that is meant to be executed on the host
system itself.

6 years agodebian/control: add dh-python build-dep
Hans van Kranenburg [Fri, 1 Feb 2019 15:08:54 +0000 (16:08 +0100)]
debian/control: add dh-python build-dep

Lintian is complaining: missing-build-dependency-for-dh_-command

"The source package appears to be using a dh_ command but doesn't build
depend on the package that actually provides it. If it uses it, it must
build depend on it."

6 years agodebian/libxenstore3.0.symbols: revert ea2334dfe0
Hans van Kranenburg [Fri, 1 Feb 2019 14:55:50 +0000 (15:55 +0100)]
debian/libxenstore3.0.symbols: revert ea2334dfe0

This part of commit ea2334dfe0 was left behind after redoing the
packaging and getting all libraries in the right place. The build now
complains about it:

dpkg-gensymbols: warning: some libraries disappeared in the symbols
file: libxentoolcore-4.10.so.1

dpkg-gensymbols: warning: debian/libxenstore3.0/DEBIAN/symbols doesn't
match completely debian/libxenstore3.0.symbols

6 years agodebian/xen-utils-common.*: remove xend cruft
Hans van Kranenburg [Tue, 22 Jan 2019 18:58:32 +0000 (19:58 +0100)]
debian/xen-utils-common.*: remove xend cruft

xend is obsolete and removed. Still, there are some traces of it in init
and other scripts. Remove all of it now.

Also remove a migration step about upgrading to 4.1, since we don't
support directly upgrading from something older than that to the current
package.

6 years agod/control: xenstore-utils breaks xen-utils-common
Hans van Kranenburg [Thu, 24 Jan 2019 00:24:55 +0000 (01:24 +0100)]
d/control: xenstore-utils breaks xen-utils-common

In the theoretical case that xenstore-utils gets upgraded, when
upgrading from Stretch to Buster, and then deliberately gets downgraded
again by the user, a few manual page files could be removed.

In a normal sane upgrade scenario this would never happen.

6 years agod/control: have xen-utils-common suggest xen-doc
Hans van Kranenburg [Wed, 23 Jan 2019 23:37:30 +0000 (00:37 +0100)]
d/control: have xen-utils-common suggest xen-doc

6 years agod/[..]/grub.d/xen.cfg: command line "starter kit"
Hans van Kranenburg [Sat, 19 Jan 2019 23:16:31 +0000 (00:16 +0100)]
d/[..]/grub.d/xen.cfg: command line "starter kit"

As pointed out by Gergely in debian bug #919758, the examples in the
grub documentation contain incorrect suggestions, at least for dom0_mem
and earlyprintk.

Correct those, and take the opportunity to refresh all of this a bit,
including the most common set of used options.

Also, point to the online documentation where more explanation about all
options can be found.

(Closes: #919758)

6 years agochangelog: start an empty changelog for 4.11.1-2~
Ian Jackson [Thu, 10 Jan 2019 15:45:45 +0000 (15:45 +0000)]
changelog: start an empty changelog for 4.11.1-2~

Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
6 years agofinalise 4.11.1-1
Ian Jackson [Thu, 10 Jan 2019 15:26:47 +0000 (15:26 +0000)]
finalise 4.11.1-1

Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
6 years agod/changelog: mention further changes done
Hans van Kranenburg [Thu, 10 Jan 2019 15:09:26 +0000 (16:09 +0100)]
d/changelog: mention further changes done

6 years agod/changelog: Add CVE numbers for recent XSAs
Hans van Kranenburg [Tue, 8 Jan 2019 17:43:33 +0000 (18:43 +0100)]
d/changelog: Add CVE numbers for recent XSAs

6 years agod/changelog: lower unreleased version
Hans van Kranenburg [Thu, 3 Jan 2019 17:16:21 +0000 (18:16 +0100)]
d/changelog: lower unreleased version

When building some intermediate packages and installing with dpkg -i, I
still want to be able to 'normally' upgrade with apt to the final
version.

6 years agod/changelog: mention XSA fixes
Hans van Kranenburg [Thu, 3 Jan 2019 17:15:13 +0000 (18:15 +0100)]
d/changelog: mention XSA fixes

6 years agolibxl: correctly dispose of dominfo list in libxl_name_to_domid
Wei Liu [Tue, 29 Jan 2019 11:37:59 +0000 (11:37 +0000)]
libxl: correctly dispose of dominfo list in libxl_name_to_domid

Tamas reported ssid_label was leaked. Use the designated function to
free dominfo list to fix the leakage.

Reported-by: Tamas K Lengyel <tamas@tklengyel.com>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Tested-by: Tamas K Lengyel <tamas@tklengyel.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
(cherry picked from commit f50dd67950ca9d5a517501af10de7c8d88d1a188)

6 years agolibxl: don't set gnttab limits in soft reset case
Juergen Gross [Thu, 17 Jan 2019 16:40:59 +0000 (16:40 +0000)]
libxl: don't set gnttab limits in soft reset case

In case of soft reset the gnttab limit setting will fail, so omit it.
Setting of max vcpu count is pointless in this case, too, so we can
drop that as well.

Without this patch soft reset will fail with:

libxl: error: libxl_dom.c:363:libxl__build_pre: Couldn't set grant table limits

Reported-by: Jim Fehlig <jfehlig@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Tested-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
6 years agocorrect release note link in SUPPORT.md
Juergen Gross [Fri, 1 Feb 2019 11:34:31 +0000 (12:34 +0100)]
correct release note link in SUPPORT.md

The syntax for the release note link in SUPPORT.md is wrong. Correct
that.

Signed-off-by: Juergen Gross <jgross@suse.com>
6 years agox86/hvm: Fix bit checking for CR4 and MSR_EFER
Andrew Cooper [Fri, 1 Feb 2019 10:36:17 +0000 (11:36 +0100)]
x86/hvm: Fix bit checking for CR4 and MSR_EFER

Before the cpuid_policy logic came along, %cr4/EFER auditing on migrate-in was
complicated, because at that point no CPUID information had been set for the
guest.  Auditing against the host CPUID was better than nothing, but not
ideal.

Similarly at the time, PVHv1 lacked the "CPUID passed through from hardware"
behaviour with PV guests had, and PVH dom0 had to be special-cased to be able
to boot.

Order of information in the migration stream is still an issue (hence we still
need to keep the restore parameter to cope with a nested virt corner case for
%cr4), but since Xen 4.9, all domains start with a suitable CPUID policy,
which is a more appropriate upper bound than host_cpuid_policy.

Finally, reposition the UMIP logic as it is the only row out of order.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
master commit: 9d8c1d1814b744d0fb41085463db5d8ae025607e
master date: 2019-01-29 11:28:11 +0000

6 years agox86/AMD: flush TLB after ucode update
Jan Beulich [Fri, 1 Feb 2019 10:35:41 +0000 (11:35 +0100)]
x86/AMD: flush TLB after ucode update

The increased number of messages (spec_ctrl.c:print_details()) within a
certain time window made me notice some slowness of boot time screen
output. Experimentally I've narrowed the time window to be from
immediately after the early ucode update on the BSP to the PAT write in
cpu_init(), which upon further investigation has an effect because of
the full TLB flush that's implied by that write.

For that reason, as a workaround, flush the TLB of the mapping of the
page that holds the blob. Note that flushing just a single page is
sufficient: As per verify_patch_size() patch size can't exceed 4k, and
the way xmalloc() works the blob can't be crossing a page boundary.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Brian Woods <brian.woods@amd.com>
master commit: f19a199281a23725beb73bef61eb8964d8e225ce
master date: 2019-01-28 17:40:39 +0100

6 years agoxen/cmdline: Fix buggy strncmp(s, LITERAL, ss - s) construct
Andrew Cooper [Fri, 1 Feb 2019 10:34:35 +0000 (11:34 +0100)]
xen/cmdline: Fix buggy strncmp(s, LITERAL, ss - s) construct

When the command line parsing was updated to use const strings and no longer
tokenise with NUL characters, string matches could no longer be made with
strcmp().

Unfortunately, the replacement was buggy.  strncmp(s, "opt", ss - s) matches
"o", "op" and "opt" on the command line, as ss - s may be shorter than the
passed literal.  Furthermore, parse_bool() is affected by this, so substrings
such as "d", "e" and "o" are considered valid, with the latter being ambiguous
between "on" and "off".

Introduce a new strcmp-like function for the task, which looks for exact
string matches, but declares success when the NUL of the literal matches a
comma, colon or semicolon in the command line fragment.

No change to the intended parsing functionality, but fixes cases where a
partial string on the command line will inadvertently trigger options.

A few areas were more than just a trivial change:

 * parse_irq_vector_map_param() gained some style corrections.
 * parse_vpmu_params() was rewritten to use the normal list-of-options form,
   rather than just fixing up parse_vpmu_param() and leaving the parsing being
   hard to follow.
 * Instead of making the trivial fix of adding an explicit length check in
   parse_bool(), use the length to select which token to we search for, which
   is more efficient than the previous linear search over all possible tokens.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Julien Grall <julien.grall@arm.com>
master commit: 2ddf7e3e341df3ccf21613ff7ffd4b7693abe9e9
master date: 2019-01-15 12:58:34 +0000

6 years agomm/page_alloc: fix MEMF_no_dma allocations for single NUMA
Sergey Dyasli [Fri, 1 Feb 2019 10:33:44 +0000 (11:33 +0100)]
mm/page_alloc: fix MEMF_no_dma allocations for single NUMA

Currently dma_bitsize is zero by default on single NUMA node machines.
This makes all alloc_domheap_pages() calls with MEMF_no_dma return NULL.

There is only 1 user of MEMF_no_dma: dom0_memflags, which are used
during memory allocation for Dom0. Failing allocation with default
dom0_memflags is especially severe for the PV Dom0 case: it makes
alloc_chunk() to use suboptimal 2MB allocation algorithm with a search
for higher memory addresses.

This can lead to the NMI watchdog timeout during PV Dom0 construction
on some machines, which can be worked around by specifying "dma_bits"
in Xen's cmdline manually.

Fix the issue by ignoring MEMF_no_dma in cases when dma_bitsize is zero,
which means there is no DMA zone. This shouldn't cause any issues for
Dom0 because alloc_heap_pages() will first use higher memory addresses
for satisfying memory allocation requests.

Signed-off-by: Sergey Dyasli <sergey.dyasli@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
master commit: 5ac2dddb173b69be259ce4b259e73f971a4816c1
master date: 2019-01-09 15:45:14 +0100

6 years agox86emul: work around SandyBridge errata
Jan Beulich [Fri, 1 Feb 2019 10:33:09 +0000 (11:33 +0100)]
x86emul: work around SandyBridge errata

There are a number of exception condition related errata on SandyBridge
CPUs, some of which are unexpected #UD (others, of no interest here, are
lack of mandated exceptions, or exceptions of unexpected type). Annotate
the one workaround we already have, and add two more.

Due to the exception recovery we have in place for stub invocations
these aren't security issues.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
master commit: 0d4d9e8f55602415475e04a5dc8b4ad27845a7f9
master date: 2018-12-18 15:19:47 +0100

6 years agox86emul: fix 3-operand IMUL
Jan Beulich [Fri, 1 Feb 2019 10:32:35 +0000 (11:32 +0100)]
x86emul: fix 3-operand IMUL

While commit 75066cd4ea ("x86emul: fix {,i}mul and {,i}div") indeed did
as its title says, it broke the 3-operand form by uniformly using AL/AX/
EAX/RAX as second source operand. Fix this and add tests covering both
cases.

Reported-by: Andrei Lutas <vlutas@bitdefender.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
master commit: 19232b378fab04997c0612e5c19e82c29b59d99e
master date: 2018-12-18 14:27:09 +0100

6 years agox86/hvm: Corrections to RDTSCP intercept handling
Andrew Cooper [Fri, 1 Feb 2019 10:32:03 +0000 (11:32 +0100)]
x86/hvm: Corrections to RDTSCP intercept handling

For both VT-x and SVM, the RDTSCP intercept will trigger if the pipeline
supports the instruction, but the guest may not have RDTSCP in its featureset.
Bring the vmexit handlers in line with the main emulator behaviour by
optionally handing back #UD.

Next on the AMD side, if RDTSCP actually ends up being intercepted on a debug
build or first-gen SVM hardware which lacks NRIP, we first update regs->rcx,
then call __get_instruction_length() asking for RDTSC.  As the two
instructions are different (and indeed, different lengths!),
__get_instruction_length_from_list() fails and hands back a #GP fault.

This can demonstrated by putting a guest into tsc_mode="always emulate" and
executing an RDTSCP instruction:

  (d1) --- Xen Test Framework ---
  (d1) Environment: HVM 64bit (Long mode 4 levels)
  (d1) Test rdtscp
  (d1) TSC mode 1
  (XEN) emulate.c:147:d1v0 __get_instruction_length: Mismatch between expected and actual instruction:
  (XEN) emulate.c:152:d1v0   insn_index 8, opcode 0xf0031 modrm 0
  (XEN) emulate.c:154:d1v0   rip 0x10475f, nextrip 0x104762, len 3
  (XEN) SVM insn len emulation failed (1): d1v0 64bit @ 0008:0010475f -> 0f 01 f9 0f 31 5b 31 ff 31 c0 e9 c2 db ff ff 00
  (d1) ******************************
  (d1) PANIC: Unhandled exception at 0008:000000000010475f
  (d1) Vec 13 #GP[0000]
  (d1) ******************************

First, teach __get_instruction_length() to cope with RDTSCP, and improve
svm_vmexit_do_rdtsc() to ask for the correct instruction.  Move the regs->rcx
adjustment into this function to ensure it gets done after we are done
potentially raising faults.

Reported-by: Paul Durrant <paul.durrant@citrix.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Brian Woods <brian.woods@amd.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
master commit: 3fd3fda9c26fc3c4f77250f795ed7ff9d38e2ec6
master date: 2018-12-17 16:28:03 +0000

6 years agox86/VT-x: Don't activate VMCS Shadowing outside of nested vmx mode
Andrew Cooper [Fri, 1 Feb 2019 10:31:28 +0000 (11:31 +0100)]
x86/VT-x: Don't activate VMCS Shadowing outside of nested vmx mode

By default on capable hardware, SECONDARY_EXEC_ENABLE_VMCS_SHADOWING is
activated unilaterally.  The VMCS Link pointer is initialised to ~0, but the
VMREAD/VMWRITE bitmap pointers are not.

This causes the 16bit IVT and Bios Data Area get interpreted as the read/write
permission bitmap for guests which blindly execute VMREAD/VMWRITE
instructions.

This is not a security issue because the VMCS Link pointer being ~0 causes
VMREAD/VMWRITE to complete with VMFailInvalid (rather than modifying a
potential shadow VMCS), and the contents of MFN 0 has already been determined
not to contain any interesting data because of L1TF's ability to read that 4k
frame.

Leave VMCS Shadowing disabled by default, and toggle it in
nvmx_{set,clear}_vmcs_pointer().  This isn't the most efficient course of
action, but it is the most simple way of leaving nested-virt working as it did
before.

While editing construct_vmcs(), collect all default secondary_exec_control
modifications together.  The disabling of PML is latently buggy because it
happens after secondary_exec_control are written into the VMCS, although there
is an unconditional update later which writes the correct value into hardware.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
master commit: 75ce36eb72cb93e8a3c9f60fd5e697067921d712
master date: 2018-12-10 16:24:08 +0000

6 years agox86/shadow: don't enable shadow mode with too small a shadow allocation
Jan Beulich [Fri, 1 Feb 2019 10:30:55 +0000 (11:30 +0100)]
x86/shadow: don't enable shadow mode with too small a shadow allocation

We've had more than one report of host crashes after failed migration,
and in at least one case we've had a hint towards a too far shrunk
shadow allocation pool. Instead of just checking the pool for being
empty, check whether the pool is smaller than what
shadow_set_allocation() would minimally bump it to if it was invoked in
the first place.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Tim Deegan <tim@xen.org>
master commit: 2634b997afabfdc5a972e07e536dfbc6febb4385
master date: 2018-11-30 12:10:39 +0100

6 years agons16550/PCI: fix skipping of devices
Jan Beulich [Fri, 1 Feb 2019 10:29:53 +0000 (11:29 +0100)]
ns16550/PCI: fix skipping of devices

Selecting between single/multiple BAR mode should happen after checking
whether to skip the present device, or else multi-BAR devices won't be
skipped correctly, due to port_idx getting set to zero in that case.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
master commit: c34fe0468acc61aca62422483c37a1309708f1cb
master date: 2018-11-30 12:07:33 +0100

6 years agox86/soft-reset: Drop gfn reference after calling get_gfn_query()
Andrew Cooper [Fri, 1 Feb 2019 10:29:16 +0000 (11:29 +0100)]
x86/soft-reset: Drop gfn reference after calling get_gfn_query()

get_gfn_query() internally takes the p2m lock, and this error path leaves it
locked.

This wasn't included in XSA-277 because the error path can only be triggered
by a carefully timed phymap operation concurrent with the domain being paused
and the toolstack issuing DOMCTL_soft_reset.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
master commit: e7969e917cef276318f722a607985a2e896aeb94
master date: 2018-11-22 17:58:46 +0000

6 years agox86/mem-sharing: Don't leave the altp2m lock held when nominating a page
Andrew Cooper [Fri, 1 Feb 2019 10:28:45 +0000 (11:28 +0100)]
x86/mem-sharing: Don't leave the altp2m lock held when nominating a page

get_gfn_type_access() internally takes the p2m lock, and nothing ever unlocks
it.  Switch to using the unlocked accessor instead.

This wasn't included in XSA-277 because neither mem-sharing nor altp2m are
supported.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Tamas K Lengyel <tamas@tklengyel.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
master commit: d6e02850d3b45c9658457214a749cc48097bdef4
master date: 2018-11-22 17:58:46 +0000

6 years agox86/HVM: __hvm_copy() should not write to p2m_ioreq_server pages
Jan Beulich [Fri, 1 Feb 2019 10:27:59 +0000 (11:27 +0100)]
x86/HVM: __hvm_copy() should not write to p2m_ioreq_server pages

Commit 3bdec530a5 ("x86/HVM: split page straddling emulated accesses in
more cases") introduced a hvm_copy_to_guest_linear() attempt before
falling back to hvmemul_linear_mmio_write(). This is wrong for the
p2m_ioreq_server special case. That change widened a pre-existing issue
though: Other writes to such pages also need to be failed (or forced
through emulation), in particular hypercall buffer writes.

Reported-by: Igor Druzhinin <igor.druzhinin@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
master commit: d7bff2bc003cd5fd8c618b70c62b8fcfd9cd187e
master date: 2018-11-15 16:42:25 +0100

6 years agoupdate Xen version to 4.11.2-pre
Jan Beulich [Fri, 1 Feb 2019 10:27:06 +0000 (11:27 +0100)]
update Xen version to 4.11.2-pre

6 years agoVMX: fix vmx_handle_eoi()
Jan Beulich [Fri, 1 Feb 2019 10:25:52 +0000 (11:25 +0100)]
VMX: fix vmx_handle_eoi()

In commit 303066fdb1e ("VMX: fix interaction of APIC-V and Viridian
emulation") I screwed up: Instead of clearing SVI, other ISR bits
should be taken into account.

Introduce a new helper set_svi(), split out of vmx_process_isr(), and
use it also from vmx_handle_eoi().

Following the problems in vmx_intr_assist() (see the still present big
block of debugging code there) also warn (once) if EOI'd vector and
original SVI don't match.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Chao Gao <chao.gao@intel.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
master commit: 45cb9a4123b5550eb1f84846fe5482acae1c13a3
master date: 2018-11-02 12:15:33 +0100

6 years agoxen/arm: Don't build GICv3 with the new vGIC
Julien Grall [Fri, 19 Oct 2018 14:23:55 +0000 (15:23 +0100)]
xen/arm: Don't build GICv3 with the new vGIC

Commit 54ec59f6b0 "xen/arm: vgic-v3: Don't create empty re-distributor
regions" breaks compilation when using the new vGIC.

This is because the field nr_regions is not existing in the vgic
structure. For simplicity, as vGICv3 is not yet imported, disable GICv3.

Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
(cherry picked from commit 62aa9e7f1b8ef64b8c7c1dacb1122351cb9fd132)

6 years agoxen/arm: vgic-v3: Don't create empty re-distributor regions
Julien Grall [Mon, 1 Oct 2018 16:42:27 +0000 (17:42 +0100)]
xen/arm: vgic-v3: Don't create empty re-distributor regions

At the moment, Xen is assuming the hardware domain will have the same
number of re-distributor regions as the host. However, as the
number of CPUs or the stride (e.g on GICv4) may be different we end up
exposing regions which does not contain any re-distributors.

When booting, Linux will go through all the re-distributor region to
check whether a property (e.g vPLIs) is available accross all the
re-distributors. This will result to a data abort on empty regions
because there are no underlying re-distributor.

So we need to limit the number of regions exposed to the hardware
domain. The code reworked to only expose the minimun number of regions
required by the hardware domain. It is assumed the regions will be
populated starting from the first one.

Lastly, rename vgic_v3_rdist_count to reflect the value return by the
helper.

Reported-by: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>
Signed-off-by: Julien Grall <julien.grall@arm.com>
Tested-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
(cherry picked from commit 54ec59f6b0b363c34cf1864d5214a05e35ea75ee)

6 years agoxen/arm: vgic-v3: Delay the initialization of the domain information
Julien Grall [Mon, 1 Oct 2018 16:42:26 +0000 (17:42 +0100)]
xen/arm: vgic-v3: Delay the initialization of the domain information

A follow-up patch will require to know the number of vCPUs when
initializating the vGICv3 domain structure. However this information is
not available at domain creation. This is only known once
XEN_DOMCTL_max_vpus is called for that domain.

In order to get the max vCPUs around, delay the domain part of the vGIC
v3 initialization until the first vCPU of the domain is initialized.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Tested-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
Acked-but-disliked-by: Stefano Stabellini <sstabellini@kernel.org>
(cherry picked from commit 703d9d5ec13a0f487e7415174ba54e0e3ca158db)

6 years agoxen/arm: check for multiboot nodes only under /chosen
Stefano Stabellini [Tue, 13 Nov 2018 16:45:49 +0000 (08:45 -0800)]
xen/arm: check for multiboot nodes only under /chosen

Make sure to only look for multiboot compatible nodes only under
/chosen, not under any other paths (depth <= 3).

Signed-off-by: Stefano Stabellini <stefanos@xilinx.com>
[julien: Use sizeof(path) instead of len ]
Reviewed-by: Julien Grall <julien.grall@arm.com>
(cherry picked from commit c32e3689c546305d4eae53e6ccf9c8b4e048c7df)

6 years agoxen/arm: gic: Ensure ordering between read of INTACK and shared data
Julien Grall [Tue, 23 Oct 2018 18:17:07 +0000 (19:17 +0100)]
xen/arm: gic: Ensure ordering between read of INTACK and shared data

When an IPI is generated by a CPU, the pattern looks roughly like:

  <write shared data>
  dsb(sy);
  <write to GIC to signal SGI>

On the receiving CPU we rely on the fact that, once we've taken the
interrupt, then the freshly written shared data must be visible to us.
Put another way, the CPU isn't going to speculate taking an interrupt.

Unfortunately, this assumption turns out to be broken.

Consider that CPUx wants to send an IPI to CPUy, which will cause CPUy
to read some shared_data. Before CPUx has done anything, a random
peripheral raises an IRQ to the GIC and the IRQ line on CPUy is raised.
CPUy then takes the IRQ and starts executing the entry code, heading
towards gic_handle_irq. Furthermore, let's assume that a bunch of the
previous interrupts handled by CPUy were SGIs, so the branch predictor
kicks in and speculates that irqnr will be <16 and we're likely to
head into handle_IPI. The prefetcher then grabs a speculative copy of
shared_data which contains a stale value.

Meanwhile, CPUx gets round to updating shared_data and asking the GIC
to send an SGI to CPUy. Internally, the GIC decides that the SGI is
more important than the peripheral interrupt (which hasn't yet been
ACKed) but doesn't need to do anything to CPUy, because the IRQ line
is already raised.

CPUy then reads the ACK register on the GIC, sees the SGI value which
confirms the branch prediction and we end up with a stale shared_data
value.

This patch fixes the problem by adding an smp_rmb() to the IPI entry
code in do_SGI.

At the same time document the write barrier.

Based on Linux commit f86c4fbd930ff6fecf3d8a1c313182bd0f49f496
"irqchip/gic: Ensure ordering between read of INTACK and shared data".

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Andrii Anisov<andrii_anisov@epam.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
(cherry picked from commit 555e5f1bd26c4c1995357e9671b3e42a68d5ce8f)

6 years agoxen/arm: gic: Ensure we have an ISB between ack and do_IRQ()
Julien Grall [Tue, 23 Oct 2018 18:17:06 +0000 (19:17 +0100)]
xen/arm: gic: Ensure we have an ISB between ack and do_IRQ()

Devices that expose their interrupt status registers via system
registers (e.g. Statistical profiling, CPU PMU, DynamIQ PMU, arch timer,
vgic (although unused by Linux), ...) rely on a context synchronising
operation on the CPU to ensure that the updated status register is
visible to the CPU when handling the interrupt. This usually happens as
a result of taking the IRQ exception in the first place, but there are
two race scenarios where this isn't the case.

For example, let's say we have two peripherals (X and Y), where Y uses a
system register for its interrupt status.

Case 1:
1. CPU takes an IRQ exception as a result of X raising an interrupt
2. Y then raises its interrupt line, but the update to its system
   register is not yet visible to the CPU
3. The GIC decides to expose Y's interrupt number first in the Ack
   register
4. The CPU runs the IRQ handler for Y, but the status register is stale

Case 2:
1. CPU takes an IRQ exception as a result of X raising an interrupt
2. CPU reads the interrupt number for X from the Ack register and runs
   its IRQ handler
3. Y raises its interrupt line and the Ack register is updated, but
   again, the update to its system register is not yet visible to the
   CPU.
4. Since the GIC drivers poll the Ack register, we read Y's interrupt
   number and run its handler without a context synchronisation
   operation, therefore seeing the stale register value.

In either case, we run the risk of missing an IRQ. This patch solves the
problem by ensuring that we execute an ISB in the GIC drivers prior
to invoking the interrupt handler.

Based on Linux commit 39a06b67c2c1256bcf2361a1f67d2529f70ab206
"irqchip/gic: Ensure we have an ISB between ack and ->handle_irq".

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Andrii Anisov<andrii_anisov@epam.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
(cherry picked from commit 177afec4556c676e5a1a958d1626226fbca2a696)

6 years agoxen/arm: smccc-1.1: Handle function result as parameters
Marc Zyngier [Tue, 25 Sep 2018 17:20:39 +0000 (18:20 +0100)]
xen/arm: smccc-1.1: Handle function result as parameters

If someone has the silly idea to write something along those lines:

extern u64 foo(void);

void bar(struct arm_smccc_res *res)
{
arm_smccc_1_1_smc(0xbad, foo(), res);
}

they are in for a surprise, as this gets compiled as:

0000000000000588 <bar>:
 588:   a9be7bfd        stp     x29, x30, [sp, #-32]!
 58c:   910003fd        mov     x29, sp
 590:   f9000bf3        str     x19, [sp, #16]
 594:   aa0003f3        mov     x19, x0
 598:   aa1e03e0        mov     x0, x30
 59c:   94000000        bl      0 <_mcount>
 5a0:   94000000        bl      0 <foo>
 5a4:   aa0003e1        mov     x1, x0
 5a8:   d4000003        smc     #0x0
 5ac:   b4000073        cbz     x19, 5b8 <bar+0x30>
 5b0:   a9000660        stp     x0, x1, [x19]
 5b4:   a9010e62        stp     x2, x3, [x19, #16]
 5b8:   f9400bf3        ldr     x19, [sp, #16]
 5bc:   a8c27bfd        ldp     x29, x30, [sp], #32
 5c0:   d65f03c0        ret
 5c4:   d503201f        nop

The call to foo "overwrites" the x0 register for the return value,
and we end up calling the wrong secure service.

A solution is to evaluate all the parameters before assigning
anything to specific registers, leading to the expected result:

0000000000000588 <bar>:
 588:   a9be7bfd        stp     x29, x30, [sp, #-32]!
 58c:   910003fd        mov     x29, sp
 590:   f9000bf3        str     x19, [sp, #16]
 594:   aa0003f3        mov     x19, x0
 598:   aa1e03e0        mov     x0, x30
 59c:   94000000        bl      0 <_mcount>
 5a0:   94000000        bl      0 <foo>
 5a4:   aa0003e1        mov     x1, x0
 5a8:   d28175a0        mov     x0, #0xbad
 5ac:   d4000003        smc     #0x0
 5b0:   b4000073        cbz     x19, 5bc <bar+0x34>
 5b4:   a9000660        stp     x0, x1, [x19]
 5b8:   a9010e62        stp     x2, x3, [x19, #16]
 5bc:   f9400bf3        ldr     x19, [sp, #16]
 5c0:   a8c27bfd        ldp     x29, x30, [sp], #32
 5c4:   d65f03c0        ret

Reported-by: Stefano Stabellini <stefanos@xilinx.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
(cherry picked from commit fa7974f743b2d95af1d0983f86e8be0ed9a9e4be)

6 years agoxen/arm: smccc-1.1: Make return values unsigned long
Marc Zyngier [Tue, 25 Sep 2018 17:20:38 +0000 (18:20 +0100)]
xen/arm: smccc-1.1: Make return values unsigned long

An unfortunate consequence of having a strong typing for the input
values to the SMC call is that it also affects the type of the
return values, limiting r0 to 32 bits and r{1,2,3} to whatever
was passed as an input.

Let's turn everything into "unsigned long", which satisfies the
requirements of both architectures, and allows for the full
range of return values.

Reported-by: Stefano Stabellini <stefanos@xilinx.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
(cherry picked from commit 35fc6086124ffe27d297801616e7ac6dc344040b)

6 years agoUpdate changelog for new upstream 4.11.1
Hans van Kranenburg [Wed, 2 Jan 2019 19:59:40 +0000 (20:59 +0100)]
Update changelog for new upstream 4.11.1

[git-debrebase changelog: new upstream 4.11.1]

6 years agoUpdate to upstream 4.11.1
Hans van Kranenburg [Wed, 2 Jan 2019 19:59:39 +0000 (20:59 +0100)]
Update to upstream 4.11.1

[git-debrebase anchor: new upstream 4.11.1, merge]

6 years agod/changelog: revert closing pygrub bugs
Hans van Kranenburg [Sat, 8 Dec 2018 21:36:59 +0000 (22:36 +0100)]
d/changelog: revert closing pygrub bugs

It appears that the pygrub script itself is still broken because of
import problems with a renamed library. Make sure we're not claiming
that the bugs are solved.

6 years agod/rules: Don't exclude the actual pygrub script
Hans van Kranenburg [Wed, 31 Oct 2018 15:59:12 +0000 (16:59 +0100)]
d/rules: Don't exclude the actual pygrub script

We still want to have `/usr/lib/xen-4.11/bin/pygrub`.

Thanks PryMar56 for quickly pointing out the fix on IRC.

6 years agodebian/changelog: mention closing #865086
Hans van Kranenburg [Fri, 26 Oct 2018 13:00:41 +0000 (15:00 +0200)]
debian/changelog: mention closing #865086

Signed-off-by: Hans van Kranenburg <hans@knorrie.org>
6 years agogrub.d/xen.cfg: fix default entry when using l10n
Hans van Kranenburg [Wed, 20 Dec 2017 10:38:14 +0000 (11:38 +0100)]
grub.d/xen.cfg: fix default entry when using l10n

When a user uses a locale that results in translating menu item titles
into another language than English, the hardcoded "Debian GNU/Linux,
with Xen hypervisor" would not match anything.

So, use gettext to make it match the right translated entry.
Also see
- https://bugs.launchpad.net/ubuntu/+source/xen/+bug/1321144
- https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=865086

Note that (thanks Ian for the info):
* When GRUB_TERMINAL is not empty and set to anything other than
  `gfxterm', grub will not do translation at all, because grub-mkconfig
  thinks that other GRUB_TERMINAL values including `serial' preclude
  non-ASCII characters, and that causes it to set LANG=C. (I have
  GRUB_TERMINAL="serial console", which caused much confusion when
  trying to test all of this).
* Just trying the printf "$(gettext... below is not enough to test if a
  translation shows up. It needs -d grub additionally for gettext, or
  TEXTDOMAIN=grub in the environment, which is probably present when
  this file gets run by update-grub.

Signed-off-by: Hans van Kranenburg <hans@knorrie.org>
6 years agodebian/changelog: start -6 entry
Hans van Kranenburg [Sat, 20 Oct 2018 15:44:31 +0000 (17:44 +0200)]
debian/changelog: start -6 entry

Signed-off-by: Hans van Kranenburg <hans@knorrie.org>
6 years agodebian/control: Add Homepage, Vcs-Browser and Vcs-Git.
Hans van Kranenburg [Sat, 20 Oct 2018 15:44:14 +0000 (17:44 +0200)]
debian/control: Add Homepage, Vcs-Browser and Vcs-Git.

Signed-off-by: Hans van Kranenburg <hans@knorrie.org>
6 years agochangelog: Finalise -5
Ian Jackson [Mon, 15 Oct 2018 17:07:18 +0000 (18:07 +0100)]
changelog: Finalise -5

Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
6 years agodebian/rules: Cope if xen-utils-common not being built
Ian Jackson [Mon, 15 Oct 2018 17:02:51 +0000 (18:02 +0100)]
debian/rules: Cope if xen-utils-common not being built

In a binary-indep build, xen-utils-common is not built so the files
are not installed by dh_install and the directory is missing.

Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
6 years agochangelog: finalise +dfsg-4.
Ian Jackson [Mon, 15 Oct 2018 11:16:15 +0000 (12:16 +0100)]
changelog: finalise +dfsg-4.

Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
6 years agodebian/control: Add pandoc and markdown to b-d
Ian Jackson [Fri, 12 Oct 2018 16:51:44 +0000 (17:51 +0100)]
debian/control: Add pandoc and markdown to b-d

Without these, some documentation is ommitted.

Resulting changes to the binary packages are:
 xen-doc: lots of extra html files in /usr/share/doc/xen/html/
 xen-utils-common: xen-vbd-interface(7)

Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
6 years agodebian/rules: Do not try to move EFI binaries on armhf
Ian Jackson [Fri, 12 Oct 2018 19:46:22 +0000 (20:46 +0100)]
debian/rules: Do not try to move EFI binaries on armhf

Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
6 years agodebian/rules: Use find rather than shell glob for strip
Ian Jackson [Fri, 12 Oct 2018 18:26:16 +0000 (18:26 +0000)]
debian/rules: Use find rather than shell glob for strip

This stops this from falling over on arches without hvmloader.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
6 years agoxen-utils-*.install: Expect shim only on amd64 | i386
Ian Jackson [Fri, 12 Oct 2018 16:24:18 +0000 (16:24 +0000)]
xen-utils-*.install: Expect shim only on amd64 | i386

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
6 years agodebian/shuffle-boot-files: Handle boot/xen as well as boot/xen.gz
Ian Jackson [Fri, 12 Oct 2018 15:36:18 +0000 (15:36 +0000)]
debian/shuffle-boot-files: Handle boot/xen as well as boot/xen.gz

On arm64, at least, the main file is boot/xen, not boot/xen.gz.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
6 years agodbian/rules: Install shim separately
Ian Jackson [Fri, 12 Oct 2018 17:26:46 +0000 (17:26 +0000)]
dbian/rules: Install shim separately

Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
6 years agodebian/rules: Build shim separately
Ian Jackson [Fri, 12 Oct 2018 16:16:12 +0000 (16:16 +0000)]
debian/rules: Build shim separately

So we can control (1) the make arguments including the arch
(2) the other compile flags.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
6 years agodebian/rules: Fix some cases of HOST/BUILD arch confusion
Ian Jackson [Fri, 12 Oct 2018 16:07:05 +0000 (16:07 +0000)]
debian/rules: Fix some cases of HOST/BUILD arch confusion

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
6 years agochangelog: finalise -3.
Ian Jackson [Fri, 12 Oct 2018 15:56:04 +0000 (16:56 +0100)]
changelog: finalise -3.

Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
6 years agodebian/rules: Add a -n to a gzip rune to improve reproducibility
Ian Jackson [Fri, 12 Oct 2018 15:54:50 +0000 (16:54 +0100)]
debian/rules: Add a -n to a gzip rune to improve reproducibility

There's still a lot of unreproducibility here, but this at least is an
easy fix.

Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
6 years agodebian/control: Add missing Replaces on old xen-utils-common
Ian Jackson [Wed, 10 Oct 2018 14:43:49 +0000 (15:43 +0100)]
debian/control: Add missing Replaces on old xen-utils-common

Previously the xenstore utility manpages were erroneously in
xen-utils-common.  We need to declare Replaces so that dpkg lets us
take them over rather than regarding it as a file conflict.

I think we can safely drop the old Conflicts/Replaces from Xen 3.1.0
days.

Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
6 years agodebian/control: Adding Section to source stanza
Ian Jackson [Wed, 10 Oct 2018 14:43:21 +0000 (15:43 +0100)]
debian/control: Adding Section to source stanza

This is recommended by policy, although lintian doesn't mind its
absence.

Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
6 years agohypervisor package postinst: Actually install
Ian Jackson [Wed, 10 Oct 2018 14:42:39 +0000 (15:42 +0100)]
hypervisor package postinst: Actually install

This source template file needs to have .vsn-in at the end of its
filename.

This fixes the bug that one needs to run update-grub by hand.

Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
6 years agoRedo as an upload with binaries
Ian Jackson [Fri, 5 Oct 2018 18:39:06 +0000 (19:39 +0100)]
Redo as an upload with binaries

Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
6 years agochangelog: Incorporate changelog changes from Hans's pre.20180911.
Ian Jackson [Fri, 5 Oct 2018 17:46:32 +0000 (18:46 +0100)]
changelog: Incorporate changelog changes from Hans's pre.20180911.

The changes in Hans's version are all in my tree now: I've rebased
onto his .dfsg upstream tag, and the my own tree already had the
lintian override.

Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
6 years agoupdate Xen version to 4.11.1
Jan Beulich [Thu, 29 Nov 2018 14:04:11 +0000 (15:04 +0100)]
update Xen version to 4.11.1

6 years agox86/dom0: Avoid using 1G superpages if shadowing may be necessary
Andrew Cooper [Tue, 20 Nov 2018 14:35:48 +0000 (15:35 +0100)]
x86/dom0: Avoid using 1G superpages if shadowing may be necessary

The shadow code doesn't support 1G superpages, and will hand #PF[RSVD] back to
guests.

For dom0's with 512GB of RAM or more (and subject to the P2M alignment), Xen's
domain builder might use 1G superpages.

Avoid using 1G superpages (falling back to 2M superpages instead) if there is
a reasonable chance that we may have to shadow dom0.  This assumes that there
are no circumstances where we will activate logdirty mode on dom0.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
master commit: 96f6ee15ad7ca96472779fc5c083b4149495c584
master date: 2018-11-12 11:26:04 +0000