All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tools/xl: don't crash on NULL command line
@ 2025-07-28 10:24 Marek Marczykowski-Górecki
  2025-07-28 10:45 ` Andrew Cooper
  2025-07-28 12:11 ` Roger Pau Monné
  0 siblings, 2 replies; 8+ messages in thread
From: Marek Marczykowski-Górecki @ 2025-07-28 10:24 UTC (permalink / raw)
  To: xen-devel; +Cc: Andrew Cooper, Marek Marczykowski-Górecki, Anthony PERARD

When running xl in a domU, it doesn't have access to the Xen command
line. Before the non-truncating xc_xenver_cmdline(), it was always set
with strdup, possibly of an empty string. Now it's NULL. Treat it the
same as empty cmdline, as it was before. Autoballoon isn't relevant for
xl devd in a domU anyway.

Fixes: 75f91607621c ("tools: Introduce a non-truncating xc_xenver_cmdline()")
Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
So, apparently the "No API/ABI change" was a lie... it changed "empty
string" to NULL in libxl_version_info->commandline. Quick search didn't
spot any other (in-tree) place that could trip on NULL there. IMO NULL
value in this case makes more sense. Buf maybe for the API stability
reasons the old behavior should be restored?

PS I'm working on a CI test for this case (and driver domains in
general). I have it working with Alpine already, but it wouldn't detect
this issue, as musl's regexec() doesn't crash on NULL... So, I'll add a
test on Debian too.
---
 tools/xl/xl.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/xl/xl.c b/tools/xl/xl.c
index ec72ca60c32a..e183d42b1d65 100644
--- a/tools/xl/xl.c
+++ b/tools/xl/xl.c
@@ -81,6 +81,8 @@ static int auto_autoballoon(void)
     info = libxl_get_version_info(ctx);
     if (!info)
         return 1; /* default to on */
+    if (!info->commandline)
+        return 1;
 
 #define SIZE_PATTERN "-?[0-9]+[bBkKmMgGtT]?"
 
-- 
2.49.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-07-31  9:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-28 10:24 [PATCH] tools/xl: don't crash on NULL command line Marek Marczykowski-Górecki
2025-07-28 10:45 ` Andrew Cooper
2025-07-28 10:50   ` Frediano Ziglio
2025-07-28 10:54     ` Jan Beulich
2025-07-29  0:29   ` Jason Andryuk
2025-07-29  6:55     ` Andrew Cooper
2025-07-28 12:11 ` Roger Pau Monné
2025-07-31  9:45   ` Anthony PERARD

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.