<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/xen/privcmd.c, branch linux-4.19.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.19.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.19.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2023-01-18T10:30:07Z</updated>
<entry>
<title>xen/privcmd: Fix a possible warning in privcmd_ioctl_mmap_resource()</title>
<updated>2023-01-18T10:30:07Z</updated>
<author>
<name>Harshit Mogalapalli</name>
</author>
<published>2022-11-26T05:07:45Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5d68ae32d132ea2af73bc223fd64c46f85302a8b'/>
<id>urn:sha1:5d68ae32d132ea2af73bc223fd64c46f85302a8b</id>
<content type='text'>
[ Upstream commit 8b997b2bb2c53b76a6db6c195930e9ab8e4b0c79 ]

As 'kdata.num' is user-controlled data, if user tries to allocate
memory larger than(&gt;=) MAX_ORDER, then kcalloc() will fail, it
creates a stack trace and messes up dmesg with a warning.

Call trace:
-&gt; privcmd_ioctl
--&gt; privcmd_ioctl_mmap_resource

Add __GFP_NOWARN in order to avoid too large allocation warning.
This is detected by static analysis using smatch.

Fixes: 3ad0876554ca ("xen/privcmd: add IOCTL_PRIVCMD_MMAP_RESOURCE")
Signed-off-by: Harshit Mogalapalli &lt;harshit.m.mogalapalli@oracle.com&gt;
Reviewed-by: Juergen Gross &lt;jgross@suse.com&gt;
Link: https://lore.kernel.org/r/20221126050745.778967-1-harshit.m.mogalapalli@oracle.com
Signed-off-by: Juergen Gross &lt;jgross@suse.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>xen/privcmd: fix error handling in mmap-resource processing</title>
<updated>2021-10-13T08:10:50Z</updated>
<author>
<name>Jan Beulich</name>
</author>
<published>2021-09-22T10:17:48Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=56eeac7d325ab707592219be2f9aea460abbb6ad'/>
<id>urn:sha1:56eeac7d325ab707592219be2f9aea460abbb6ad</id>
<content type='text'>
commit e11423d6721dd63b23fb41ade5e8d0b448b17780 upstream.

xen_pfn_t is the same size as int only on 32-bit builds (and not even
on Arm32). Hence pfns[] can't be used directly to read individual error
values returned from xen_remap_domain_mfn_array(); every other error
indicator would be skipped/ignored on 64-bit.

Fixes: 3ad0876554ca ("xen/privcmd: add IOCTL_PRIVCMD_MMAP_RESOURCE")
Cc: stable@vger.kernel.org
Signed-off-by: Jan Beulich &lt;jbeulich@suse.com&gt;
Reviewed-by: Boris Ostrovsky &lt;boris.ostrovsky@oracle.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

Link: https://lore.kernel.org/r/aa6d6a67-6889-338a-a910-51e889f792d5@suse.com
Signed-off-by: Juergen Gross &lt;jgross@suse.com&gt;
</content>
</entry>
<entry>
<title>xen/privcmd: allow fetching resource sizes</title>
<updated>2021-02-03T22:23:24Z</updated>
<author>
<name>Roger Pau Monne</name>
</author>
<published>2021-01-12T11:53:58Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d8099663adc97471697c1b63b8bdc6649417531c'/>
<id>urn:sha1:d8099663adc97471697c1b63b8bdc6649417531c</id>
<content type='text'>
commit ef3a575baf53571dc405ee4028e26f50856898e7 upstream.

Allow issuing an IOCTL_PRIVCMD_MMAP_RESOURCE ioctl with num = 0 and
addr = 0 in order to fetch the size of a specific resource.

Add a shortcut to the default map resource path, since fetching the
size requires no address to be passed in, and thus no VMA to setup.

This is missing from the initial implementation, and causes issues
when mapping resources that don't have fixed or known sizes.

Signed-off-by: Roger Pau Monné &lt;roger.pau@citrix.com&gt;
Reviewed-by: Juergen Gross &lt;jgross@suse.com&gt;
Tested-by: Andrew Cooper &lt;andrew.cooper3@citrix.com&gt;
Cc: stable@vger.kernel.org # &gt;= 4.18
Link: https://lore.kernel.org/r/20210112115358.23346-1-roger.pau@citrix.com
Signed-off-by: Juergen Gross &lt;jgross@suse.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>xen: add new hypercall buffer mapping device</title>
<updated>2018-06-22T06:26:42Z</updated>
<author>
<name>Juergen Gross</name>
</author>
<published>2018-06-18T07:36:39Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c51b3c639e01f20559531eef3c5919feae23c55a'/>
<id>urn:sha1:c51b3c639e01f20559531eef3c5919feae23c55a</id>
<content type='text'>
For passing arbitrary data from user land to the Xen hypervisor the
Xen tools today are using mlock()ed buffers. Unfortunately the kernel
might change access rights of such buffers for brief periods of time
e.g. for page migration or compaction, leading to access faults in the
hypervisor, as the hypervisor can't use the locks of the kernel.

In order to solve this problem add a new device node to the Xen privcmd
driver to easily allocate hypercall buffers via mmap(). The memory is
allocated in the kernel and just mapped into user space. Marked as
VM_IO the user mapping will not be subject to page migration et al.

Signed-off-by: Juergen Gross &lt;jgross@suse.com&gt;
Reviewed-by: Boris Ostrovsky &lt;boris.ostrovsky@oracle.com&gt;
Signed-off-by: Juergen Gross &lt;jgross@suse.com&gt;
</content>
</entry>
<entry>
<title>xen/privcmd: add IOCTL_PRIVCMD_MMAP_RESOURCE</title>
<updated>2018-05-14T13:25:37Z</updated>
<author>
<name>Paul Durrant</name>
</author>
<published>2018-05-09T13:16:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3ad0876554cafa368f574d4d408468510543e9ff'/>
<id>urn:sha1:3ad0876554cafa368f574d4d408468510543e9ff</id>
<content type='text'>
My recent Xen patch series introduces a new HYPERVISOR_memory_op to
support direct priv-mapping of certain guest resources (such as ioreq
pages, used by emulators) by a tools domain, rather than having to access
such resources via the guest P2M.

This patch adds the necessary infrastructure to the privcmd driver and
Xen MMU code to support direct resource mapping.

NOTE: The adjustment in the MMU code is partially cosmetic. Xen will now
      allow a PV tools domain to map guest pages either by GFN or MFN, thus
      the term 'mfn' has been swapped for 'pfn' in the lower layers of the
      remap code.

Signed-off-by: Paul Durrant &lt;paul.durrant@citrix.com&gt;
Reviewed-by: Boris Ostrovsky &lt;boris.ostrovsky@oracle.com&gt;
Signed-off-by: Juergen Gross &lt;jgross@suse.com&gt;
</content>
</entry>
<entry>
<title>xen: Change return type to vm_fault_t</title>
<updated>2018-05-14T12:41:34Z</updated>
<author>
<name>Souptick Joarder</name>
</author>
<published>2018-04-14T19:15:42Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4bf2cc9645599382e34b7d0cbe5a13d0de98194e'/>
<id>urn:sha1:4bf2cc9645599382e34b7d0cbe5a13d0de98194e</id>
<content type='text'>
Use new return type vm_fault_t for fault handler
in struct vm_operations_struct.

Signed-off-by: Souptick Joarder &lt;jrdr.linux@gmail.com&gt;
Reviewed-by: Matthew Wilcox &lt;mawilcox@microsoft.com&gt;
Reviewed-by: Juergen Gross &lt;jgross@suse.com&gt;
Signed-off-by: Juergen Gross &lt;jgross@suse.com&gt;
</content>
</entry>
<entry>
<title>xen/privcmd: remove unused variable pageidx</title>
<updated>2017-11-08T14:15:28Z</updated>
<author>
<name>Colin Ian King</name>
</author>
<published>2017-11-08T13:00:30Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=52847bb79b524c6f6c177d3247e824ad7487b31c'/>
<id>urn:sha1:52847bb79b524c6f6c177d3247e824ad7487b31c</id>
<content type='text'>
Variable pageidx is assigned a value but it is never read, hence it
is redundant and can be removed. Cleans up clang warning:

drivers/xen/privcmd.c:199:2: warning: Value stored to 'pageidx'
is never read

Signed-off-by: Colin Ian King &lt;colin.king@canonical.com&gt;
Reviewed-by: Juergen Gross &lt;jgross@suse.com&gt;
Signed-off-by: Boris Ostrovsky &lt;boris.ostrovsky@oracle.com&gt;
</content>
</entry>
<entry>
<title>xen/privcmd: Support correctly 64KB page granularity when mapping memory</title>
<updated>2017-06-07T09:23:14Z</updated>
<author>
<name>Julien Grall</name>
</author>
<published>2017-05-31T13:03:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=753c09b5652bb4fe53e2db648002ec64b32b8827'/>
<id>urn:sha1:753c09b5652bb4fe53e2db648002ec64b32b8827</id>
<content type='text'>
Commit 5995a68 "xen/privcmd: Add support for Linux 64KB page granularity" did
not go far enough to support 64KB in mmap_batch_fn.

The variable 'nr' is the number of 4KB chunk to map. However, when Linux
is using 64KB page granularity the array of pages (vma-&gt;vm_private_data)
contain one page per 64KB. Fix it by incrementing st-&gt;index correctly.

Furthermore, st-&gt;va is not correctly incremented as PAGE_SIZE !=
XEN_PAGE_SIZE.

Fixes: 5995a68 ("xen/privcmd: Add support for Linux 64KB page granularity")
CC: stable@vger.kernel.org
Reported-by: Feng Kan &lt;fkan@apm.com&gt;
Signed-off-by: Julien Grall &lt;julien.grall@arm.com&gt;
Reviewed-by: Boris Ostrovsky &lt;boris.ostrovsky@oracle.com&gt;
Signed-off-by: Juergen Gross &lt;jgross@suse.com&gt;
</content>
</entry>
<entry>
<title>mm, fs: reduce fault, page_mkwrite, and pfn_mkwrite to take only vmf</title>
<updated>2017-02-25T01:46:54Z</updated>
<author>
<name>Dave Jiang</name>
</author>
<published>2017-02-24T22:56:41Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=11bac80004499ea59f361ef2a5516c84b6eab675'/>
<id>urn:sha1:11bac80004499ea59f361ef2a5516c84b6eab675</id>
<content type='text'>
-&gt;fault(), -&gt;page_mkwrite(), and -&gt;pfn_mkwrite() calls do not need to
take a vma and vmf parameter when the vma already resides in vmf.

Remove the vma parameter to simplify things.

[arnd@arndb.de: fix ARM build]
  Link: http://lkml.kernel.org/r/20170125223558.1451224-1-arnd@arndb.de
Link: http://lkml.kernel.org/r/148521301778.19116.10840599906674778980.stgit@djiang5-desk3.ch.intel.com
Signed-off-by: Dave Jiang &lt;dave.jiang@intel.com&gt;
Signed-off-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Reviewed-by: Ross Zwisler &lt;ross.zwisler@linux.intel.com&gt;
Cc: Theodore Ts'o &lt;tytso@mit.edu&gt;
Cc: Darrick J. Wong &lt;darrick.wong@oracle.com&gt;
Cc: Matthew Wilcox &lt;mawilcox@microsoft.com&gt;
Cc: Dave Hansen &lt;dave.hansen@intel.com&gt;
Cc: Christoph Hellwig &lt;hch@lst.de&gt;
Cc: Jan Kara &lt;jack@suse.com&gt;
Cc: Dan Williams &lt;dan.j.williams@intel.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>xen/privcmd: add IOCTL_PRIVCMD_RESTRICT</title>
<updated>2017-02-14T20:14:59Z</updated>
<author>
<name>Paul Durrant</name>
</author>
<published>2017-02-13T17:03:24Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4610d240d691768203fdd210a5da0a2e02eddb76'/>
<id>urn:sha1:4610d240d691768203fdd210a5da0a2e02eddb76</id>
<content type='text'>
The purpose if this ioctl is to allow a user of privcmd to restrict its
operation such that it will no longer service arbitrary hypercalls via
IOCTL_PRIVCMD_HYPERCALL, and will check for a matching domid when
servicing IOCTL_PRIVCMD_DM_OP or IOCTL_PRIVCMD_MMAP*. The aim of this
is to limit the attack surface for a compromised device model.

Signed-off-by: Paul Durrant &lt;paul.durrant@citrix.com&gt;
Signed-off-by: Boris Ostrovsky &lt;boris.ostrovsky@oracle.com&gt;
</content>
</entry>
</feed>
