From 59800214b19f5a4e0b7eaead55eb74d39d82e0a4 Mon Sep 17 00:00:00 2001 From: Vijay Dhanraj Date: Mon, 8 Jul 2019 13:56:07 -0700 Subject: [PATCH] DM: Increase hugetlbfs MAX_PATH_LEN from 128 to 256 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Current hugetlbfs code has a limitation on file path length. The path string comprises of mount path + vm name. Something like /run/hugepage/acrn/huge_lv1/vm1. To this UUID (32 bytes) is added and the total path length should be less than 128. This works fine but in cases where the VM name is large as in case kata, this check fails. Kata passes a sandbox-id as VM name and so path + 32 for UUID easily exceed 128 bytes. “/run/hugepage/acrn/huge_lv1/ sandbox-6d455fa48788eae82dee42410fc3d38849c2a5196f930b3d6944805aed8d24c7" To address this, increase the size of MAX_PATH_LEN from 128 to 256 bytes. Tracked-On: #3379 Signed-off-by: Vijay Dhanraj Acked-by: Anthony Xu --- devicemodel/core/hugetlb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/devicemodel/core/hugetlb.c b/devicemodel/core/hugetlb.c index 5b1e812af..bcd54dfce 100644 --- a/devicemodel/core/hugetlb.c +++ b/devicemodel/core/hugetlb.c @@ -45,7 +45,7 @@ extern char *vmname; #define HUGETLB_LV2 1 #define HUGETLB_LV_MAX 2 -#define MAX_PATH_LEN 128 +#define MAX_PATH_LEN 256 #define HUGETLBFS_MAGIC 0x958458f6 @@ -410,7 +410,7 @@ static int mount_hugetlbfs(int level) static void umount_hugetlbfs(int level) { char path[MAX_PATH_LEN]; - + if (level >= HUGETLB_LV_MAX) { perror("exceed max hugetlb level"); return;