On Fri, Nov 10, 2017 at 09:05:20AM +0100, Peter Zijlstra wrote:
> On Fri, Nov 10, 2017 at 03:10:17PM +0800, Peter Xu wrote:
> > I came to this when reading kvm_vcpu_wake_up(), so that only affects
> > some statistic which may not be that critical. However I don't know
> &
On Mon, Nov 13, 2017 at 11:33:43AM +0800, Peter Xu wrote:
> On Fri, Nov 10, 2017 at 09:05:20AM +0100, Peter Zijlstra wrote:
> > On Fri, Nov 10, 2017 at 03:10:17PM +0800, Peter Xu wrote:
> > > I came to this when reading kvm_vcpu_wake_up(), so that only affects
> > > some
re simply refuse to bind to PFs with SR-IOV enabled
> with a warning message indicating the issue. Users can resolve this
> by re-binding to the host driver and disabling SR-IOV before
> attempting to use the device with vfio-pci.
>
> Signed-off-by: Alex Williamson
Reviewed-by: Peter Xu
--
Peter Xu
pu_to_be64(virt_to_phys(address)),
> + .length = cpu_to_be32(length),
> + .control = cpu_to_be32(control)
> + };
> +
> + dma = virt_to_phys(d);
> +
> + iowrite32be((u64)dma >> 32, fw_cfg_reg_dma);
> + iowrite32be(dma, fw_cfg_reg_dma + 4);
We can do it with iowrite64be(virt_to_phys(d)) too? In all cases I
think it's good enough and no worth for a repost.
For the DMA transfer part:
Acked-by: Peter Xu
Thanks,
--
Peter Xu
it's fixed as a
side effect of commit 13cf01744608 ("iommu/vt-d: Make use of iova
deferred flushing", 2017-08-15). But IMHO it's still good to have this
patch upstream.
CC: Alex Williamson
Signed-off-by: Peter Xu
---
drivers/iommu/intel-iommu.c | 3 +--
1 file changed, 1 inse
_init+0x80/0x80
[1.018392] ---[ end trace d00a5b71608a8f59 ]---
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1533367
Fixes: e90cb816599b ("fw_cfg: do DMA read operation", 2017-11-28)
CC: Marc-André Lureau
CC: Michael S. Tsirkin
Signed-off-by: Peter Xu
--
This is ba
On Mon, Jan 15, 2018 at 12:22:48PM +0100, Marc-Andre Lureau wrote:
> Hi
>
> On Mon, Jan 15, 2018 at 9:55 AM, Peter Xu wrote:
> > fw_cfg device does not need IOMMU protection, so use physical addresses
> > always. That's how QEMU implements fw_cfg. Otherwise we
ds_list);
>
> ret = vfio_add_group_dev(&pdev->dev, &vfio_pci_ops, vdev);
> if (ret) {
--
Peter Xu
On Wed, Feb 28, 2018 at 01:14:46PM -0700, Alex Williamson wrote:
> This creates a common helper that we'll use for ioeventfd setup.
>
> Signed-off-by: Alex Williamson
Reviewed-by: Peter Xu
--
Peter Xu
On Fri, Sep 14, 2018 at 08:41:57PM -0400, Jerome Glisse wrote:
> On Fri, Sep 14, 2018 at 03:16:11PM +0800, Peter Xu wrote:
> > On Thu, Sep 13, 2018 at 08:42:39PM -0400, Jerome Glisse wrote:
> > > On Thu, Sep 13, 2018 at 10:23:28AM -0400, Jerome Glisse wrote:
> > > >
On Thu, Sep 27, 2018 at 03:56:52AM -0400, Jerome Glisse wrote:
> On Thu, Sep 27, 2018 at 03:43:38PM +0800, Peter Xu wrote:
> > On Fri, Sep 14, 2018 at 08:41:57PM -0400, Jerome Glisse wrote:
> > > On Fri, Sep 14, 2018 at 03:16:11PM +0800, Peter Xu wrote:
> > > > On T
Firstly, the help in the comment region is obsolete, now we support
three parameters. Since at it, change it and move it into the help
message of the program.
Also, the help messages dumped here and there is obsolete too. Use a
single usage() helper.
Signed-off-by: Peter Xu
---
tools/testing
s for each lock operation.
Signed-off-by: Peter Xu
---
tools/testing/selftests/vm/userfaultfd.c | 11 ++-
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/tools/testing/selftests/vm/userfaultfd.c
b/tools/testing/selftests/vm/userfaultfd.c
index f79706f13ce7..a388675b15af 1
Recently I wrote some uffd write-protection test for the
not-yet-published uffd-wp tree, and I picked these common patches out
first for the selftest which even suite for master.
Any feedback is welcomed. Please have a look, thanks.
Peter Xu (3):
userfaultfd: selftest: cleanup help messages
d not check EAGAIN case in read() mode
- ignored BOUNCE_VERIFY check in read() mode
Signed-off-by: Peter Xu
---
tools/testing/selftests/vm/userfaultfd.c | 76 +---
1 file changed, 42 insertions(+), 34 deletions(-)
diff --git a/tools/testing/selftests/vm/userfaultfd.c
b/
The series is only lightly tested. Before running more tests, I'd be
really glad to see whether there's any feedback first.
Looking forward to your comments. Thanks,
[1]
https://git.kernel.org/pub/scm/linux/kernel/git/andrea/aa.git/commit/?h=userfault&id=b245ecf6cf59156966f3da6e
.
It might also benefit other potential users who will have similar
requirement like userfault write-protection.
Please read the thread below for more information.
[1] https://lkml.org/lkml/2017/11/2/833
Suggested-by: Linus Torvalds
Suggested-by: Andrea Arcangeli
Signed-off-by: Peter Xu
---
This is the gup counterpart of the change that allows the VM_FAULT_RETRY
to happen for more than once.
Signed-off-by: Peter Xu
---
mm/gup.c | 17 +
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/mm/gup.c b/mm/gup.c
index a40111c742ba..7c3b3ab6be88 100644
--- a/mm
ter suite the
functionality of the variable. While at it, fixing up some of the
comments accordingly.
Signed-off-by: Peter Xu
---
mm/gup.c | 44 +---
mm/hugetlb.c | 8
2 files changed, 25 insertions(+), 27 deletions(-)
diff --git a/mm/gup.c
contains a potential fix for a double-free of mmap_sem on
ARC architecture; please see https://lkml.org/lkml/2018/11/1/723 for
more information)
Suggested-by: Linus Torvalds
Suggested-by: Andrea Arcangeli
Signed-off-by: Peter Xu
---
arch/alpha/mm/fault.c | 2 +-
arch/arc/mm/fault.c
drew Morton
CC: "Kirill A. Shutemov"
CC: Matthew Wilcox
CC: Michal Hocko
CC: Dave Jiang
CC: "Aneesh Kumar K.V"
CC: Souptick Joarder
CC: Konstantin Khlebnikov
CC: linux...@kvack.org
CC: linux-kernel@vger.kernel.org
Signed-off-by: Peter Xu
---
I noticed this during code reading.
On Thu, Dec 06, 2018 at 04:46:04PM +0800, Peter Xu wrote:
> When splitting a huge migrating PMD, we'll transfer the soft dirty bit
> from the huge page to the small pages. However we're possibly using a
> wrong data since when fetching the bit we're using pmd_soft_dirty()
is comment too some day:
/*
* Nothing to do: this vma is already registered into this
* userfaultfd and with the right tracking mode too.
*/
But I don't think it's anything urgent since it's clear it means t
@vger.kernel.org
Signed-off-by: Peter Xu
---
fs/userfaultfd.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c
index cd58939dc977..798ae8a438ff 100644
--- a/fs/userfaultfd.c
+++ b/fs/userfaultfd.c
@@ -740,6 +740,9 @@ void mremap_userfaultfd_prep(struct vm_area_struct
void *data), void *data);
>
> #ifdef CONFIG_INTEL_IOMMU_SVM
> -extern int intel_svm_alloc_pasid_tables(struct intel_iommu *iommu);
> -extern int intel_svm_free_pasid_tables(struct intel_iommu *iommu);
> +int intel_svm_init(struct intel_iommu *iommu);
> +int intel_svm_exit(struct intel_iommu *iommu);
> extern int intel_svm_enable_prq(struct intel_iommu *iommu);
> extern int intel_svm_finish_prq(struct intel_iommu *iommu);
>
> --
> 2.7.4
>
> ___
> iommu mailing list
> io...@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/iommu
--
Peter Xu
s function is called is in a single-thread context
> (protected by a spinlock of device_domain_lock with local interrupt disabled).
>
> So we don't need an extra lock here. But anyway, I should put a comment
> here.
Yeah, that would be nice too! Or add a comment for both of the
functions:
/* Must be with device_domain_lock held */
Regards,
--
Peter Xu
On Tue, Dec 11, 2018 at 11:21:44AM +0300, Konstantin Khlebnikov wrote:
> On 11.12.2018 8:12, Peter Xu wrote:
> > When splitting a huge migrating PMD, we'll transfer all the existing
> > PMD bits and apply them again onto the small PTEs. However we are
> > fetching th
On Wed, Dec 12, 2018 at 04:51:38PM +0300, Konstantin Khlebnikov wrote:
> On Wed, Dec 12, 2018 at 8:15 AM Peter Xu wrote:
> >
> > On Tue, Dec 11, 2018 at 11:21:44AM +0300, Konstantin Khlebnikov wrote:
> > > On 11.12.2018 8:12, Peter Xu wrote:
> > > > When s
k Joarder
CC: Konstantin Khlebnikov
CC: Zi Yan
CC: linux...@kvack.org
CC: linux-kernel@vger.kernel.org
Signed-off-by: Peter Xu
---
v2:
- fix it up for young/write/dirty bits too [Konstantin]
v3:
- fetch write correctly for migration entry; drop macro [Konstantin]
---
mm/huge_memory.c | 20
On Thu, Dec 13, 2018 at 12:59:42PM +0300, Kirill A. Shutemov wrote:
> On Thu, Dec 13, 2018 at 01:15:10PM +0800, Peter Xu wrote:
> > When splitting a huge migrating PMD, we'll transfer all the existing
> > PMD bits and apply them again onto the small PTEs. However we are
&
On Mon, Dec 10, 2018 at 07:50:52PM +0300, Konstantin Khlebnikov wrote:
> On Fri, Dec 7, 2018 at 6:34 AM Peter Xu wrote:
> >
> > On Thu, Dec 06, 2018 at 04:46:04PM +0800, Peter Xu wrote:
> > > When splitting a huge migrating PMD, we'll transfer the soft dirty bit
&g
bnikov
CC: linux...@kvack.org
CC: linux-kernel@vger.kernel.org
Signed-off-by: Peter Xu
---
v2:
- fix it up for young/write/dirty bits too [Konstantin]
---
mm/huge_memory.c | 15 ++-
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index
On Mon, Dec 10, 2018 at 03:09:25PM -0500, Andrea Arcangeli wrote:
> Hello,
>
> On Mon, Dec 10, 2018 at 07:51:16PM +0200, Mike Rapoport wrote:
> > On Mon, Dec 10, 2018 at 02:51:21PM +0800, Peter Xu wrote:
> > > When the process being tracked do mremap() without
> >
@vger.kernel.org
Acked-by: Mike Rapoport
Reviewed-by: Andrea Arcangeli
Signed-off-by: Peter Xu
---
fs/userfaultfd.c | 10 +-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c
index cd58939dc977..4567b5b6fd32 100644
--- a/fs/userfaultfd.c
+++ b/fs
y footprint, but of course
> requires hardware support and lots of new code paths, many of which are
> already being discussed for things like Scalable IOV and SVA. Thanks,
Agree with Jason's and Alex's comments. One trivial additional: the
whole guest RAM will possibly still be pinned for a very short period
during guest system boot (e.g., when running guest BIOS) and before
the guest kernel enables the vIOMMU for the assigned device since the
bootup code like BIOS would still need to be able to access the whole
guest memory.
Thanks,
--
Peter Xu
how to better test the work, etc...
Looking forward to your comments. Thanks,
[1]
https://git.kernel.org/pub/scm/linux/kernel/git/andrea/aa.git/commit/?h=userfault&id=b245ecf6cf59156966f3da6e6b674f6695a5ffa5
Peter Xu (4):
mm: gup: rename "nonblocking" to "locked"
.
It might also benefit other potential users who will have similar
requirement like userfault write-protection.
Please read the thread below for more information.
[1] https://lkml.org/lkml/2017/11/2/833
Suggested-by: Linus Torvalds
Suggested-by: Andrea Arcangeli
Signed-off-by: Peter Xu
---
This is the gup counterpart of the change that allows the VM_FAULT_RETRY
to happen for more than once.
Signed-off-by: Peter Xu
---
mm/gup.c | 17 +
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/mm/gup.c b/mm/gup.c
index 6faff46cd409..8a0e7f9bd29a 100644
--- a/mm
ter suite the
functionality of the variable. While at it, fixing up some of the
comments accordingly.
Signed-off-by: Peter Xu
---
mm/gup.c | 44 +---
mm/hugetlb.c | 8
2 files changed, 25 insertions(+), 27 deletions(-)
diff --git a/mm/gup.c
contains a potential fix for a double-free of mmap_sem on
ARC architecture; please see https://lkml.org/lkml/2018/11/1/723 for
more information)
Suggested-by: Linus Torvalds
Suggested-by: Andrea Arcangeli
Signed-off-by: Peter Xu
---
arch/alpha/mm/fault.c | 2 +-
arch/arc/mm/fault.c
ked because I remember Andrea used to have a custom tree
maintaining that part:
https://github.com/aagit/aa/commit/c761078df7a77d13ddfaeebe56a0f4bc128b1968
Maybe it can't be enabled for some reason that I overlooked in the current
tree, or we just decided to not to?
Thanks,
--
Peter Xu
On Thu, Apr 11, 2024 at 06:55:44PM +0200, Paolo Bonzini wrote:
> On Mon, Apr 8, 2024 at 3:56 PM Peter Xu wrote:
> > Paolo,
> >
> > I may miss a bunch of details here (as I still remember some change_pte
> > patches previously on the list..), however not sure whether
On Tue, Apr 20, 2021 at 10:07:16AM +0200, Paolo Bonzini wrote:
> On 18/04/21 14:43, Peter Xu wrote:
> > 8<-
> > diff --git a/tools/testing/selftests/kvm/dirty_log_test.c
> > b/tools/testing/selftests/kvm/dirty_log_test.c
> > index 25230e799bc4..d3050d1c2cd0
_log_test could fail directly
> on receiving a SIGUSR1 without a handler (when vcpu runs far slower than
> main).
>
> Reported-by: Peter Xu
> Cc: sta...@vger.kernel.org
> Signed-off-by: Paolo Bonzini
Yes, indeed better! :)
Reviewed-by: Peter Xu
--
Peter Xu
On Tue, Apr 20, 2021 at 10:37:39AM -0400, Peter Xu wrote:
> On Tue, Apr 20, 2021 at 04:16:14AM -0400, Paolo Bonzini wrote:
> > The main thread could start to send SIG_IPI at any time, even before signal
> > blocked on vcpu thread. Therefore, start the vcpu thread with the sig
.kernel.org/kvm/20210420081614.684787-1-pbonz...@redhat.com/
Peter Xu (2):
KVM: selftests: Sync data verify of dirty logging with guest sync
KVM: selftests: Wait for vcpu thread before signal setup
tools/testing/selftests/kvm/dirty_log_test.c | 70 +---
1 file changed, 59 insertions(+
.org/lkml/20210413213641.23742-1-pet...@redhat.com/
[2] https://lore.kernel.org/lkml/20210417140956.GV4440@xz-x1/
Cc: Paolo Bonzini
Cc: Sean Christopherson
Cc: Andrew Jones
Signed-off-by: Peter Xu
---
tools/testing/selftests/kvm/dirty_log_test.c | 62
1 file changed, 51 inse
on receiving a SIG_USR1 without a handler (when vcpu runs far slower than main).
Signed-off-by: Peter Xu
---
tools/testing/selftests/kvm/dirty_log_test.c | 8
1 file changed, 8 insertions(+)
diff --git a/tools/testing/selftests/kvm/dirty_log_test.c
b/tools/testing/selftests/kvm
On Tue, Apr 20, 2021 at 06:24:50PM +0200, Paolo Bonzini wrote:
> On 20/04/21 17:32, Peter Xu wrote:
> > On Tue, Apr 20, 2021 at 10:37:39AM -0400, Peter Xu wrote:
> > > On Tue, Apr 20, 2021 at 04:16:14AM -0400, Paolo Bonzini wrote:
> > > > The main thread could sta
ORMAL and _CONTINUE for both
> shmem
> + * and anon, and for both shared and private VMAs.
> */
> -static int mcopy_atomic_install_pte(struct mm_struct *dst_mm, pmd_t *dst_pmd,
> - struct vm_area_struct *dst_vma,
> - unsigned long dst_addr, struct page *page,
> - bool newly_allocated, bool wp_copy)
> +int mcopy_atomic_install_pte(struct mm_struct *dst_mm, pmd_t *dst_pmd,
> + struct vm_area_struct *dst_vma,
> + unsigned long dst_addr, struct page *page,
> + bool newly_allocated, bool wp_copy)
> {
> int ret;
> pte_t _dst_pte, *dst_pte;
> --
> 2.31.1.368.gbe11c130af-goog
>
--
Peter Xu
("vfio/type1: Fix VA->PA translation for PFNMAP VMAs in
> vaddr_get_pfn()")
> Reviewed-by: Jason Gunthorpe
> Reviewed-by: Cornelia Huck
> Signed-off-by: Alex Williamson
Reviewed-by: Peter Xu
--
Peter Xu
On Tue, Feb 26, 2019 at 10:00:29AM +0200, Mike Rapoport wrote:
> On Tue, Feb 26, 2019 at 03:41:17PM +0800, Peter Xu wrote:
> > On Tue, Feb 26, 2019 at 09:29:33AM +0200, Mike Rapoport wrote:
> > > On Tue, Feb 26, 2019 at 02:24:52PM +0800, Peter Xu wrote:
> > > > On M
On Tue, Apr 23, 2019 at 11:34:56AM -0400, Jerome Glisse wrote:
> On Tue, Apr 23, 2019 at 11:00:30AM +0800, Peter Xu wrote:
> > On Mon, Apr 22, 2019 at 10:54:02AM -0400, Jerome Glisse wrote:
> > > On Mon, Apr 22, 2019 at 08:20:10PM +0800, Peter Xu wrote:
> > > > On F
eprotect API to userfaultfd ioctl
Martin Cracauer (1):
userfaultfd: wp: UFFDIO_REGISTER_MODE_WP documentation update
Peter Xu (18):
mm: gup: rename "nonblocking" to "locked" where proper
mm: userfault: return VM_FAULT_RETRY on signals
userfaultfd: don't retake mmap_
ter suite the
functionality of the variable. While at it, fixing up some of the
comments accordingly.
Reviewed-by: Mike Rapoport
Reviewed-by: Jerome Glisse
Signed-off-by: Peter Xu
---
mm/gup.c | 44 +---
mm/hugetlb.c | 8
2 files changed, 25
-by: Linus Torvalds
Reviewed-by: Jerome Glisse
Signed-off-by: Peter Xu
---
fs/userfaultfd.c | 24
1 file changed, 24 deletions(-)
diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c
index 89800fc7dc9d..b397bc3b954d 100644
--- a/fs/userfaultfd.c
+++ b/fs/userfaultfd.c
@@ -514
This is the gup counterpart of the change that allows the VM_FAULT_RETRY
to happen for more than once.
Reviewed-by: Jerome Glisse
Signed-off-by: Peter Xu
---
mm/gup.c | 17 +
mm/hugetlb.c | 6 --
2 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/mm/gup.c
Linus Torvalds
Suggested-by: Andrea Arcangeli
Reviewed-by: Jerome Glisse
Signed-off-by: Peter Xu
---
arch/alpha/mm/fault.c | 2 +-
arch/arc/mm/fault.c | 1 -
arch/arm/mm/fault.c | 3 ---
arch/arm64/mm/fault.c | 5
arch/hexagon/mm/vm_faul
t certainly worth to achieve it
but in a later incremental patch.
v3: Add hooking point for THP wrprotect faults.
CC: Shaohua Li
Signed-off-by: Andrea Arcangeli
[peterx: don't conditionally drop FAULT_FLAG_WRITE in do_swap_page]
Reviewed-by: Mike Rapoport
Reviewed-by: Jerome Glisse
Signed-
to handle nonfatal
signals faster than before.
This patch is a preparation work for the next patch to finally remove
the special code path mentioned above in handle_userfault().
Suggested-by: Linus Torvalds
Suggested-by: Andrea Arcangeli
Reviewed-by: Jerome Glisse
Signed-off-by: Peter Xu
---
by: Jerome Glisse
Reviewed-by: Mike Rapoport
Signed-off-by: Peter Xu
---
fs/userfaultfd.c | 5 +++--
include/linux/userfaultfd_k.h| 2 +-
include/uapi/linux/userfaultfd.h | 11 +-
mm/userfaultfd.c | 36 ++--
4 files chang
ome Glisse
Reviewed-by: Mike Rapoport
Signed-off-by: Peter Xu
---
include/linux/userfaultfd_k.h | 27 +++
1 file changed, 27 insertions(+)
diff --git a/include/linux/userfaultfd_k.h b/include/linux/userfaultfd_k.h
index 38f748e7186e..c6590c58ce28 100644
--- a/include/li
ameters to change_protection(). In the follow up
patches, a new parameter for userfaultfd write protection will be
introduced.
No functional change at all.
Reviewed-by: Jerome Glisse
Signed-off-by: Peter Xu
---
include/linux/huge_mm.h | 2 +-
include/linux/mm.h | 14 +-
mm/huge_memory.c
Glisse
Reviewed-by: Mike Rapoport
Signed-off-by: Peter Xu
---
include/linux/userfaultfd_k.h | 10 ++
1 file changed, 10 insertions(+)
diff --git a/include/linux/userfaultfd_k.h b/include/linux/userfaultfd_k.h
index 37c9eba75c98..38f748e7186e 100644
--- a/include/linux/userfaultfd_k.h
+++ b
ay on that, we'd
need to stay on the safe side and generate false positive wp faults
for every swapped out page.
Signed-off-by: Andrea Arcangeli
[peterx: append _PAGE_UFD_WP to _PAGE_CHG_MASK]
Reviewed-by: Jerome Glisse
Reviewed-by: Mike Rapoport
Signed-off-by: Peter Xu
---
arch/x
t to
resolve an uffd-wp page fault always. That matches what we do with
general huge PMD write protections. In that way, we resolved the huge
PMD copy-on-write issue into PTE copy-on-write.
Signed-off-by: Peter Xu
---
mm/memory.c | 5 -
mm/
Adding these missing helpers for uffd-wp operations with pmd
swap/migration entries.
Reviewed-by: Jerome Glisse
Reviewed-by: Mike Rapoport
Signed-off-by: Peter Xu
---
arch/x86/include/asm/pgtable.h | 15 +++
include/asm-generic/pgtable_uffd.h | 15 +++
2 files
page faults in either
do_wp_page() or wp_huge_pmd().
Reviewed-by: Jerome Glisse
Reviewed-by: Mike Rapoport
Signed-off-by: Peter Xu
---
include/linux/mm.h | 5 +
mm/huge_memory.c | 14 +-
mm/memory.c| 4 ++--
mm/mprotect.c | 12
mm/userfaultfd.c | 8
ngeli
[peterx:
- use the helper to find VMA;
- return -ENOENT if not found to match mcopy case;
- use the new MM_CP_UFFD_WP* flags for change_protection
- check against mmap_changing for failures]
Reviewed-by: Jerome Glisse
Reviewed-by: Mike Rapoport
Signed-off-by: Peter Xu
---
include/
same thing needs to be considered for swap entries and migration
entries. So do the check as well disregarding khugepaged_max_ptes_swap.
Reviewed-by: Jerome Glisse
Reviewed-by: Mike Rapoport
Signed-off-by: Peter Xu
---
include/trace/events/huge_memory.h | 1 +
mm/khugepaged.c
is a swap
entry. That can lead to data mismatch if the page that we are going
to write protect is swapped out when sending the UFFDIO_WRITEPROTECT.
This patch also applies/removes the uffd-wp bit even for the swap
entries.
Signed-off-by: Peter Xu
---
include/linux/swapops.h | 2 ++
mm/huge_memor
: Jerome Glisse
Reviewed-by: Mike Rapoport
Signed-off-by: Peter Xu
---
mm/huge_memory.c | 8
mm/memory.c | 8
2 files changed, 16 insertions(+)
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 3885747d4901..cf8f11d6e6cd 100644
--- a/mm/huge_memory.c
+++ b/mm
Mike Rapoport
Signed-off-by: Peter Xu
---
mm/userfaultfd.c | 54 +++-
1 file changed, 30 insertions(+), 24 deletions(-)
diff --git a/mm/userfaultfd.c b/mm/userfaultfd.c
index 240de2a8492d..2606409572b2 100644
--- a/mm/userfaultfd.c
+++ b/mm/userfaul
somewhere else when resolving the userfault page fault.
Signed-off-by: Peter Xu
---
include/linux/mm.h | 2 ++
mm/memory.c| 8
2 files changed, 10 insertions(+)
diff --git a/include/linux/mm.h b/include/linux/mm.h
index a5ac81188523..a2911de04cdd 100644
--- a/include/linux/mm.h
+++ b
From: Martin Cracauer
Adds documentation about the write protection support.
Signed-off-by: Martin Cracauer
Signed-off-by: Andrea Arcangeli
[peterx: rewrite in rst format; fixups here and there]
Reviewed-by: Jerome Glisse
Reviewed-by: Mike Rapoport
Signed-off-by: Peter Xu
erome Glisse
Signed-off-by: Peter Xu
---
fs/userfaultfd.c | 82 +---
include/uapi/linux/userfaultfd.h | 23 +
2 files changed, 89 insertions(+), 16 deletions(-)
diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c
index 3092885c9d2c..81962d62520c 1
ed-by: Jerome Glisse
Reviewed-by: Mike Rapoport
Signed-off-by: Peter Xu
---
include/uapi/linux/userfaultfd.h | 6 --
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/include/uapi/linux/userfaultfd.h b/include/uapi/linux/userfaultfd.h
index 95c4a160e5f8..e7e98bde221f 100644
--- a/in
It does not make sense to try to wake up any waiting thread when we're
write-protecting a memory region. Only wake up when resolving a write
protected page fault.
Reviewed-by: Mike Rapoport
Signed-off-by: Peter Xu
---
fs/userfaultfd.c | 13 -
1 file changed, 8 insertions(
ious tests but will do MISSING+WP for each page. For
sigbus-mode test we'll need to provide standalone path to handle the
write protection faults.
For all tests, do statistics as well for uffd-wp pages.
Signed-off-by: Peter Xu
---
tools/testing/selftests/vm/user
bit if the register mode has MODE_WP.
Reviewed-by: Mike Rapoport
Signed-off-by: Peter Xu
---
fs/userfaultfd.c | 16 +---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c
index f1f61a0278c2..7f87e9e4fb9b 100644
--- a/fs/userfaultfd.
structure, it's very easy to introduce new statistics.
Reviewed-by: Mike Rapoport
Signed-off-by: Peter Xu
---
tools/testing/selftests/vm/userfaultfd.c | 76 +++-
1 file changed, 49 insertions(+), 27 deletions(-)
diff --git a/tools/testing/selftests/vm/userfaultfd.c
b/
t this to "kvm" to restrict userfaultfd system call usage to users with
^
add " who have ptrace capability, or" -------+
> permissions to open "/dev/kvm".
I think your version is better than mine, but I'd like to confirm
about above two extra changes before I squash them into the patch. :)
Thanks!
--
Peter Xu
On Tue, Mar 12, 2019 at 09:01:47AM +0200, Mike Rapoport wrote:
> Hi Peter,
>
> On Mon, Mar 11, 2019 at 05:36:58PM +0800, Peter Xu wrote:
> > Hi,
> >
> > (The idea comes from Andrea, and following discussions with Mike and
> > other people)
> >
> >
Hi, Kirill,
On Tue, Mar 12, 2019 at 10:49:51AM +0300, Kirill A. Shutemov wrote:
> On Mon, Mar 11, 2019 at 05:36:58PM +0800, Peter Xu wrote:
> > Hi,
> >
> > (The idea comes from Andrea, and following discussions with Mike and
> > other people)
> >
> > Thi
On Tue, Mar 12, 2019 at 12:59:34PM -0700, Mike Kravetz wrote:
> On 3/11/19 2:36 AM, Peter Xu wrote:
> >
> > The "kvm" entry is a bit special here only to make sure that existing
> > users like QEMU/KVM won't break by this newly introduced flag. What
On Wed, Mar 13, 2019 at 10:50:48AM -0700, Mike Kravetz wrote:
> On 3/12/19 11:00 PM, Peter Xu wrote:
> > On Tue, Mar 12, 2019 at 12:59:34PM -0700, Mike Kravetz wrote:
> >> On 3/11/19 2:36 AM, Peter Xu wrote:
> >>>
> >>> The "kvm" entry i
ed by simply using atomic_read() or even
READ_ONCE() (I feel like we don't need atomic ops with dma_avail
because we've had the mutex but it of course it doesn't hurt...) to
replace atomic_add_unless() above to check against zero then we do
+1/-1 in vfio_[un]link_dma() only.
On Mon, Apr 01, 2019 at 10:34:13PM -0600, Alex Williamson wrote:
> On Tue, 2 Apr 2019 10:41:15 +0800
> Peter Xu wrote:
>
> > On Mon, Apr 01, 2019 at 02:16:52PM -0600, Alex Williamson wrote:
> >
> > [...]
> >
> > > @@ -1081,8 +1088,14 @@ st
pected to be well in excess of any reasonable use
> case (a large virtual machine configuration would typically only make
> use of tens of concurrent mappings).
>
> This fixes CVE-2019-3882.
>
> Signed-off-by: Alex Williamson
Reviewed-by: Peter Xu
Thanks,
--
Peter Xu
On Wed, Mar 20, 2019 at 10:06:14AM +0800, Peter Xu wrote:
> This series implements initial write protection support for
> userfaultfd. Currently both shmem and hugetlbfs are not supported
> yet, but only anonymous memory. This is the 3nd version of it.
>
> The latest code can a
On Mon, Feb 25, 2019 at 05:58:37PM +0200, Mike Rapoport wrote:
> On Tue, Feb 12, 2019 at 10:56:16AM +0800, Peter Xu wrote:
> > From: Andrea Arcangeli
> >
> > This allows UFFDIO_COPY to map pages wrprotected.
>write p
On Mon, Feb 25, 2019 at 10:52:34PM +0200, Mike Rapoport wrote:
> On Tue, Feb 12, 2019 at 10:56:26AM +0800, Peter Xu wrote:
> > From: Shaohua Li
> >
> > Add API to enable/disable writeprotect a vma range. Unlike mprotect,
> > this doesn't split/merge vmas.
>
On Mon, Feb 25, 2019 at 11:09:35PM +0200, Mike Rapoport wrote:
> On Tue, Feb 12, 2019 at 10:56:29AM +0800, Peter Xu wrote:
> > It does not make sense to try to wake up any waiting thread when we're
> > write-protecting a memory region. Only wake up when resolving a write
>
On Mon, Feb 25, 2019 at 11:03:51PM +0200, Mike Rapoport wrote:
> On Tue, Feb 12, 2019 at 10:56:27AM +0800, Peter Xu wrote:
> > From: Andrea Arcangeli
> >
> > v1: From: Shaohua Li
> >
> > v2: cleanups, remove a branch.
> >
> > [peterx writes up t
On Mon, Feb 25, 2019 at 11:19:32PM +0200, Mike Rapoport wrote:
> On Tue, Feb 12, 2019 at 10:56:30AM +0800, Peter Xu wrote:
> > From: Martin Cracauer
> >
> > Adds documentation about the write protection support.
> >
> > Signed-off-by: Andrea Arcangeli
> >
On Tue, Feb 26, 2019 at 08:43:47AM +0200, Mike Rapoport wrote:
> On Tue, Feb 26, 2019 at 02:06:27PM +0800, Peter Xu wrote:
> > On Mon, Feb 25, 2019 at 10:52:34PM +0200, Mike Rapoport wrote:
> > > On Tue, Feb 12, 2019 at 10:56:26AM +0800, Peter Xu wrote:
> &
On Tue, Feb 26, 2019 at 09:29:33AM +0200, Mike Rapoport wrote:
> On Tue, Feb 26, 2019 at 02:24:52PM +0800, Peter Xu wrote:
> > On Mon, Feb 25, 2019 at 11:09:35PM +0200, Mike Rapoport wrote:
> > > On Tue, Feb 12, 2019 at 10:56:29AM +0800, Peter Xu wrote:
> > > > It
On Tue, Feb 26, 2019 at 09:04:25AM +0200, Mike Rapoport wrote:
> On Tue, Feb 26, 2019 at 02:53:42PM +0800, Peter Xu wrote:
> > On Mon, Feb 25, 2019 at 11:19:32PM +0200, Mike Rapoport wrote:
> > > On Tue, Feb 12, 2019 at 10:56:30AM +0800, Peter Xu wrote:
> > &
On Tue, Feb 26, 2019 at 08:58:36AM +0200, Mike Rapoport wrote:
> On Tue, Feb 12, 2019 at 10:56:32AM +0800, Peter Xu wrote:
> > This patch adds uffd tests for write protection.
> >
> > Instead of introducing new tests for it, let's simply squashing uffd-wp
> > tests
which did validate_range() first, then
> > in __mcopy_atomic() we've used BUG_ON()s. They make sense to me
> > becauase userspace should never be able to trigger it. And if we
> > really want to change the BUG_ON()s in this patch, IMHO we probably
> > want to change the other BUG_ON()s as well, then that can be a
> > standalone patch or patchset to address another issue...
>
> Yeah, we have quite a lot of them, so doing the replacement in a separate
> patch makes perfect sense.
>
> > (and if we really want to use WARN_ON, I would prefer WARN_ON_ONCE, or
> > directly return the errors to avoid DOS).
>
> Agree.
>
> > I'll see how you'd prefer to see how I should move on with this patch.
>
> Let's keep this patch as is and make the replacement on top of the WP
> series. Feel free to add r-b.
Great! I'll do. Thanks,
--
Peter Xu
1 - 100 of 1278 matches
Mail list logo