ARM64: Adding write-protect bit for Userfaultfd

Mohamed Husain Noor Mohamed nkhusain at vt.edu
Wed May 17 08:43:29 PDT 2023


Hi Catalin,

Thanks for the feedback.

We were able to implement the feature with bits 60 and 61. As you
mentioned we made it a conditional feature.

PTE_UFFD_WP -> 60
PTE_SWP_UFFD_WP -> 61

We want to submit the patch(pull request) since our research requires
this feature in the vanilla kernel. Could you please share the steps
for that?

Thanks,
Mohamed

On Tue, May 2, 2023 at 9:36 AM Catalin Marinas <catalin.marinas at arm.com> wrote:
>
> On Fri, Apr 28, 2023 at 01:35:44PM -0400, Mohamed Husain Noor Mohamed wrote:
> > I am Mohamed Husain. I am a graduate student, working on a research
> > project using a userfaultfd for distributed shared memory.
> > We are trying to use Write-Protect mode in ARM64 but based on the
> > kernel commits we see the support only exists for the x86 kernel.
> > https://lwn.net/Articles/777258/
> >
> > I am trying to add the write-protect support, so I am looking for the
> > unused bits in the PTE. Do you guys have any suggestions on the bits I
> > could use, or does it require hardware support?
>
> Unfortunately, we are pretty short on bits. The architecture only gives
> us bits 55 to 58 and they are all used. We could move PTE_PROT_NONE to
> another position (e.g. 60) since this is only used when !PTE_VALID and
> therefore doesn't affect the actual page attributes and free up a bit.
>
> Alternatively, we could hijack bits 59-62 but there may be out of tree
> patches making use of the PBHA imp def feature (AFAICT disabled on the
> mainline kernel). Well, I guess one could make the userfaultfd wp
> feature conditional.
>
> Cc'ing Anshuman as well, I think he looked at soft-dirty ptes for arm64
> before for CRIU live migration and we concluded that userfaultfd was
> better but I didn't realise that the write-protect mechanism needs its
> own PTE bit as well.
>
> --
> Catalin



More information about the linux-arm-kernel mailing list