Skip to contentSkip to conversation

tools/libfsimage: Remove the XEN_FSIMAGE_FSDIR environment variable

PATCH In review Andrew Cooper 4 participants 4 messages Jul 2 – Jul 3

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/libfsimage: Remove the XEN_FSIMAGE_FSDIR environment variable

This was reported to the security team, demonstrating that code execution could be achieved, but without a demonstration of a priviliege boundary being bypassed.

Still, it's a high risk path with no obvious evidence of having been used even for debugging, so remove the environment variable and use the build time $(libdir)/xenfsimage path only.

---
CC: Anthony PERARD <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Julien Grall <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Oleksii Kurochko <[email protected]>

For 4.22. This was supposed to be posted earlier but fell through the cracks. Given it's borderline-security aspect, we don't want to delay it any further.

---
 CHANGELOG.md                             | 1 +
 tools/libfsimage/common/fsimage_plugin.c | 5 +----
 2 files changed, 2 insertions(+), 4 deletions(-)
CHANGELOG.md +1 -0
index ef4e6ae9c459..0a4e5f013cb1 100644
@@ -63,6 +63,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 
  - Removed xenpm tool on non-x86 platforms as it doesn't actually provide
    anything useful outside of x86.
+ - Removed the XEN_FSIMAGE_FSDIR environment variable.
 
 ## [4.21.0](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.21.0) - 2025-11-19
 
tools/libfsimage/common/fsimage_plugin.c +1 -4
index d0cb9e96a654..539dc247356a 100644
@@ -121,7 +121,7 @@ static int init_plugin(const char *lib)
 
 int fsi_init(void)
 {
-	const char *fsdir = getenv("XEN_FSIMAGE_FSDIR");
+	const char *fsdir = FSIMAGE_FSDIR;
 	struct dirent *dp = NULL;
 	DIR *dir = NULL;
 	char *tmp = NULL;
@@ -129,9 +129,6 @@ int fsi_init(void)
 	int err;
 	int ret = -1;
 
-	if (fsdir == NULL)
-		fsdir = FSIMAGE_FSDIR;
-
 	if ((name_max = pathconf(fsdir, _PC_NAME_MAX)) == -1)
 		goto fail;
 

base-commit: ad9f564a5d840389cbf1b230086e1dd8257d8820

Signature · 1 line
2.39.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Andrew Cooper

This was reported to the security team, demonstrating that code execution could be achieved, but without a demonstration of a priviliege boundary being bypassed.

Still, it's a high risk path with no obvious evidence of having been used even for debugging, so remove the environment variable and use the build time $(libdir)/xenfsimage path only.

Thanks, Roger.

Acked-by on v1 1/1
#2 lore raw
In reply to Andrew Cooper
Quoted 18 lines · Andrew Cooper

This was reported to the security team, demonstrating that code execution could be achieved, but without a demonstration of a priviliege boundary being bypassed.

Still, it's a high risk path with no obvious evidence of having been used even for debugging, so remove the environment variable and use the build time $(libdir)/xenfsimage path only.

---
CC: Anthony PERARD <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Julien Grall <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Oleksii Kurochko <[email protected]>

Quoted 3 lines

For 4.22. This was supposed to be posted earlier but fell through the cracks. Given it's borderline-security aspect, we don't want to delay it any further.
---

Quoted 9 lines
  CHANGELOG.md                             | 1 +
  tools/libfsimage/common/fsimage_plugin.c | 5 +----
  2 files changed, 2 insertions(+), 4 deletions(-)
CHANGELOG.md +0 -0
index ef4e6ae9c459..0a4e5f013cb1 100644

CHANGELOG.md The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) · line 69

Quoted 7 lines
CHANGELOG.md +1 -0
@@ -63,6 +63,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 
   - Removed xenpm tool on non-x86 platforms as it doesn't actually provide
     anything useful outside of x86.
+ - Removed the XEN_FSIMAGE_FSDIR environment variable.
 
  ## [4.21.0](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.21.0) - 2025-11-19
 
Quoted 24 lines
tools/libfsimage/common/fsimage_plugin.c +1 -4
index d0cb9e96a654..539dc247356a 100644
@@ -121,7 +121,7 @@ static int init_plugin(const char *lib)
 
  int fsi_init(void)
  {
-	const char *fsdir = getenv("XEN_FSIMAGE_FSDIR");
+	const char *fsdir = FSIMAGE_FSDIR;
  	struct dirent *dp = NULL;
  	DIR *dir = NULL;
  	char *tmp = NULL;
@@ -129,9 +129,6 @@ int fsi_init(void)
  	int err;
  	int ret = -1;
 
-	if (fsdir == NULL)
-		fsdir = FSIMAGE_FSDIR;
-
  	if ((name_max = pathconf(fsdir, _PC_NAME_MAX)) == -1)
  		goto fail;
 
Quoted 1 line

base-commit: ad9f564a5d840389cbf1b230086e1dd8257d8820

~ Oleksii

Acked-by on v1 1/1
#3 lore raw
In reply to Andrew Cooper
Quoted 9 lines · Andrew Cooper

This was reported to the security team, demonstrating that code execution could be achieved, but without a demonstration of a priviliege boundary being bypassed.

Still, it's a high risk path with no obvious evidence of having been used even for debugging, so remove the environment variable and use the build time $(libdir)/xenfsimage path only.

Thanks,

--
Anthony Perard | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech