All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/hvm: Disallow unknown MSR_EFER bits
From: Andrew Cooper @ 2018-07-23 13:49 UTC (permalink / raw)
  To: Xen-devel
  Cc: Andrew Cooper, Sergey Dyasli, Wei Liu, Jan Beulich,
	Roger Pau Monné

It turns out that nothing ever prevented HVM guests from trying to set unknown
EFER bits.  Generally, this results in a vmentry failure.

For Intel hardware, all implemented bits are covered by the checks.

For AMD hardware, the only EFER bit which isn't covered by the checks is TCE
(which AFAICT is specific to AMD Fam15/16 hardware).  We never advertise TCE
in CPUID, but it isn't a security problem to have TCE unexpected enabled in
guest context.

Disallow the setting of bits outside of the EFER_KNOWN_MASK, which prevents
any vmentry failures for guests, yielding #GP instead.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Wei Liu <wei.liu2@citrix.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Sergey Dyasli <sergey.dyasli@citrix.com>

Note: On AMD hardware, bits 7:1 are Reserved write-discard rather than
yielding #GP.  Implementing this doesn't seem worthwhile (no software will try
to set these bits, because they are strictly reserved on Intel hardware), and
would require rather more complicated changes to hvm_efer_valid() to feed back
a modified efer value.
---
 xen/arch/x86/hvm/hvm.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 1816faa..c099c61 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -907,6 +907,9 @@ const char *hvm_efer_valid(const struct vcpu *v, uint64_t value,
     else
         p = &host_cpuid_policy;
 
+    if ( value & ~EFER_KNOWN_MASK )
+        return "Unknown bits set";
+
     if ( (value & EFER_SCE) && !p->extd.syscall )
         return "SCE without feature";
 
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related

* [meta-oe] [PATCH 4/7] python-pep8: add native and nativesdk
From: Binghua Guan @ 2018-07-23 13:29 UTC (permalink / raw)
  To: openembedded-devel
In-Reply-To: <20180723132950.4543-1-freebendy@gmail.com>

Signed-off-by: Binghua Guan <freebendy@gmail.com>
---
 meta-python/recipes-devtools/python/python-pep8_1.7.1.bb | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/meta-python/recipes-devtools/python/python-pep8_1.7.1.bb b/meta-python/recipes-devtools/python/python-pep8_1.7.1.bb
index b12d72d38..54ce9781a 100644
--- a/meta-python/recipes-devtools/python/python-pep8_1.7.1.bb
+++ b/meta-python/recipes-devtools/python/python-pep8_1.7.1.bb
@@ -12,3 +12,5 @@ RDEPENDS_${PN} += " \
     python-prettytable \
     python-cmd2 \
     python-pyparsing"
+
+BBCLASSEXTEND = "native nativesdk"
-- 
2.11.0



^ permalink raw reply related

* [meta-oe] [PATCH 3/7] python-pyperclip: add native and nativesdk
From: Binghua Guan @ 2018-07-23 13:29 UTC (permalink / raw)
  To: openembedded-devel
In-Reply-To: <20180723132950.4543-1-freebendy@gmail.com>

Signed-off-by: Binghua Guan <freebendy@gmail.com>
---
 meta-python/recipes-devtools/python/python-pyperclip.inc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/meta-python/recipes-devtools/python/python-pyperclip.inc b/meta-python/recipes-devtools/python/python-pyperclip.inc
index 205038be8..4ee47eef5 100644
--- a/meta-python/recipes-devtools/python/python-pyperclip.inc
+++ b/meta-python/recipes-devtools/python/python-pyperclip.inc
@@ -10,3 +10,5 @@ inherit pypi
 RDEPENDS_${PN} += " \
     ${PYTHON_PN}-ctypes \
 "
+
+BBCLASSEXTEND = "native nativesdk"
-- 
2.11.0



^ permalink raw reply related

* [meta-oe] [PATCH 2/7] python-mccabe: add native and nativesdk
From: Binghua Guan @ 2018-07-23 13:29 UTC (permalink / raw)
  To: openembedded-devel
In-Reply-To: <20180723132950.4543-1-freebendy@gmail.com>

Signed-off-by: Binghua Guan <freebendy@gmail.com>
---
 meta-python/recipes-devtools/python/python-mccabe_0.4.0.bb | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/meta-python/recipes-devtools/python/python-mccabe_0.4.0.bb b/meta-python/recipes-devtools/python/python-mccabe_0.4.0.bb
index a86d15800..6b63cd780 100644
--- a/meta-python/recipes-devtools/python/python-mccabe_0.4.0.bb
+++ b/meta-python/recipes-devtools/python/python-mccabe_0.4.0.bb
@@ -16,3 +16,5 @@ RDEPENDS_${PN} += " \
     python-prettytable \
     python-cmd2 \
     python-pyparsing"
+
+BBCLASSEXTEND = "native nativesdk"
-- 
2.11.0



^ permalink raw reply related

* Re: [PATCH v3 12/13] x86: add iommu_ops to modify and flush IOMMU mappings
From: Wei Liu @ 2018-07-23 13:49 UTC (permalink / raw)
  To: Paul Durrant
  Cc: Stefano Stabellini, Wei Liu, Andrew Cooper, Tim (Xen.org),
	George Dunlap, Julien Grall, Jan Beulich, Ian Jackson,
	xen-devel@lists.xenproject.org
In-Reply-To: <8d2f2f936f834c208b73284b37732291@AMSPEX02CL03.citrite.net>

On Mon, Jul 23, 2018 at 02:40:05PM +0100, Paul Durrant wrote:
> > -----Original Message-----
> > From: Wei Liu [mailto:wei.liu2@citrix.com]
> > Sent: 23 July 2018 14:35
> > To: Paul Durrant <Paul.Durrant@citrix.com>
> > Cc: xen-devel@lists.xenproject.org; Jan Beulich <jbeulich@suse.com>;
> > Andrew Cooper <Andrew.Cooper3@citrix.com>; George Dunlap
> > <George.Dunlap@citrix.com>; Ian Jackson <Ian.Jackson@citrix.com>; Julien
> > Grall <julien.grall@arm.com>; Konrad Rzeszutek Wilk
> > <konrad.wilk@oracle.com>; Stefano Stabellini <sstabellini@kernel.org>; Tim
> > (Xen.org) <tim@xen.org>; Wei Liu <wei.liu2@citrix.com>
> > Subject: Re: [PATCH v3 12/13] x86: add iommu_ops to modify and flush
> > IOMMU mappings
> > 
> > On Tue, Jul 17, 2018 at 02:38:15PM +0100, Paul Durrant wrote:
> > >
> > [...]
> > > +static int iommuop_map(struct xen_iommu_op_map *op)
> > > +{
> > > +    struct domain *d, *currd = current->domain;
> > > +    struct domain_iommu *iommu = dom_iommu(currd);
> > > +    bool readonly = op->flags & XEN_IOMMUOP_map_readonly;
> > > +    bfn_t bfn = _bfn(op->bfn);
> > > +    struct page_info *page;
> > > +    unsigned int prot;
> > > +    int rc, ignore;
> > > +
> > > +    if ( op->pad || (op->flags & ~XEN_IOMMUOP_map_readonly) )
> > > +        return -EINVAL;
> > > +
> > > +    if ( !iommu->iommu_op_ranges )
> > > +        return -EOPNOTSUPP;
> > > +
> > > +    /* Check whether the specified BFN falls in a reserved region */
> > > +    if ( rangeset_contains_singleton(iommu->reserved_ranges,
> > bfn_x(bfn)) )
> > > +        return -EINVAL;
> > > +
> > > +    d = rcu_lock_domain_by_any_id(op->domid);
> > 
> > I think this needs to be moved earlier before dereferencing assigning
> > iommu -- it depends on d being valid.
> > 
> > Same applies to the unmap function.
> > 
> 
> Are you referring to the dom_iommu() macro? The code is uninterested
> in the IOMMU mappings of the target domain, only the current, so I
> can't see a problem here. Am I missing something?

Oh, I misread. Sorry for the noise.

> 
> > > +
> > > +static int iommuop_flush(void)
> > > +{
> > > +    return !iommu_iotlb_flush_all(current->domain) ? 0 : -EIO;
> > 
> > I don't follow: why does this only flush current->domain? But
> > map/unmap use explicit argument to specify a domain?
> > 
> 
> Because the page may come from another domain but the IOMMU mappings
> are only ever for the local domain.

I see. That's fine then.

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply

* [PATCH V2] iputils: upgrade to s20190629
From: Ross Burton @ 2018-07-23 13:48 UTC (permalink / raw)
  To: openembedded-core

License-Update: change license checksums to check the License files themselves (BSD3 and GPL2),
and the tool-to-license file (LICENSE).  Changes to LICENSE will now be
detected.

Drop upstreamed patch.

Update libidn build-dependency to libidn2.

Patch in an install target and use that to install binaries, to avoid upstream
adding binaries that we don't ship.  Also ship all binaries that are installed.

Signed-off-by: Ross Burton <ross.burton@intel.com>
---
 .../iputils/files/0001-Fix-build-on-MUSL.patch     | 95 ----------------------
 .../recipes-extended/iputils/iputils/install.patch | 26 ++++++
 meta/recipes-extended/iputils/iputils_s20161105.bb | 62 --------------
 meta/recipes-extended/iputils/iputils_s20180629.bb | 60 ++++++++++++++
 4 files changed, 86 insertions(+), 157 deletions(-)
 delete mode 100644 meta/recipes-extended/iputils/files/0001-Fix-build-on-MUSL.patch
 create mode 100644 meta/recipes-extended/iputils/iputils/install.patch
 delete mode 100644 meta/recipes-extended/iputils/iputils_s20161105.bb
 create mode 100644 meta/recipes-extended/iputils/iputils_s20180629.bb

diff --git a/meta/recipes-extended/iputils/files/0001-Fix-build-on-MUSL.patch b/meta/recipes-extended/iputils/files/0001-Fix-build-on-MUSL.patch
deleted file mode 100644
index ce8cfebbb03..00000000000
--- a/meta/recipes-extended/iputils/files/0001-Fix-build-on-MUSL.patch
+++ /dev/null
@@ -1,95 +0,0 @@
-From c6c5966d9fae27bc2f0a34ab59b999555111bd2d Mon Sep 17 00:00:00 2001
-From: Aric Belsito <lluixhi@gmail.com>
-Date: Sun, 29 Oct 2017 23:17:03 +0100
-Subject: [PATCH] Fix build on MUSL
-
-Add missing AI_IDN and NI_IDN declarations.
-
-Bug: https://bugs.gentoo.org/503914
-
-Upstream-Status: Pending
-Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
----
- arping.c      |  7 +++++++
- ping.h        | 11 +++++++++++
- tracepath.c   |  8 ++++++++
- traceroute6.c |  4 ++++
- 4 files changed, 30 insertions(+)
-
-diff --git a/arping.c b/arping.c
-index 1a3f40b..531d29d 100644
---- a/arping.c
-+++ b/arping.c
-@@ -45,6 +45,13 @@ struct sysfs_devattr_values;
- #ifdef USE_IDN
- #include <idna.h>
- #include <locale.h>
-+
-+#ifndef AI_IDN
-+#define AI_IDN 0x0040
-+#endif
-+#ifndef AI_CANONIDN
-+#define AI_CANONIDN 0x0080
-+#endif
- #endif
- 
- #include "SNAPSHOT.h"
-diff --git a/ping.h b/ping.h
-index 749f3ff..227315f 100644
---- a/ping.h
-+++ b/ping.h
-@@ -38,6 +38,17 @@
- #include <locale.h>
- #include <idna.h>
- #include <stringprep.h>
-+
-+#ifndef AI_IDN
-+#define AI_IDN 0x0040
-+#endif
-+#ifndef AI_CANONIDN
-+#define AI_CANONIDN 0x0080
-+#endif
-+#ifndef NI_IDN
-+#define NI_IDN 32
-+#endif
-+
- #define getaddrinfo_flags (AI_CANONNAME | AI_IDN | AI_CANONIDN)
- #define getnameinfo_flags NI_IDN
- #else
-diff --git a/tracepath.c b/tracepath.c
-index 74a829d..dcec5b9 100644
---- a/tracepath.c
-+++ b/tracepath.c
-@@ -30,6 +30,14 @@
- #ifdef USE_IDN
- #include <idna.h>
- #include <locale.h>
-+
-+#ifndef AI_IDN
-+#define AI_IDN 0x0040
-+#endif
-+#ifndef NI_IDN
-+#define NI_IDN 32
-+#endif
-+
- #define getnameinfo_flags	NI_IDN
- #else
- #define getnameinfo_flags	0
-diff --git a/traceroute6.c b/traceroute6.c
-index 48fc5c5..8d1eebf 100644
---- a/traceroute6.c
-+++ b/traceroute6.c
-@@ -251,6 +251,10 @@
- #include <idna.h>
- #include <locale.h>
- 
-+#ifndef NI_IDN
-+#define NI_IDN 32
-+#endif
-+
- #define getnameinfo_flags	NI_IDN
- #else
- #define getnameinfo_flags	0
--- 
-2.15.1
-
diff --git a/meta/recipes-extended/iputils/iputils/install.patch b/meta/recipes-extended/iputils/iputils/install.patch
new file mode 100644
index 00000000000..eb295bd5d66
--- /dev/null
+++ b/meta/recipes-extended/iputils/iputils/install.patch
@@ -0,0 +1,26 @@
+Add a simple install rule so that we always install the binaries that were built.
+
+Upstream-Status: Inappropriate
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+
+From e1ca30ef905bd9ee70e328aae0e9c1688b01582f Mon Sep 17 00:00:00 2001
+From: Ross Burton <ross@burtonini.com>
+Date: Mon, 23 Jul 2018 14:21:03 +0100
+Subject: [PATCH] Add install
+
+---
+ Makefile | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/Makefile b/Makefile
+index 17fc5c9..5ae586b 100644
+--- a/Makefile
++++ b/Makefile
+@@ -231,3 +231,7 @@ rpm:
+ 	@$(RPMBUILD) -ta --define 'current yes' $(RPMTMP)/iputils.tar.bz2
+ 	@rm -f $(RPMTMP)/iputils.tar.bz2
+ 
++install:
++	for t in $(TARGETS); do \
++		install -D $$t $(DESTDIR)$(bindir)/$$t; \
++	done
diff --git a/meta/recipes-extended/iputils/iputils_s20161105.bb b/meta/recipes-extended/iputils/iputils_s20161105.bb
deleted file mode 100644
index 0125739b034..00000000000
--- a/meta/recipes-extended/iputils/iputils_s20161105.bb
+++ /dev/null
@@ -1,62 +0,0 @@
-SUMMARY = "Network monitoring tools"
-DESCRIPTION = "Utilities for the IP protocol, including traceroute6, \
-tracepath, tracepath6, ping, ping6 and arping."
-HOMEPAGE = "https://github.com/iputils/iputils"
-SECTION = "console/network"
-
-LICENSE = "BSD & GPLv2+"
-
-LIC_FILES_CHKSUM = "file://ping.c;beginline=1;endline=35;md5=f9ceb201733e9a6cf8f00766dd278d82 \
-                    file://tracepath.c;beginline=1;endline=10;md5=0ecea2bf60bff2f3d840096d87647f3d \
-                    file://arping.c;beginline=1;endline=11;md5=fe84301b5c2655c950f8b92a057fafa6 \
-                    file://tftpd.c;beginline=1;endline=32;md5=28834bf8a91a5b8a92755dbee709ef96 "
-
-DEPENDS = "gnutls libcap libgcrypt"
-
-SRC_URI = "git://github.com/iputils/iputils \
-           file://0001-Fix-build-on-MUSL.patch \
-           "
-S = "${WORKDIR}/git"
-SRCREV = "bffc0e957b98d626ab4cea218c89251201425442"
-
-UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>s\d+)"
-
-EXTRA_OEMAKE = "-e MAKEFLAGS="
-
-PACKAGECONFIG ?= ""
-PACKAGECONFIG[libidn] = "USE_IDN=yes,USE_IDN=no,libidn"
-
-do_compile () {
-	oe_runmake 'CC=${CC} -D_GNU_SOURCE' VPATH="${STAGING_LIBDIR}:${STAGING_DIR_HOST}/${base_libdir}" ${PACKAGECONFIG_CONFARGS} all
-}
-
-do_install () {
-	install -m 0755 -d ${D}${base_bindir}
-	# SUID root programs
-	install -m 4555 ping ${D}${base_bindir}/ping
-	install -m 4555 traceroute6 ${D}${base_bindir}/
-	install -m 4555 clockdiff ${D}${base_bindir}/
-	# Other programgs
-	for i in arping tracepath; do
-	  install -m 0755 $i ${D}${base_bindir}/
-	done
-}
-
-inherit update-alternatives
-
-ALTERNATIVE_PRIORITY = "100"
-
-ALTERNATIVE_${PN}-ping = "ping"
-ALTERNATIVE_LINK_NAME[ping] = "${base_bindir}/ping"
-
-PACKAGES += "${PN}-ping ${PN}-arping ${PN}-tracepath ${PN}-traceroute6 ${PN}-clockdiff"
-
-ALLOW_EMPTY_${PN} = "1"
-RDEPENDS_${PN} += "${PN}-ping ${PN}-arping ${PN}-tracepath ${PN}-traceroute6 ${PN}-clockdiff"
-
-FILES_${PN}	= ""
-FILES_${PN}-ping = "${base_bindir}/ping.${BPN}"
-FILES_${PN}-arping = "${base_bindir}/arping"
-FILES_${PN}-tracepath = "${base_bindir}/tracepath"
-FILES_${PN}-traceroute6	= "${base_bindir}/traceroute6"
-FILES_${PN}-clockdiff = "${base_bindir}/clockdiff"
diff --git a/meta/recipes-extended/iputils/iputils_s20180629.bb b/meta/recipes-extended/iputils/iputils_s20180629.bb
new file mode 100644
index 00000000000..8b75ef6b620
--- /dev/null
+++ b/meta/recipes-extended/iputils/iputils_s20180629.bb
@@ -0,0 +1,60 @@
+SUMMARY = "Network monitoring tools"
+DESCRIPTION = "Utilities for the IP protocol, including traceroute6, \
+tracepath, tracepath6, ping, ping6 and arping."
+HOMEPAGE = "https://github.com/iputils/iputils"
+SECTION = "console/network"
+
+LICENSE = "BSD & GPLv2+"
+
+LIC_FILES_CHKSUM = "file://LICENSE;md5=b792e38abdc59f766a3153908f23e766 \
+                    file://LICENSE.BSD3;md5=0f00d99239d922ffd13cabef83b33444 \
+                    file://LICENSE.GPL2;md5=b234ee4d69f5fce4486a80fdaf4a4263"
+
+DEPENDS = "gnutls libcap libgcrypt"
+
+SRC_URI = "git://github.com/iputils/iputils \
+           file://install.patch"
+SRCREV = "f6aac8dbe3f8c45c53424854a3312bdd8cdd58d3"
+
+S = "${WORKDIR}/git"
+
+UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>s\d+)"
+
+EXTRA_OEMAKE = "-e MAKEFLAGS="
+
+PACKAGECONFIG ??= ""
+PACKAGECONFIG[libidn] = "USE_IDN=yes,USE_IDN=no,libidn2"
+
+do_compile () {
+	oe_runmake 'CC=${CC} -D_GNU_SOURCE' VPATH="${STAGING_LIBDIR}:${STAGING_DIR_HOST}/${base_libdir}" ${PACKAGECONFIG_CONFARGS} all
+}
+
+do_install() {
+	oe_runmake DESTDIR=${D} bindir=${base_bindir} install
+	for b in ping traceroute6 clockdiff; do
+		chmod u+s ${D}${base_bindir}/$b
+	done
+}
+
+inherit update-alternatives
+
+ALTERNATIVE_PRIORITY = "100"
+
+ALTERNATIVE_${PN}-ping = "ping"
+ALTERNATIVE_LINK_NAME[ping] = "${base_bindir}/ping"
+
+SPLITPKGS = "${PN}-ping ${PN}-arping ${PN}-tracepath ${PN}-traceroute6 ${PN}-clockdiff ${PN}-tftpd ${PN}-rarpd ${PN}-rdisc"
+PACKAGES += "${SPLITPKGS}"
+
+ALLOW_EMPTY_${PN} = "1"
+RDEPENDS_${PN} += "${SPLITPKGS}"
+
+FILES_${PN}	= ""
+FILES_${PN}-ping = "${base_bindir}/ping.${BPN}"
+FILES_${PN}-arping = "${base_bindir}/arping"
+FILES_${PN}-tracepath = "${base_bindir}/tracepath"
+FILES_${PN}-traceroute6	= "${base_bindir}/traceroute6"
+FILES_${PN}-clockdiff = "${base_bindir}/clockdiff"
+FILES_${PN}-tftpd = "${base_bindir}/tftpd"
+FILES_${PN}-rarpd = "${base_bindir}/rarpd"
+FILES_${PN}-rdisc = "${base_bindir}/rdisc"
-- 
2.11.0



^ permalink raw reply related

* Re: [Qemu-devel] [Qemu-stable] [PATCH v4] block: fix QEMU crash with scsi-hd and drive_del
From: Kevin Wolf @ 2018-07-23 13:48 UTC (permalink / raw)
  To: Michael Roth
  Cc: Greg Kurz, qemu-block, qemu-stable, qemu-devel, Stefan Hajnoczi,
	Paolo Bonzini, Max Reitz
In-Reply-To: <153194807266.31213.16487908209652714185@sif>

Am 18.07.2018 um 23:07 hat Michael Roth geschrieben:
> Quoting Kevin Wolf (2018-05-29 15:19:17)
> > Am 28.05.2018 um 14:03 hat Greg Kurz geschrieben:
> > > Removing a drive with drive_del while it is being used to run an I/O
> > > intensive workload can cause QEMU to crash.
> > > 
> > > An AIO flush can yield at some point:
> > > 
> > > blk_aio_flush_entry()
> > >  blk_co_flush(blk)
> > >   bdrv_co_flush(blk->root->bs)
> > >    ...
> > >     qemu_coroutine_yield()
> > > 
> > > and let the HMP command to run, free blk->root and give control
> > > back to the AIO flush:
> > > 
> > >     hmp_drive_del()
> > >      blk_remove_bs()
> > >       bdrv_root_unref_child(blk->root)
> > >        child_bs = blk->root->bs
> > >        bdrv_detach_child(blk->root)
> > >         bdrv_replace_child(blk->root, NULL)
> > >          blk->root->bs = NULL
> > >         g_free(blk->root) <============== blk->root becomes stale
> > >        bdrv_unref(child_bs)
> > >         bdrv_delete(child_bs)
> > >          bdrv_close()
> > >           bdrv_drained_begin()
> > >            bdrv_do_drained_begin()
> > >             bdrv_drain_recurse()
> > >              aio_poll()
> > >               ...
> > >               qemu_coroutine_switch()
> > > 
> > > and the AIO flush completion ends up dereferencing blk->root:
> > > 
> > >   blk_aio_complete()
> > >    scsi_aio_complete()
> > >     blk_get_aio_context(blk)
> > >      bs = blk_bs(blk)
> > >  ie, bs = blk->root ? blk->root->bs : NULL
> > >             ^^^^^
> > >             stale
> > > 
> > > The problem is that we should avoid making block driver graph
> > > changes while we have in-flight requests. Let's drain all I/O
> > > for this BB before calling bdrv_root_unref_child().
> > > 
> > > Signed-off-by: Greg Kurz <groug@kaod.org>
> > 
> > Hmm... It sounded convincing, but 'make check-tests/test-replication'
> > fails now. The good news is that with the drain fixes, for which I sent
> > v2 today, it passes, so instead of staging it in my block branch, I'll
> > put it at the end of my branch for the drain fixes.
> > 
> > Might take a bit longer than planned until it's in master, sorry.
> 
> I'm getting the below test-replication failure/trace trying to backport
> this patch for 2.12.1 (using this tree:
> https://github.com/mdroth/qemu/commits/stable-2.12-staging-f45280cbf)
> 
> Is this the same issue you saw, and if so, are the drain fixes
> appropriate for 2.12.x? Are there other prereqs/follow-ups you're
> aware of that would also be needed?

I'm not completely sure any more, but yes, I think this might have been
the one. My rework of the bdrv_drain_*() functions fixed quite a few
bugs, including this one, but the work done since 2.12 is two rather
long and quite intrusive series, so I'm not sure if backporting them for
2.12.1 is a good idea.

Kevin

^ permalink raw reply

* Re: [PATCH net-next] selftests: forwarding: gre_multipath: Drop IPv6 tests
From: David Ahern @ 2018-07-23 12:47 UTC (permalink / raw)
  To: Petr Machata, netdev, linux-kselftest; +Cc: davem, shuah, idosch
In-Reply-To: <cf0e380baf6a6aa5cf384017e8d69fec79750cfe.1532341813.git.petrm@mellanox.com>

On 7/23/18 4:33 AM, Petr Machata wrote:
> Support for device-only IPv6 multipath next hops was dropped in
> commit 33bd5ac54dc4 ("net/ipv6: Revert attempt to simplify route replace
> and append") and as of commit b5d2d75e079a ("net/ipv6: Do not allow
> device only routes via the multipath API"), attempts to add a next hop
> like that yield an explicit diagnostic.
> 
> Correspondingly, drop the IPv6 parts of GRE multipath test that are
> supposed to test that code.
> 
> Signed-off-by: Petr Machata <petrm@mellanox.com>
> ---
>  .../selftests/net/forwarding/gre_multipath.sh      | 113 ++-------------------
>  1 file changed, 6 insertions(+), 107 deletions(-)

Reviewed-by: David Ahern <dsahern@gmail.com>

Thanks for following up.

^ permalink raw reply

* Re: INFO: task hung in fuse_reverse_inval_entry
From: Dmitry Vyukov @ 2018-07-23 12:46 UTC (permalink / raw)
  To: Miklos Szeredi; +Cc: linux-fsdevel, LKML, syzkaller-bugs, syzbot
In-Reply-To: <CAJfpegs0by5OJ7iqtg6L3T1w2RrFRiU6yRufVNbt=tNpJCbf2A@mail.gmail.com>

On Mon, Jul 23, 2018 at 2:33 PM, Miklos Szeredi <miklos@szeredi.hu> wrote:
>>>> On Mon, Jul 23, 2018 at 9:59 AM, syzbot
>>>> <syzbot+bb6d800770577a083f8c@syzkaller.appspotmail.com> wrote:
>>>>> Hello,
>>>>>
>>>>> syzbot found the following crash on:
>>>>>
>>>>> HEAD commit:    d72e90f33aa4 Linux 4.18-rc6
>>>>> git tree:       upstream
>>>>> console output: https://syzkaller.appspot.com/x/log.txt?x=1324f794400000
>>>>> kernel config:  https://syzkaller.appspot.com/x/.config?x=68af3495408deac5
>>>>> dashboard link: https://syzkaller.appspot.com/bug?extid=bb6d800770577a083f8c
>>>>> compiler:       gcc (GCC) 8.0.1 20180413 (experimental)
>>>>> syzkaller repro:https://syzkaller.appspot.com/x/repro.syz?x=11564d1c400000
>>>>> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=16fc570c400000
>>>>
>>>>
>>>> Hi fuse maintainers,
>>>>
>>>> We are seeing a bunch of such deadlocks in fuse on syzbot. As far as I
>>>> understand this is mostly working-as-intended (parts about deadlocks
>>>> in Documentation/filesystems/fuse.txt). The intended way to resolve
>>>> this is aborting connections via fusectl, right?
>>>
>>> Yes.  Alternative is with "umount -f".
>>>
>>>> The doc says "Under
>>>> the fuse control filesystem each connection has a directory named by a
>>>> unique number". The question is: if I start a process and this process
>>>> can mount fuse, how do I kill it? I mean: totally and certainly get
>>>> rid of it right away? How do I find these unique numbers for the
>>>> mounts it created?
>>>
>>> It is the device number found in st_dev for the mount.  Other than
>>> doing stat(2) it is possible to find out the device number by reading
>>> /proc/$PID/mountinfo  (third field).
>>
>> Thanks. I will try to figure out fusectl connection numbers and see if
>> it's possible to integrate aborting into syzkaller.
>>
>>>> Taking into account that there is usually no
>>>> operator attached to each server, I wonder if kernel could somehow
>>>> auto-abort fuse on kill?
>>>
>>> Depends on what the fuse server is sleeping on.   If it's trying to
>>> acquire an inode lock (e.g. unlink(2)), which is classical way to
>>> deadlock a fuse filesystem, then it will go into an uninterruptible
>>> sleep.  There's no way in which that process can be killed except to
>>> force a release of the offending lock, which can only be done by
>>> aborting the request that is being performed while holding that lock.
>>
>> I understand that it is not killed today, but I am asking if we can
>> make it killable. It's all code that we can change, and if a human
>> operator can do it, it can be done pure programmatically on kill too,
>> right?
>
> Hmm, you mean if a process is in an uninterruptible sleep trying to
> acquire a lock on a fuse filesystem and is killed, then the fuse
> filesystem should be aborted?
>
> Even if we'd manage to implement that, it's a large backward
> incompatibility risk.
>
> I don't argue that it can be done, but I would definitely argue *if*
> it should be done.


I understand that we should abort only if we are sure that it's
actually deadlocked and there is no other way.
So if fuse-user process is blocked on fuse lock, then we probably
should do nothing. However, if the fuse-server is killed, then perhaps
we could abort the connection at that point. Namely, if a process that
has a fuse fd open is killed and it is the only process that shared
this fd, then we could abort the connection on arrival of the kill
signal (rather than wait untill all it's threads finish and then start
closing all fd's, this is where we get the deadlock -- some of its
threads won't finish). I don't know if such synchronous kill hook is
available, though. If several processes shared the same fuse fd, then
we could close the fd in each process on SIGKILL arrival, then when
all of these processes are killed, fuse fd will be closed and we can
abort the connection, which will un-deadlock all of these processes.
Does this look any reasonable?

^ permalink raw reply

* [PATCH v4] x86/mm: Add mem access rights to NPT
From: Alexandru Isaila @ 2018-07-23 13:48 UTC (permalink / raw)
  To: xen-devel
  Cc: tamas, rcojocaru, george.dunlap, andrew.cooper3, jbeulich,
	Isaila Alexandru

From: Isaila Alexandru <aisaila@bitdefender.com>

This patch adds access control for NPT mode.

There aren’t enough extra bits to store the access rights in the NPT p2m
table, so we add a radix tree to store the rights.  For efficiency,
remove entries which match the default permissions rather than
continuing to store them.

Modify p2m-pt.c:p2m_type_to_flags() to mirror the ept version: taking an
access, and removing / adding RW or NX flags as appropriate.

Note: It was tested with xen-access write

Signed-off-by: Alexandru Isaila <aisaila@bitdefender.com>

---
Changes since V3:
	- Add p2m_pt_check_access() to filter n, w, wx, n2rwx from
	  supported page rights
	- Add rights check for the default_access change in the
	  IVALID_GFN case
	- Add blank lines
	- Remove cpu_has_svm if from p2m_mem_access_check()
	- Add xfree(msr_bitmap) in case of error on
	  xalloc(raxid_tree_root).
---
 xen/arch/x86/mm/mem_access.c     |  17 +++---
 xen/arch/x86/mm/p2m-ept.c        |   7 +++
 xen/arch/x86/mm/p2m-pt.c         | 124 ++++++++++++++++++++++++++++++++++-----
 xen/arch/x86/mm/p2m.c            |   6 ++
 xen/arch/x86/monitor.c           |  15 +++++
 xen/include/asm-x86/mem_access.h |   2 +-
 xen/include/asm-x86/p2m.h        |   7 +++
 7 files changed, 156 insertions(+), 22 deletions(-)

diff --git a/xen/arch/x86/mm/mem_access.c b/xen/arch/x86/mm/mem_access.c
index c0cd017..cab72bc 100644
--- a/xen/arch/x86/mm/mem_access.c
+++ b/xen/arch/x86/mm/mem_access.c
@@ -221,12 +221,12 @@ bool p2m_mem_access_check(paddr_t gpa, unsigned long gla,
         {
             req->u.mem_access.flags |= MEM_ACCESS_GLA_VALID;
             req->u.mem_access.gla = gla;
-
-            if ( npfec.kind == npfec_kind_with_gla )
-                req->u.mem_access.flags |= MEM_ACCESS_FAULT_WITH_GLA;
-            else if ( npfec.kind == npfec_kind_in_gpt )
-                req->u.mem_access.flags |= MEM_ACCESS_FAULT_IN_GPT;
         }
+
+        if ( npfec.kind == npfec_kind_with_gla )
+            req->u.mem_access.flags |= MEM_ACCESS_FAULT_WITH_GLA;
+        else if ( npfec.kind == npfec_kind_in_gpt )
+            req->u.mem_access.flags |= MEM_ACCESS_FAULT_IN_GPT;
         req->u.mem_access.flags |= npfec.read_access    ? MEM_ACCESS_R : 0;
         req->u.mem_access.flags |= npfec.write_access   ? MEM_ACCESS_W : 0;
         req->u.mem_access.flags |= npfec.insn_fetch     ? MEM_ACCESS_X : 0;
@@ -366,8 +366,11 @@ long p2m_set_mem_access(struct domain *d, gfn_t gfn, uint32_t nr,
     /* If request to set default access. */
     if ( gfn_eq(gfn, INVALID_GFN) )
     {
-        p2m->default_access = a;
-        return 0;
+        if ( (rc = p2m->check_access(a)) == 0 )
+        {
+            p2m->default_access = a;
+            return 0;
+        }
     }
 
     p2m_lock(p2m);
diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index 14b5939..de26aa1 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -667,6 +667,12 @@ bool_t ept_handle_misconfig(uint64_t gpa)
     return spurious ? (rc >= 0) : (rc > 0);
 }
 
+int ept_check_access(p2m_access_t p2ma)
+{
+    /* All access is permitted */
+    return 0;
+}
+
 /*
  * ept_set_entry() computes 'need_modify_vtd_table' for itself,
  * by observing whether any gfn->mfn translations are modified.
@@ -1255,6 +1261,7 @@ int ept_p2m_init(struct p2m_domain *p2m)
     p2m->change_entry_type_global = ept_change_entry_type_global;
     p2m->change_entry_type_range = ept_change_entry_type_range;
     p2m->memory_type_changed = ept_memory_type_changed;
+    p2m->check_access = ept_check_access;
     p2m->audit_p2m = NULL;
     p2m->tlb_flush = ept_tlb_flush;
 
diff --git a/xen/arch/x86/mm/p2m-pt.c b/xen/arch/x86/mm/p2m-pt.c
index b8c5d2e..951cbe5 100644
--- a/xen/arch/x86/mm/p2m-pt.c
+++ b/xen/arch/x86/mm/p2m-pt.c
@@ -68,7 +68,8 @@
 static unsigned long p2m_type_to_flags(const struct p2m_domain *p2m,
                                        p2m_type_t t,
                                        mfn_t mfn,
-                                       unsigned int level)
+                                       unsigned int level,
+                                       p2m_access_t access)
 {
     unsigned long flags;
     /*
@@ -87,23 +88,27 @@ static unsigned long p2m_type_to_flags(const struct p2m_domain *p2m,
     case p2m_ram_paged:
     case p2m_ram_paging_in:
     default:
-        return flags | _PAGE_NX_BIT;
+        flags |= P2M_BASE_FLAGS | _PAGE_NX_BIT;
+        break;
     case p2m_grant_map_ro:
         return flags | P2M_BASE_FLAGS | _PAGE_NX_BIT;
     case p2m_ioreq_server:
         flags |= P2M_BASE_FLAGS | _PAGE_RW | _PAGE_NX_BIT;
         if ( p2m->ioreq.flags & XEN_DMOP_IOREQ_MEM_ACCESS_WRITE )
-            return flags & ~_PAGE_RW;
-        return flags;
+            flags &= ~_PAGE_RW;
+        break;
     case p2m_ram_ro:
     case p2m_ram_logdirty:
     case p2m_ram_shared:
-        return flags | P2M_BASE_FLAGS;
+        flags |= P2M_BASE_FLAGS;
+        break;
     case p2m_ram_rw:
-        return flags | P2M_BASE_FLAGS | _PAGE_RW;
+        flags |= P2M_BASE_FLAGS | _PAGE_RW;
+        break;
     case p2m_grant_map_rw:
     case p2m_map_foreign:
-        return flags | P2M_BASE_FLAGS | _PAGE_RW | _PAGE_NX_BIT;
+        flags |= P2M_BASE_FLAGS | _PAGE_RW | _PAGE_NX_BIT;
+        break;
     case p2m_mmio_direct:
         if ( !rangeset_contains_singleton(mmio_ro_ranges, mfn_x(mfn)) )
             flags |= _PAGE_RW;
@@ -112,8 +117,32 @@ static unsigned long p2m_type_to_flags(const struct p2m_domain *p2m,
             flags |= _PAGE_PWT;
             ASSERT(!level);
         }
-        return flags | P2M_BASE_FLAGS | _PAGE_PCD;
+        flags |= P2M_BASE_FLAGS | _PAGE_PCD;
+        break;
+    }
+
+    switch ( access )
+    {
+    case p2m_access_r:
+        flags |= _PAGE_NX_BIT;
+        flags &= ~_PAGE_RW;
+        break;
+    case p2m_access_rw:
+        flags |= _PAGE_NX_BIT;
+        break;
+    case p2m_access_rx:
+    case p2m_access_rx2rw:
+        flags &= ~(_PAGE_NX_BIT | _PAGE_RW);
+        break;
+    case p2m_access_x:
+        flags &= ~_PAGE_RW;
+        break;
+    case p2m_access_rwx:
+    default:
+        break;
     }
+
+    return flags;
 }
 
 
@@ -174,6 +203,44 @@ static void p2m_add_iommu_flags(l1_pgentry_t *p2m_entry,
         l1e_add_flags(*p2m_entry, iommu_nlevel_to_flags(nlevel, flags));
 }
 
+static p2m_access_t p2m_get_access(struct p2m_domain *p2m, unsigned long gfn)
+{
+    void *ptr;
+
+    if ( !p2m->mem_access_settings )
+        return p2m_access_rwx;
+
+    ptr = radix_tree_lookup(p2m->mem_access_settings, gfn);
+    if ( !ptr )
+        return p2m_access_rwx;
+    else
+        return radix_tree_ptr_to_int(ptr);
+}
+
+static void p2m_set_access(struct p2m_domain *p2m, unsigned long gfn,
+                                      p2m_access_t a)
+{
+    int rc;
+
+    if ( !p2m->mem_access_settings )
+        return;
+
+    if ( p2m_access_rwx == a )
+    {
+        radix_tree_delete(p2m->mem_access_settings, gfn);
+        return;
+    }
+
+    rc = radix_tree_insert(p2m->mem_access_settings, gfn,
+                           radix_tree_int_to_ptr(a));
+    if ( rc == -EEXIST )
+        /* If a setting already exists, change it to the new one. */
+        radix_tree_replace_slot(
+            radix_tree_lookup_slot(
+                p2m->mem_access_settings, gfn),
+            radix_tree_int_to_ptr(a));
+}
+
 /* Returns: 0 for success, -errno for failure */
 static int
 p2m_next_level(struct p2m_domain *p2m, void **table,
@@ -201,6 +268,7 @@ p2m_next_level(struct p2m_domain *p2m, void **table,
         new_entry = l1e_from_mfn(mfn, P2M_BASE_FLAGS | _PAGE_RW);
 
         p2m_add_iommu_flags(&new_entry, level, IOMMUF_readable|IOMMUF_writable);
+        p2m_set_access(p2m, gfn, p2m->default_access);
         p2m->write_p2m_entry(p2m, gfn, p2m_entry, new_entry, level + 1);
     }
     else if ( flags & _PAGE_PSE )
@@ -249,6 +317,7 @@ p2m_next_level(struct p2m_domain *p2m, void **table,
         {
             new_entry = l1e_from_pfn(pfn | (i << ((level - 1) * PAGETABLE_ORDER)),
                                      flags);
+            p2m_set_access(p2m, gfn, p2m->default_access);
             p2m->write_p2m_entry(p2m, gfn, l1_entry + i, new_entry, level);
         }
 
@@ -256,6 +325,7 @@ p2m_next_level(struct p2m_domain *p2m, void **table,
 
         new_entry = l1e_from_mfn(mfn, P2M_BASE_FLAGS | _PAGE_RW);
         p2m_add_iommu_flags(&new_entry, level, IOMMUF_readable|IOMMUF_writable);
+        p2m_set_access(p2m, gfn, p2m->default_access);
         p2m->write_p2m_entry(p2m, gfn, p2m_entry, new_entry, level + 1);
     }
     else
@@ -420,8 +490,9 @@ static int do_recalc(struct p2m_domain *p2m, unsigned long gfn)
         if ( nt != ot )
         {
             unsigned long mfn = l1e_get_pfn(e);
+            p2m_access_t a = p2m_get_access(p2m, gfn);
             unsigned long flags = p2m_type_to_flags(p2m, nt,
-                                                    _mfn(mfn), level);
+                                                    _mfn(mfn), level, a);
 
             if ( level )
             {
@@ -472,6 +543,22 @@ int p2m_pt_handle_deferred_changes(uint64_t gpa)
 }
 
 /* Returns: 0 for success, -errno for failure */
+static int p2m_pt_check_access(p2m_access_t p2ma)
+{
+    switch ( p2ma )
+    {
+    case p2m_access_n:
+    case p2m_access_w:
+    case p2m_access_wx:
+    case p2m_access_n2rwx:
+        return -EINVAL;
+    default:
+        break;
+    }
+    return 0;
+}
+
+/* Returns: 0 for success, -errno for failure */
 static int
 p2m_pt_set_entry(struct p2m_domain *p2m, gfn_t gfn_, mfn_t mfn,
                  unsigned int page_order, p2m_type_t p2mt, p2m_access_t p2ma,
@@ -503,6 +590,9 @@ p2m_pt_set_entry(struct p2m_domain *p2m, gfn_t gfn_, mfn_t mfn,
 
     ASSERT(sve != 0);
 
+    if ( (rc = p2m_pt_check_access(p2ma)) != 0 )
+        return rc;
+
     if ( tb_init_done )
     {
         struct {
@@ -569,13 +659,14 @@ p2m_pt_set_entry(struct p2m_domain *p2m, gfn_t gfn_, mfn_t mfn,
         ASSERT(!mfn_valid(mfn) || p2mt != p2m_mmio_direct);
         l3e_content = mfn_valid(mfn) || p2m_allows_invalid_mfn(p2mt)
             ? p2m_l3e_from_pfn(mfn_x(mfn),
-                               p2m_type_to_flags(p2m, p2mt, mfn, 2))
+                               p2m_type_to_flags(p2m, p2mt, mfn, 2, p2ma))
             : l3e_empty();
         entry_content.l1 = l3e_content.l3;
 
         if ( entry_content.l1 != 0 )
             p2m_add_iommu_flags(&entry_content, 0, iommu_pte_flags);
 
+        p2m_set_access(p2m, gfn, p2ma);
         p2m->write_p2m_entry(p2m, gfn, p2m_entry, entry_content, 3);
         /* NB: paging_write_p2m_entry() handles tlb flushes properly */
     }
@@ -608,7 +699,7 @@ p2m_pt_set_entry(struct p2m_domain *p2m, gfn_t gfn_, mfn_t mfn,
 
         if ( mfn_valid(mfn) || p2m_allows_invalid_mfn(p2mt) )
             entry_content = p2m_l1e_from_pfn(mfn_x(mfn),
-                                         p2m_type_to_flags(p2m, p2mt, mfn, 0));
+                                         p2m_type_to_flags(p2m, p2mt, mfn, 0, p2ma));
         else
             entry_content = l1e_empty();
 
@@ -630,6 +721,7 @@ p2m_pt_set_entry(struct p2m_domain *p2m, gfn_t gfn_, mfn_t mfn,
             p2m->ioreq.entry_count--;
         }
 
+        p2m_set_access(p2m, gfn, p2ma);
         /* level 1 entry */
         p2m->write_p2m_entry(p2m, gfn, p2m_entry, entry_content, 1);
         /* NB: paging_write_p2m_entry() handles tlb flushes properly */
@@ -661,13 +753,14 @@ p2m_pt_set_entry(struct p2m_domain *p2m, gfn_t gfn_, mfn_t mfn,
         ASSERT(!mfn_valid(mfn) || p2mt != p2m_mmio_direct);
         l2e_content = mfn_valid(mfn) || p2m_allows_invalid_mfn(p2mt)
             ? p2m_l2e_from_pfn(mfn_x(mfn),
-                               p2m_type_to_flags(p2m, p2mt, mfn, 1))
+                               p2m_type_to_flags(p2m, p2mt, mfn, 1, p2ma))
             : l2e_empty();
         entry_content.l1 = l2e_content.l2;
 
         if ( entry_content.l1 != 0 )
             p2m_add_iommu_flags(&entry_content, 0, iommu_pte_flags);
 
+        p2m_set_access(p2m, gfn, p2ma);
         p2m->write_p2m_entry(p2m, gfn, p2m_entry, entry_content, 2);
         /* NB: paging_write_p2m_entry() handles tlb flushes properly */
     }
@@ -749,8 +842,7 @@ p2m_pt_get_entry(struct p2m_domain *p2m, gfn_t gfn_,
      * XXX Once we start explicitly registering MMIO regions in the p2m 
      * XXX we will return p2m_invalid for unmapped gfns */
     *t = p2m_mmio_dm;
-    /* Not implemented except with EPT */
-    *a = p2m_access_rwx; 
+    *a = p2m_access_n;
 
     if ( gfn > p2m->max_mapped_pfn )
     {
@@ -813,6 +905,7 @@ pod_retry_l3:
                        l1_table_offset(addr));
             *t = p2m_recalc_type(recalc || _needs_recalc(flags),
                                  p2m_flags_to_type(flags), p2m, gfn);
+            *a = p2m_get_access(p2m, gfn);
             unmap_domain_page(l3e);
 
             ASSERT(mfn_valid(mfn) || !p2m_is_ram(*t));
@@ -852,6 +945,7 @@ pod_retry_l2:
         mfn = _mfn(l2e_get_pfn(*l2e) + l1_table_offset(addr));
         *t = p2m_recalc_type(recalc || _needs_recalc(flags),
                              p2m_flags_to_type(flags), p2m, gfn);
+        *a = p2m_get_access(p2m, gfn);
         unmap_domain_page(l2e);
         
         ASSERT(mfn_valid(mfn) || !p2m_is_ram(*t));
@@ -888,6 +982,7 @@ pod_retry_l1:
     }
     mfn = l1e_get_mfn(*l1e);
     *t = p2m_recalc_type(recalc || _needs_recalc(flags), l1t, p2m, gfn);
+    *a = p2m_get_access(p2m, gfn);
     unmap_domain_page(l1e);
 
     ASSERT(mfn_valid(mfn) || !p2m_is_ram(*t) || p2m_is_paging(*t));
@@ -1127,6 +1222,7 @@ void p2m_pt_init(struct p2m_domain *p2m)
     p2m->change_entry_type_global = p2m_pt_change_entry_type_global;
     p2m->change_entry_type_range = p2m_pt_change_entry_type_range;
     p2m->write_p2m_entry = paging_write_p2m_entry;
+    p2m->check_access = p2m_pt_check_access;
 #if P2M_AUDIT
     p2m->audit_p2m = p2m_pt_audit_p2m;
 #else
diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index c53cab4..12e2d24 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -675,6 +675,12 @@ void p2m_teardown(struct p2m_domain *p2m)
 
     d = p2m->domain;
 
+    if ( p2m->mem_access_settings )
+    {
+        radix_tree_destroy(p2m->mem_access_settings, NULL);
+        xfree(p2m->mem_access_settings);
+    }
+
     p2m_lock(p2m);
     ASSERT(atomic_read(&d->shr_pages) == 0);
     p2m->phys_table = pagetable_null();
diff --git a/xen/arch/x86/monitor.c b/xen/arch/x86/monitor.c
index 3fb6531..b871411 100644
--- a/xen/arch/x86/monitor.c
+++ b/xen/arch/x86/monitor.c
@@ -20,10 +20,13 @@
  */
 
 #include <asm/monitor.h>
+#include <asm/p2m.h>
 #include <public/vm_event.h>
 
 int arch_monitor_init_domain(struct domain *d)
 {
+    struct p2m_domain *p2m = p2m_get_hostp2m(d);
+
     if ( !d->arch.monitor.msr_bitmap )
         d->arch.monitor.msr_bitmap = xzalloc_array(struct monitor_msr_bitmap,
                                                    2);
@@ -31,6 +34,18 @@ int arch_monitor_init_domain(struct domain *d)
     if ( !d->arch.monitor.msr_bitmap )
         return -ENOMEM;
 
+    if ( cpu_has_svm && !p2m->mem_access_settings )
+    {
+        p2m->mem_access_settings = xmalloc(struct radix_tree_root);
+
+        if( !p2m->mem_access_settings )
+        {
+            xfree(d->arch.monitor.msr_bitmap);
+            return -ENOMEM;
+        }
+        radix_tree_init(p2m->mem_access_settings);
+    }
+
     return 0;
 }
 
diff --git a/xen/include/asm-x86/mem_access.h b/xen/include/asm-x86/mem_access.h
index 4043c9f..34f2c07 100644
--- a/xen/include/asm-x86/mem_access.h
+++ b/xen/include/asm-x86/mem_access.h
@@ -46,7 +46,7 @@ bool p2m_mem_access_emulate_check(struct vcpu *v,
 /* Sanity check for mem_access hardware support */
 static inline bool p2m_mem_access_sanity_check(struct domain *d)
 {
-    return is_hvm_domain(d) && cpu_has_vmx && hap_enabled(d);
+    return is_hvm_domain(d) && hap_enabled(d);
 }
 
 #endif /*__ASM_X86_MEM_ACCESS_H__ */
diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h
index d4b3cfc..a190151 100644
--- a/xen/include/asm-x86/p2m.h
+++ b/xen/include/asm-x86/p2m.h
@@ -266,6 +266,7 @@ struct p2m_domain {
                                           unsigned long gfn, l1_pgentry_t *p,
                                           l1_pgentry_t new, unsigned int level);
     long               (*audit_p2m)(struct p2m_domain *p2m);
+    int                (*check_access)(p2m_access_t p2ma);
 
     /*
      * P2M updates may require TLBs to be flushed (invalidated).
@@ -288,6 +289,12 @@ struct p2m_domain {
      * retyped get this access type.  See definition of p2m_access_t. */
     p2m_access_t default_access;
 
+    /*
+     * Radix tree to store the p2m_access_t settings as the pte's don't have
+     * enough available bits to store this information.
+     */
+    struct radix_tree_root *mem_access_settings;
+
     /* If true, and an access fault comes in and there is no vm_event listener, 
      * pause domain.  Otherwise, remove access restrictions. */
     bool_t       access_required;
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related

* [PATCH] x86/spec-ctrl: Fix the parsing of xpti= on fixed Intel hardware
From: Andrew Cooper @ 2018-07-23 13:48 UTC (permalink / raw)
  To: Xen-devel
  Cc: Juergen Gross, Sergey Dyasli, Wei Liu, Andrew Cooper, Jan Beulich,
	Roger Pau Monné

The calls to xpti_init_default() in parse_xpti() are buggy.  The CPUID data
hasn't been fetched that early, and boot_cpu_has(X86_FEATURE_ARCH_CAPS) will
always evaluate false.

As a result, the default case won't disable XPTI on Intel hardware which
advertises ARCH_CAPABILITIES_RDCL_NO.

Simplify parse_xpti() to solely the setting of opt_xpti according to the
passed string, and have init_speculation_mitigations() call
xpti_init_default() if appropiate.  Drop the force parameter, and pass caps
instead, to avoid redundant re-reading of MSR_ARCH_CAPS.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Juergen Gross <jgross@suse.com>
CC: Wei Liu <wei.liu2@citrix.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Sergey Dyasli <sergey.dyasli@citrix.com>
---
 xen/arch/x86/spec_ctrl.c | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 73dc717..32a4ea6 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -423,17 +423,10 @@ static bool __init should_use_eager_fpu(void)
 #define OPT_XPTI_DEFAULT  0xff
 uint8_t __read_mostly opt_xpti = OPT_XPTI_DEFAULT;
 
-static __init void xpti_init_default(bool force)
+static __init void xpti_init_default(uint64_t caps)
 {
-    uint64_t caps = 0;
-
-    if ( !force && (opt_xpti != OPT_XPTI_DEFAULT) )
-        return;
-
     if ( boot_cpu_data.x86_vendor == X86_VENDOR_AMD )
         caps = ARCH_CAPABILITIES_RDCL_NO;
-    else if ( boot_cpu_has(X86_FEATURE_ARCH_CAPS) )
-        rdmsrl(MSR_ARCH_CAPABILITIES, caps);
 
     if ( caps & ARCH_CAPABILITIES_RDCL_NO )
         opt_xpti = 0;
@@ -446,8 +439,6 @@ static __init int parse_xpti(const char *s)
     const char *ss;
     int val, rc = 0;
 
-    xpti_init_default(false);
-
     do {
         ss = strchr(s, ',');
         if ( !ss )
@@ -465,7 +456,7 @@ static __init int parse_xpti(const char *s)
 
         default:
             if ( !strcmp(s, "default") )
-                xpti_init_default(true);
+                opt_xpti = OPT_XPTI_DEFAULT;
             else if ( (val = parse_boolean("dom0", s, ss)) >= 0 )
                 opt_xpti = (opt_xpti & ~OPT_XPTI_DOM0) |
                            (val ? OPT_XPTI_DOM0 : 0);
@@ -627,7 +618,9 @@ void __init init_speculation_mitigations(void)
     if ( default_xen_spec_ctrl )
         setup_force_cpu_cap(X86_FEATURE_SC_MSR_IDLE);
 
-    xpti_init_default(false);
+    if ( opt_xpti == OPT_XPTI_DEFAULT )
+        xpti_init_default(caps);
+
     if ( opt_xpti == 0 )
         setup_force_cpu_cap(X86_FEATURE_NO_XPTI);
     else
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related

* Re: [PATCH] arch/sh: use slow path for get_user_pages_fast() on SMP
From: Thomas Petazzoni @ 2018-07-23 13:46 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: Yoshinori Sato, Rich Felker, linux-sh, linux-kernel
In-Reply-To: <474bbdcc-d78f-faa0-b2c3-3650cc870b36@cogentembedded.com>

Hello,

On Fri, 15 Jun 2018 19:04:45 +0300, Sergei Shtylyov wrote:
> Hello!
> 
> On 06/15/2018 06:52 PM, Thomas Petazzoni wrote:
> 
> > The fast path of get_user_pages_fast() disables IRQs and then does:
> > 
> >  - gup_pud_range()
> >    - gup_pmd_range()
> >      - gup_pte_range()
> >        - flush_dcache_page()
> > 
> > However, flush_dcache_page() makes a smp_call_function(), and using
> > smp_call_function() when IRQs are disabled is not allowed.
> > 
> > In order to work around this problem, this commit prevents the fast
> > path from get_user_pages_fast() from being used on SMP, and directly  
>        ^^^^ of?
>    Else it sounds a bit tautological...

Yes, agreed.

I can fix that up for a v2, or perhaps such a small typo can be fixed
while applying the patches.

Could someone review and/or merge those patches ?

I sent four patches, which are still pending:

  [PATCH] arch/sh: kernel: use KERN_CONT in print_sh_insn()
  [PATCH] arch/sh: kernel: use KERN_CONT in dump_mem()
  [PATCH] arch/sh: fix SH4 flush_dcache_all() for SMP
  [PATCH] arch/sh: use slow path for get_user_pages_fast() on SMP

Note that this last one is more a workaround than a proper fix. It does
the job, but there is very likely a better solution, and I was hoping
to get some insights/suggestions.

Thanks a lot,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply

* Re: [PATCH] arch/sh: use slow path for get_user_pages_fast() on SMP
From: Thomas Petazzoni @ 2018-07-23 13:46 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: Yoshinori Sato, Rich Felker, linux-sh, linux-kernel
In-Reply-To: <474bbdcc-d78f-faa0-b2c3-3650cc870b36@cogentembedded.com>

Hello,

On Fri, 15 Jun 2018 19:04:45 +0300, Sergei Shtylyov wrote:
> Hello!
> 
> On 06/15/2018 06:52 PM, Thomas Petazzoni wrote:
> 
> > The fast path of get_user_pages_fast() disables IRQs and then does:
> > 
> >  - gup_pud_range()
> >    - gup_pmd_range()
> >      - gup_pte_range()
> >        - flush_dcache_page()
> > 
> > However, flush_dcache_page() makes a smp_call_function(), and using
> > smp_call_function() when IRQs are disabled is not allowed.
> > 
> > In order to work around this problem, this commit prevents the fast
> > path from get_user_pages_fast() from being used on SMP, and directly  
>        ^^^^ of?
>    Else it sounds a bit tautological...

Yes, agreed.

I can fix that up for a v2, or perhaps such a small typo can be fixed
while applying the patches.

Could someone review and/or merge those patches ?

I sent four patches, which are still pending:

  [PATCH] arch/sh: kernel: use KERN_CONT in print_sh_insn()
  [PATCH] arch/sh: kernel: use KERN_CONT in dump_mem()
  [PATCH] arch/sh: fix SH4 flush_dcache_all() for SMP
  [PATCH] arch/sh: use slow path for get_user_pages_fast() on SMP

Note that this last one is more a workaround than a proper fix. It does
the job, but there is very likely a better solution, and I was hoping
to get some insights/suggestions.

Thanks a lot,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply

* Re: [PATCH] ARM: imx_v6_v7_defconfig: Enable DRM_PANEL_SEIKO_43WVF1G
From: Fabio Estevam @ 2018-07-23 13:46 UTC (permalink / raw)
  To: Leonard Crestez
  Cc: Shawn Guo,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
	Marek Vasut, Dong Aisheng, linux-kernel, Stefan Agner,
	NXP Linux Team, Sascha Hauer, Fabio Estevam, Marco Franchi
In-Reply-To: <8c6f4f407f363ec6980b59f7a2a9f29221dac29b.1532353109.git.leonard.crestez@nxp.com>

Hi Leonard,

On Mon, Jul 23, 2018 at 10:42 AM, Leonard Crestez
<leonard.crestez@nxp.com> wrote:
> This is one of the default lcdif panel options for several imx
> development boards. Now that we switched to CONFIG_DRM_MXSFB=y this
> should be enabled as well.
>
> Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>

Already sent as part of a series last week:
http://lists.infradead.org/pipermail/linux-arm-kernel/2018-July/592676.html

^ permalink raw reply

* [PATCH] ARM: imx_v6_v7_defconfig: Enable DRM_PANEL_SEIKO_43WVF1G
From: Fabio Estevam @ 2018-07-23 13:46 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <8c6f4f407f363ec6980b59f7a2a9f29221dac29b.1532353109.git.leonard.crestez@nxp.com>

Hi Leonard,

On Mon, Jul 23, 2018 at 10:42 AM, Leonard Crestez
<leonard.crestez@nxp.com> wrote:
> This is one of the default lcdif panel options for several imx
> development boards. Now that we switched to CONFIG_DRM_MXSFB=y this
> should be enabled as well.
>
> Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>

Already sent as part of a series last week:
http://lists.infradead.org/pipermail/linux-arm-kernel/2018-July/592676.html

^ permalink raw reply

* [PATCH] perf build: Build error in libbpf with EXTRA_CFLAGS="-Wp,-D_FORTIFY_SOURCE=2 -O2"
From: Thomas Richter @ 2018-07-23 13:45 UTC (permalink / raw)
  To: linux-kernel, linux-perf-users, acme, wangnan0
  Cc: brueckner, schwidefsky, heiko.carstens, Thomas Richter

commit a5b8bd47dcc57 ("bpf tools: Collect eBPF programs from their own sections")

cause a compiler error when building the perf tool in the linux-next tree.
I compile it using a FEDORA 28 installation, my gcc compiler version:
gcc (GCC) 8.0.1 20180324 (Red Hat 8.0.1-0.20)

Here is the error message:

[root@p23lp27] # make V=1 EXTRA_CFLAGS="-Wp,-D_FORTIFY_SOURCE=2 -O2"
[...]
make -f /home6/tmricht/linux-next/tools/build/Makefile.build
	dir=./util/scripting-engines obj=libperf
libbpf.c: In function ‘bpf_object__elf_collect’:
libbpf.c:811:15: error: ignoring return value of ‘strerror_r’,
		declared with attribute warn_unused_result [-Werror=unused-result]
     strerror_r(-err, errmsg, sizeof(errmsg));
               ^
cc1: all warnings being treated as errors
mv: cannot stat './.libbpf.o.tmp': No such file or directory
/home6/tmricht/linux-next/tools/build/Makefile.build:96: recipe for target 'libbpf.o' failed

Fix this by using strerror_r return value in pr_warning statement.
Also fixes a possible initialization issue.

Cc: Wang Nan <wangnan0@huawei.com>
Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
---
 tools/lib/bpf/libbpf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 955f8eafbf41..c70785ea903c 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -808,9 +808,9 @@ static int bpf_object__elf_collect(struct bpf_object *obj)
 			if (err) {
 				char errmsg[STRERR_BUFSIZE];
 
-				strerror_r(-err, errmsg, sizeof(errmsg));
 				pr_warning("failed to alloc program %s (%s): %s",
-					   name, obj->path, errmsg);
+					   name, obj->path,
+					   strerror_r(-err, errmsg, sizeof(errmsg)));
 			}
 		} else if (sh.sh_type == SHT_REL) {
 			void *reloc = obj->efile.reloc;
@@ -2334,7 +2334,7 @@ bpf_perf_event_read_simple(void *mem, unsigned long size,
 	__u64 data_tail = header->data_tail;
 	__u64 data_head = header->data_head;
 	void *base, *begin, *end;
-	int ret;
+	int ret = 0;
 
 	asm volatile("" ::: "memory"); /* in real code it should be smp_rmb() */
 	if (data_head == data_tail)
-- 
2.16.4

^ permalink raw reply related

* Re: [PATCH/RFT 3/7] arm64: dts: renesas: r8a77965: Add Sound device node and SSI support
From: Yoshihiro Kaneko @ 2018-07-23 12:43 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Linux-Renesas, Simon Horman, Magnus Damm, Linux ARM
In-Reply-To: <87pnzi4xyw.wl-kuninori.morimoto.gx@renesas.com>

Hi Morimoto-san,

Thank you for your review.

2018-07-20 8:23 GMT+09:00 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:
>
> Hi
>
>> From: Takeshi Kihara <takeshi.kihara.df@renesas.com>
>>
>> Based on several similar patches of the R8A7796 device tree
>> by Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>.
>>
>> Signed-off-by: Takeshi Kihara <takeshi.kihara.df@renesas.com>
>> Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
>> ---
> (snip)
>>               rcar_sound: sound@ec500000 {
>> +                     /*
>> +                      * #sound-dai-cells is required
>> +                      *
>> +                      * Single DAI : #sound-dai-cells = <0>; <&rcar_sound>;
>> +                      * Multi  DAI : #sound-dai-cells = <1>; <&rcar_sound N>;
>> +                      */
>> +                     /*
>> +                      * #clock-cells is required for audio_clkout0/1/2/3
>> +                      *
>> +                      * clkout       : #clock-cells = <0>;   <&rcar_sound>;
>> +                      * clkout0/1/2/3: #clock-cells = <1>;   <&rcar_sound N>;
>> +                      */
>> +                     compatible =  "renesas,rcar_sound-r8a7796", "renesas,rcar_sound-gen3";
>
> 77965 ?

Will fix.

>
> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Best regards,
Kaneko

^ permalink raw reply

* Documentation for libraries
From: Edward Diener @ 2018-07-23 12:33 UTC (permalink / raw)
  To: util-linux

Where is there documentation for using libblkid and libfdisk, either 
online or part of the util-linux package ?


^ permalink raw reply

* Re: [PATCH 0/6] UBI fixes backported to 4.4.x
From: Richard Weinberger @ 2018-07-23 12:43 UTC (permalink / raw)
  To: Greg KH; +Cc: stable
In-Reply-To: <20180723122049.GB14445@kroah.com>

Greg,

Am Montag, 23. Juli 2018, 14:20:49 CEST schrieb Greg KH:
> On Mon, Jul 23, 2018 at 02:10:08PM +0200, Richard Weinberger wrote:
> > Greg,
> > 
> > this series contains backports of the following upstream commits: 
> > 
> > 243a4f8126fc ubi: Introduce vol_ignored()
> > fdf10ed710c0 ubi: Rework Fastmap attach base code
> > 74f2c6e9a47c ubi: Be more paranoid while seaching for the most recent Fastmap
> > 2e8f08deabbc ubi: Fix races around ubi_refill_pools()
> > f7d11b33d4e8 ubi: Fix Fastmap's update_vol()
> > 5793f39de7f6 ubi: fastmap: Erase outdated anchor PEBs during attach
> 
> This last one was really commit f78e5623f45bab2b726eec29dc5cefbbab2d0b1c
> upstream, please be a bit more careful in the future.

Sorry for that.
I owe you a beer (at ELCE?). :-)

Thanks,
//richard

^ permalink raw reply

* Re: [PATCH net-next v6 3/4] net: vhost: factor out busy polling logic to vhost_net_busy_poll()
From: Tonghao Zhang @ 2018-07-23 12:43 UTC (permalink / raw)
  To: makita.toshiaki
  Cc: jasowang, mst, virtualization, Linux Kernel Network Developers
In-Reply-To: <c520c142-ef36-7918-7135-51258c17bd83@lab.ntt.co.jp>

On Mon, Jul 23, 2018 at 5:58 PM Toshiaki Makita
<makita.toshiaki@lab.ntt.co.jp> wrote:
>
> On 2018/07/22 3:04, xiangxia.m.yue@gmail.com wrote:
> > From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> >
> > Factor out generic busy polling logic and will be
> > used for in tx path in the next patch. And with the patch,
> > qemu can set differently the busyloop_timeout for rx queue.
> >
> > Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> > ---
> ...
> > +static void vhost_net_busy_poll_vq_check(struct vhost_net *net,
> > +                                      struct vhost_virtqueue *rvq,
> > +                                      struct vhost_virtqueue *tvq,
> > +                                      bool rx)
> > +{
> > +     struct socket *sock = rvq->private_data;
> > +
> > +     if (rx) {
> > +             if (!vhost_vq_avail_empty(&net->dev, tvq)) {
> > +                     vhost_poll_queue(&tvq->poll);
> > +             } else if (unlikely(vhost_enable_notify(&net->dev, tvq))) {
> > +                     vhost_disable_notify(&net->dev, tvq);
> > +                     vhost_poll_queue(&tvq->poll);
> > +             }
> > +     } else if ((sock && sk_has_rx_data(sock->sk)) &&
> > +                 !vhost_vq_avail_empty(&net->dev, rvq)) {
> > +             vhost_poll_queue(&rvq->poll);
>
> Now we wait for vq_avail for rx as well, I think you cannot skip
> vhost_enable_notify() on tx. Probably you might want to do:
I think vhost_enable_notify is needed.

> } else if (sock && sk_has_rx_data(sock->sk)) {
>         if (!vhost_vq_avail_empty(&net->dev, rvq)) {
>                 vhost_poll_queue(&rvq->poll);
>         } else if (unlikely(vhost_enable_notify(&net->dev, rvq))) {
>                 vhost_disable_notify(&net->dev, rvq);
>                 vhost_poll_queue(&rvq->poll);
>         }
> }
As Jason review as before, we only want rx kick when packet is pending at
socket but we're out of available buffers. So we just enable notify,
but not poll it ?

        } else if ((sock && sk_has_rx_data(sock->sk)) &&
                    !vhost_vq_avail_empty(&net->dev, rvq)) {
                vhost_poll_queue(&rvq->poll);
        else {
                vhost_enable_notify(&net->dev, rvq);
        }
> Also it's better to care vhost_net_disable_vq()/vhost_net_enable_vq() on tx?
I cant find why it is better, if necessary, we can do it.
> --
> Toshiaki Makita
>

^ permalink raw reply

* [PATCH 4.4 018/107] x86/paravirt: Make native_save_fl() extern inline
From: Greg Kroah-Hartman @ 2018-07-23 12:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Arnd Bergmann, H. Peter Anvin,
	Tom Stellar, Sedat Dilek, Nick Desaulniers, Juergen Gross,
	Linus Torvalds, Peter Zijlstra, Thomas Gleixner, acme, akataria,
	akpm, andrea.parri, ard.biesheuvel, aryabinin, astrachan,
	boris.ostrovsky, brijesh.singh, caoj.fnst, geert, ghackmann,
	jan.kiszka, jarkko.sakkinen, joe, jpoimboe, keescook,
	kirill.shutemov, kstewart, linux-efi, linux-kbuild, manojgupta,
	mawilcox, michal.lkml, mjg59, mka, pombredanne, rientjes, rostedt,
	thomas.lendacky, tweek, virtualization, will.deacon,
	yamada.masahiro, Ingo Molnar
In-Reply-To: <20180723122413.003644357@linuxfoundation.org>

4.4-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Nick Desaulniers <ndesaulniers@google.com>

commit d0a8d9378d16eb3c69bd8e6d23779fbdbee3a8c7 upstream.

native_save_fl() is marked static inline, but by using it as
a function pointer in arch/x86/kernel/paravirt.c, it MUST be outlined.

paravirt's use of native_save_fl() also requires that no GPRs other than
%rax are clobbered.

Compilers have different heuristics which they use to emit stack guard
code, the emittance of which can break paravirt's callee saved assumption
by clobbering %rcx.

Marking a function definition extern inline means that if this version
cannot be inlined, then the out-of-line version will be preferred. By
having the out-of-line version be implemented in assembly, it cannot be
instrumented with a stack protector, which might violate custom calling
conventions that code like paravirt rely on.

The semantics of extern inline has changed since gnu89. This means that
folks using GCC versions >= 5.1 may see symbol redefinition errors at
link time for subdirs that override KBUILD_CFLAGS (making the C standard
used implicit) regardless of this patch. This has been cleaned up
earlier in the patch set, but is left as a note in the commit message
for future travelers.

Reports:
 https://lkml.org/lkml/2018/5/7/534
 https://github.com/ClangBuiltLinux/linux/issues/16

Discussion:
 https://bugs.llvm.org/show_bug.cgi?id=37512
 https://lkml.org/lkml/2018/5/24/1371

Thanks to the many folks that participated in the discussion.

[Backport for 4.4. 4.4 is missing commit 784d5699eddc "x86: move exports to
actual definitions" which doesn't apply cleanly, and not really worth
backporting IMO. It's simpler to change this patch from upstream:
  + #include <asm-generic/export.h>
rather than
  + #include <asm/export.h>]

Debugged-by: Alistair Strachan <astrachan@google.com>
Debugged-by: Matthias Kaehlcke <mka@chromium.org>
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Suggested-by: H. Peter Anvin <hpa@zytor.com>
Suggested-by: Tom Stellar <tstellar@redhat.com>
Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Acked-by: Juergen Gross <jgross@suse.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: acme@redhat.com
Cc: akataria@vmware.com
Cc: akpm@linux-foundation.org
Cc: andrea.parri@amarulasolutions.com
Cc: ard.biesheuvel@linaro.org
Cc: aryabinin@virtuozzo.com
Cc: astrachan@google.com
Cc: boris.ostrovsky@oracle.com
Cc: brijesh.singh@amd.com
Cc: caoj.fnst@cn.fujitsu.com
Cc: geert@linux-m68k.org
Cc: ghackmann@google.com
Cc: gregkh@linuxfoundation.org
Cc: jan.kiszka@siemens.com
Cc: jarkko.sakkinen@linux.intel.com
Cc: joe@perches.com
Cc: jpoimboe@redhat.com
Cc: keescook@google.com
Cc: kirill.shutemov@linux.intel.com
Cc: kstewart@linuxfoundation.org
Cc: linux-efi@vger.kernel.org
Cc: linux-kbuild@vger.kernel.org
Cc: manojgupta@google.com
Cc: mawilcox@microsoft.com
Cc: michal.lkml@markovi.net
Cc: mjg59@google.com
Cc: mka@chromium.org
Cc: pombredanne@nexb.com
Cc: rientjes@google.com
Cc: rostedt@goodmis.org
Cc: thomas.lendacky@amd.com
Cc: tweek@google.com
Cc: virtualization@lists.linux-foundation.org
Cc: will.deacon@arm.com
Cc: yamada.masahiro@socionext.com
Link: http://lkml.kernel.org/r/20180621162324.36656-4-ndesaulniers@google.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/x86/include/asm/irqflags.h |    2 +-
 arch/x86/kernel/Makefile        |    1 +
 arch/x86/kernel/irqflags.S      |   26 ++++++++++++++++++++++++++
 3 files changed, 28 insertions(+), 1 deletion(-)

--- a/arch/x86/include/asm/irqflags.h
+++ b/arch/x86/include/asm/irqflags.h
@@ -8,7 +8,7 @@
  * Interrupt control:
  */
 
-static inline unsigned long native_save_fl(void)
+extern inline unsigned long native_save_fl(void)
 {
 	unsigned long flags;
 
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -41,6 +41,7 @@ obj-y			+= alternative.o i8253.o pci-nom
 obj-y			+= tsc.o tsc_msr.o io_delay.o rtc.o
 obj-y			+= pci-iommu_table.o
 obj-y			+= resource.o
+obj-y			+= irqflags.o
 
 obj-y				+= process.o
 obj-y				+= fpu/
--- /dev/null
+++ b/arch/x86/kernel/irqflags.S
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#include <asm/asm.h>
+#include <asm-generic/export.h>
+#include <linux/linkage.h>
+
+/*
+ * unsigned long native_save_fl(void)
+ */
+ENTRY(native_save_fl)
+	pushf
+	pop %_ASM_AX
+	ret
+ENDPROC(native_save_fl)
+EXPORT_SYMBOL(native_save_fl)
+
+/*
+ * void native_restore_fl(unsigned long flags)
+ * %eax/%rdi: flags
+ */
+ENTRY(native_restore_fl)
+	push %_ASM_ARG1
+	popf
+	ret
+ENDPROC(native_restore_fl)
+EXPORT_SYMBOL(native_restore_fl)



^ permalink raw reply

* [U-Boot] [PATCH] imx8qxp_mek: add README
From: Fabio Estevam @ 2018-07-23 13:44 UTC (permalink / raw)
  To: u-boot
In-Reply-To: <20180723100049.3588-1-peng.fan@nxp.com>

Hi Peng,

On Mon, Jul 23, 2018 at 7:00 AM, Peng Fan <peng.fan@nxp.com> wrote:
> Add README file for i.MX8QXP MEK board.

Thanks for submitting the README file.

>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> Cc: Stefano Babic <sbabic@denx.de>
> Cc: Fabio Estevam <fabio.estevam@nxp.com>
> Cc: Anatolij Gustschin <agust@denx.de>
> ---
>
> This patch is for testing i.MX8QXP patchset [PATCH V2 00/32] i.MX: Add i.MX8QXP support
> https://lists.denx.de/pipermail/u-boot/2018-July/335079.html
> The board is using B0 chip, A0 chip is not being supported.
> Please help test if you are interested. I'll post out V3 after collecting
> more comments.
> Sadly, I do not know where to download scfw_tcm.bin in public for B0 QXP.

Could you please check how to make this binary available to the users?

Users need to have access to the firmware, otherwise it is a blocking
issue for upstreaming mx8qxp support.

Thanks

^ permalink raw reply

* [PATCH] drm/atomic: Check old_plane_state->crtc in drm_atomic_helper_async_check()
From: Boris Brezillon @ 2018-07-23 13:43 UTC (permalink / raw)
  To: David Airlie, Daniel Vetter, dri-devel; +Cc: Boris Brezillon

Async plane update is supposed to work only when updating the FB or FB
position of an already enabled plane. That does not apply to requests
where the plane was previously disabled or assigned to a different
CTRC.

Check old_plane_state->crtc value to make sure async plane update is
allowed.

Fixes: fef9df8b5945 ("drm/atomic: initial support for asynchronous plane update")
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
---
Hello,

As discussed on IRC, I'm not sure this "plane should already be enabled
and assigned to the same CRTC to allow async updates" limitation
applies to all drivers, but it's required for VC4 to work properly.

Just let me know if you think I should move this check to
vc4_plane_atomic_async_check().

Thanks,

Boris
---
 drivers/gpu/drm/drm_atomic_helper.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index 866a2cc72ef6..f7ccfebd3ca8 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -1555,7 +1555,8 @@ int drm_atomic_helper_async_check(struct drm_device *dev,
 	if (n_planes != 1)
 		return -EINVAL;
 
-	if (!new_plane_state->crtc)
+	if (!new_plane_state->crtc ||
+	    old_plane_state->crtc != new_plane_state->crtc)
 		return -EINVAL;
 
 	funcs = plane->helper_private;
-- 
2.14.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related

* Re: [PATCH 1/2] security/keys/secure_key: Adds the secure key support based on CAAM.
From: Jan Lübbe @ 2018-07-23 12:42 UTC (permalink / raw)
  To: Udit Agarwal, dhowells@redhat.com, zohar@linux.vnet.ibm.com,
	jmorris@namei.org, serge@hallyn.com,
	linux-integrity@vger.kernel.org, keyrings@vger.kernel.org,
	linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org
  Cc: Sahil Malhotra, Ruchika Gupta, Horia Geanta, Aymen Sghaier
In-Reply-To: <AM5PR0401MB266047028697BCF2851F8F189E500@AM5PR0401MB2660.eurprd04.prod.outlook.com>

Hi,

On Sat, 2018-07-21 at 14:44 +0000, Udit Agarwal wrote:
> Thanks for sharing the documentation changes and feedback.
> 
> Below are the answers to the questions:
> 
> 1. Currently the secure key patch series has been added  to support
> only data blobs.
> It is not supporting key blobs as of now, we have thought of adding
> that support in future.

OK. Do have a plan how the key blobs would be represented in the
keyring? It seems it would need to be some sort of handle instead of
the key data. Would it need a different userspace API?

> 2. Yes secure keys could also be implemented using OPTEE. I will
> change the documentation in next patch version.

Thanks!

Jan

^ permalink raw reply

* [PATCH] ARM: imx_v6_v7_defconfig: Enable DRM_PANEL_SEIKO_43WVF1G
From: Leonard Crestez @ 2018-07-23 13:42 UTC (permalink / raw)
  To: Shawn Guo, linux-arm-kernel
  Cc: Fabio Estevam, Stefan Agner, Marek Vasut, Dong Aisheng,
	Marco Franchi, linux-imx, kernel, linux-kernel

This is one of the default lcdif panel options for several imx
development boards. Now that we switched to CONFIG_DRM_MXSFB=y this
should be enabled as well.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
---
 arch/arm/configs/imx_v6_v7_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig
index e2c127608bcc..7eca43ff69bb 100644
--- a/arch/arm/configs/imx_v6_v7_defconfig
+++ b/arch/arm/configs/imx_v6_v7_defconfig
@@ -255,10 +255,11 @@ CONFIG_VIDEO_ADV7180=m
 CONFIG_VIDEO_OV5640=m
 CONFIG_IMX_IPUV3_CORE=y
 CONFIG_DRM=y
 CONFIG_DRM_PANEL_LVDS=y
 CONFIG_DRM_PANEL_SIMPLE=y
+CONFIG_DRM_PANEL_SEIKO_43WVF1G=y
 CONFIG_DRM_DW_HDMI_AHB_AUDIO=m
 CONFIG_DRM_DW_HDMI_CEC=y
 CONFIG_DRM_IMX=y
 CONFIG_DRM_IMX_PARALLEL_DISPLAY=y
 CONFIG_DRM_IMX_TVE=y
-- 
2.17.1


^ permalink raw reply related


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