[PATCH v2 3/3] eal/linux: Check hugepage access permissions

Burakov, Anatoly anatoly.burakov at intel.com
Mon Oct 13 14:43:32 CEST 2025


On 8/14/2025 11:32 PM, Jake Freeland wrote:
> Currently, hugepage mountpoints will be used irrespective of permissions,
> leading to potential EACCES errors during memory allocation. Fix this by
> not using a mountpoint if we do not have read/write permissions on it.
> 
> Signed-off-by: Jake Freeland <jfree at FreeBSD.org>
> ---
>   lib/eal/linux/eal_hugepage_info.c | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/lib/eal/linux/eal_hugepage_info.c b/lib/eal/linux/eal_hugepage_info.c
> index d47a19c56a..e2ddd6218b 100644
> --- a/lib/eal/linux/eal_hugepage_info.c
> +++ b/lib/eal/linux/eal_hugepage_info.c
> @@ -260,6 +260,13 @@ get_hugepage_dir(uint64_t hugepage_sz, char *hugedir, int len)
>   				continue;
>   		}
>   
> +		if (access(splitstr[MOUNTPT], R_OK | W_OK) < 0) {
> +			EAL_LOG(NOTICE,
> +				"Skipping hugepage dir '%s': missing r/w perms",

Perhaps should be reworded as:

Skipping hugepage directory '%s': missing R/W permissions"

Otherwise,

Acked-by: Anatoly Burakov <anatoly.burakov at intel.com>

> +				splitstr[MOUNTPT]);
> +			continue;
> +		}
> +
>   		/*
>   		 * If no --huge-dir option has been given, we're done.
>   		 */


-- 
Thanks,
Anatoly


More information about the dev mailing list