lkml.org 
[lkml]   [2023]   [Feb]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v10 1/9] mm: Introduce memfd_restricted system call to create restricted user memory
> > int restrictedmem_bind(struct file *file, pgoff_t start, pgoff_t end,
> > struct restrictedmem_notifier *notifier, bool exclusive)
> > {
> > struct restrictedmem *rm = file->f_mapping->private_data;
> > int ret = -EINVAL;
> >
> > down_write(&rm->lock);
> >
> > /* Non-exclusive mappings are not yet implemented. */
> > if (!exclusive)
> > goto out_unlock;
> >
> > if (!xa_empty(&rm->bindings)) {
> > if (exclusive != rm->exclusive)
> > goto out_unlock;
> >
> > if (exclusive && xa_find(&rm->bindings, &start, end, XA_PRESENT))
> > goto out_unlock;
> > }
> >
> > xa_store_range(&rm->bindings, start, end, notifier, GFP_KERNEL);
>
>
> || ld: mm/restrictedmem.o: in function `restrictedmem_bind':
> mm/restrictedmem.c|295| undefined reference to `xa_store_range'

Right, xa_store_range() is only available for XARRAY_MULTI.

>
>
> This is missing:
> ===
> diff --git a/mm/Kconfig b/mm/Kconfig
> index f952d0172080..03aca542c0da 100644
> --- a/mm/Kconfig
> +++ b/mm/Kconfig
> @@ -1087,6 +1087,7 @@ config SECRETMEM
> config RESTRICTEDMEM
> bool
> depends on TMPFS
> + select XARRAY_MULTI
> ===
>
> Thanks,
>
>
>
> > rm->exclusive = exclusive;
> > ret = 0;
> > out_unlock:
> > up_write(&rm->lock);
> > return ret;
> > }
> > EXPORT_SYMBOL_GPL(restrictedmem_bind);
> >
> > void restrictedmem_unbind(struct file *file, pgoff_t start, pgoff_t end,
> > struct restrictedmem_notifier *notifier)
> > {
> > struct restrictedmem *rm = file->f_mapping->private_data;
> >
> > down_write(&rm->lock);
> > xa_store_range(&rm->bindings, start, end, NULL, GFP_KERNEL);
> > synchronize_rcu();
> > up_write(&rm->lock);
> > }
> > EXPORT_SYMBOL_GPL(restrictedmem_unbind);
>
> --
> Alexey

\
 
 \ /
  Last update: 2023-03-27 00:34    [W:0.578 / U:0.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site