[PATCH 0/3 v2] fs/proc: extend the PAGEMAP_SCAN ioctl to report guard regions

Andrei Vagin posted 3 patches 8 months, 4 weeks ago
Documentation/admin-guide/mm/pagemap.rst   |  1 +
fs/proc/task_mmu.c                         | 17 ++++---
include/uapi/linux/fs.h                    |  1 +
tools/include/uapi/linux/fs.h              | 19 +++++++-
tools/testing/selftests/mm/guard-regions.c | 57 ++++++++++++++++++++++
5 files changed, 87 insertions(+), 8 deletions(-)
[PATCH 0/3 v2] fs/proc: extend the PAGEMAP_SCAN ioctl to report guard regions
Posted by Andrei Vagin 8 months, 4 weeks ago
Introduce the PAGE_IS_GUARD flag in the PAGEMAP_SCAN ioctl to expose
information about guard regions. This allows userspace tools, such as
CRIU, to detect and handle guard regions.

Currently, CRIU utilizes PAGEMAP_SCAN as a more efficient alternative to
parsing /proc/pid/pagemap. Without this change, guard regions are
incorrectly reported as swap-anon regions, leading CRIU to attempt
dumping them and subsequently failing.

This series should be applied on top of "[PATCH 0/2] fs/proc/task_mmu:
add guard region bit to pagemap":
https://lore.kernel.org/all/2025031926-engraved-footer-3e9b@gregkh/T/

The series includes updates to the documentation and selftests to
reflect the new functionality.

v2:
- sync linux/fs.h with the kernel sources
- address comments from Lorenzo and David.

Andrei Vagin (3):
  fs/proc: extend the PAGEMAP_SCAN ioctl to report guard regions
  tools headers UAPI: Sync linux/fs.h with the kernel sources
  selftests/mm: add PAGEMAP_SCAN guard region test

 Documentation/admin-guide/mm/pagemap.rst   |  1 +
 fs/proc/task_mmu.c                         | 17 ++++---
 include/uapi/linux/fs.h                    |  1 +
 tools/include/uapi/linux/fs.h              | 19 +++++++-
 tools/testing/selftests/mm/guard-regions.c | 57 ++++++++++++++++++++++
 5 files changed, 87 insertions(+), 8 deletions(-)

-- 
2.49.0.rc1.451.g8f38331e32-goog
Re: [PATCH 0/3 v2] fs/proc: extend the PAGEMAP_SCAN ioctl to report guard regions
Posted by Lorenzo Stoakes 8 months, 3 weeks ago
On Mon, Mar 24, 2025 at 06:53:25AM +0000, Andrei Vagin wrote:
> Introduce the PAGE_IS_GUARD flag in the PAGEMAP_SCAN ioctl to expose
> information about guard regions. This allows userspace tools, such as
> CRIU, to detect and handle guard regions.
>
> Currently, CRIU utilizes PAGEMAP_SCAN as a more efficient alternative to
> parsing /proc/pid/pagemap. Without this change, guard regions are
> incorrectly reported as swap-anon regions, leading CRIU to attempt
> dumping them and subsequently failing.
>
> This series should be applied on top of "[PATCH 0/2] fs/proc/task_mmu:
> add guard region bit to pagemap":
> https://lore.kernel.org/all/2025031926-engraved-footer-3e9b@gregkh/T/
>
> The series includes updates to the documentation and selftests to
> reflect the new functionality.
>
> v2:
> - sync linux/fs.h with the kernel sources
> - address comments from Lorenzo and David.

Thanks, sorry for delay, LSF/MM/BPF is why :)
>
> Andrei Vagin (3):
>   fs/proc: extend the PAGEMAP_SCAN ioctl to report guard regions
>   tools headers UAPI: Sync linux/fs.h with the kernel sources
>   selftests/mm: add PAGEMAP_SCAN guard region test
>
>  Documentation/admin-guide/mm/pagemap.rst   |  1 +
>  fs/proc/task_mmu.c                         | 17 ++++---
>  include/uapi/linux/fs.h                    |  1 +
>  tools/include/uapi/linux/fs.h              | 19 +++++++-
>  tools/testing/selftests/mm/guard-regions.c | 57 ++++++++++++++++++++++
>  5 files changed, 87 insertions(+), 8 deletions(-)
>
> --
> 2.49.0.rc1.451.g8f38331e32-goog
>
Re: [PATCH 0/3 v2] fs/proc: extend the PAGEMAP_SCAN ioctl to report guard regions
Posted by Andrei Vagin 8 months, 3 weeks ago
On Mon, Mar 31, 2025 at 4:26 AM Lorenzo Stoakes
<lorenzo.stoakes@oracle.com> wrote:
>
> On Mon, Mar 24, 2025 at 06:53:25AM +0000, Andrei Vagin wrote:
> > Introduce the PAGE_IS_GUARD flag in the PAGEMAP_SCAN ioctl to expose
> > information about guard regions. This allows userspace tools, such as
> > CRIU, to detect and handle guard regions.
> >
> > Currently, CRIU utilizes PAGEMAP_SCAN as a more efficient alternative to
> > parsing /proc/pid/pagemap. Without this change, guard regions are
> > incorrectly reported as swap-anon regions, leading CRIU to attempt
> > dumping them and subsequently failing.
> >
> > This series should be applied on top of "[PATCH 0/2] fs/proc/task_mmu:
> > add guard region bit to pagemap":
> > https://lore.kernel.org/all/2025031926-engraved-footer-3e9b@gregkh/T/
> >
> > The series includes updates to the documentation and selftests to
> > reflect the new functionality.
> >
> > v2:
> > - sync linux/fs.h with the kernel sources
> > - address comments from Lorenzo and David.
>
> Thanks, sorry for delay, LSF/MM/BPF is why :)

Yep, I know. I hope it was productive. You mentioned in another thread that
you are going to handle compatibility for the older kernel. Let me know if I can
help with anything.

Thanks for your cooperation.