Re: [RFC PATCH v2 35/47] userfaultfd: require UFFD_FEATURE_EXACT_ADDRESS when using HugeTLB HGM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Oct 21, 2022 at 04:36:51PM +0000, James Houghton wrote:
> @@ -1990,6 +1990,17 @@ static int userfaultfd_api(struct userfaultfd_ctx *ctx,
>  		~(UFFD_FEATURE_MINOR_HUGETLBFS | UFFD_FEATURE_MINOR_SHMEM);
>  #ifndef CONFIG_HUGETLB_HIGH_GRANULARITY_MAPPING
>  	uffdio_api.features &= ~UFFD_FEATURE_MINOR_HUGETLBFS_HGM;
> +#else
> +
> +	ret = -EINVAL;
> +	if ((uffdio_api.features & UFFD_FEATURE_MINOR_HUGETLBFS_HGM) &&
> +	    !(uffdio_api.features & UFFD_FEATURE_EXACT_ADDRESS))

This check needs to be done upon "features" or "ctx_features", rather than
"uffdio_api.features".  The latter is the one we'll report to the user only.

> +		/*
> +		 * UFFD_FEATURE_MINOR_HUGETLBFS_HGM is mostly
> +		 * useless without UFFD_FEATURE_EXACT_ADDRESS,
> +		 * so require userspace to provide both.
> +		 */
> +		goto err_out;
>  #endif  /* CONFIG_HUGETLB_HIGH_GRANULARITY_MAPPING */
>  #endif  /* CONFIG_HAVE_ARCH_USERFAULTFD_MINOR */
>  
> -- 
> 2.38.0.135.g90850a2211-goog
> 
> 

-- 
Peter Xu





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux