From: arraybolt3@gmail.com
To: grub-devel@gnu.org, xen-devel@lists.xenproject.org
Cc: Aaron Rainbolt <arraybolt3@gmail.com>
Subject: [PATCH v5 2/3] include/xen: Add warning comment for cmd_line
Date: Wed, 13 Aug 2025 20:36:44 -0500 [thread overview]
Message-ID: <20250814013645.2488043-3-arraybolt3@gmail.com> (raw)
In-Reply-To: <20250814013645.2488043-1-arraybolt3@gmail.com>
From: Aaron Rainbolt <arraybolt3@gmail.com>
The cmd_line field of the start_info struct is not guaranteed to be
NUL-terminated, even though it is intended to contain a NUL-terminated
string. Add a warning about this in a comment so future consumers of
this field know to check it for a NUL terminator before using it.
Signed-off-by: Aaron Rainbolt <arraybolt3@gmail.com>
---
include/xen/xen.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/include/xen/xen.h b/include/xen/xen.h
index fdf0fc4..16f3fd7 100644
--- a/include/xen/xen.h
+++ b/include/xen/xen.h
@@ -823,6 +823,11 @@ struct start_info {
/* (PFN of pre-loaded module if */
/* SIF_MOD_START_PFN set in flags). */
unsigned long mod_len; /* Size (bytes) of pre-loaded module. */
+ /*
+ * cmd_line will contain a NUL-termianted string if it contains valid
+ * data, but it MAY be invalid and not contain a NUL byte at all. Code
+ * that accesses cmd_line MUST NOT assume it is NUL-terminated.
+ */
#define GRUB_XEN_MAX_GUEST_CMDLINE 1024
int8_t cmd_line[GRUB_XEN_MAX_GUEST_CMDLINE];
/* The pfn range here covers both page table and p->m table frames. */
--
2.50.1
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
WARNING: multiple messages have this Message-ID (diff)
From: arraybolt3@gmail.com
To: grub-devel@gnu.org, xen-devel@lists.xenproject.org
Cc: Aaron Rainbolt <arraybolt3@gmail.com>
Subject: [PATCH v5 2/3] include/xen: Add warning comment for cmd_line
Date: Wed, 13 Aug 2025 20:36:44 -0500 [thread overview]
Message-ID: <20250814013645.2488043-3-arraybolt3@gmail.com> (raw)
In-Reply-To: <20250814013645.2488043-1-arraybolt3@gmail.com>
From: Aaron Rainbolt <arraybolt3@gmail.com>
The cmd_line field of the start_info struct is not guaranteed to be
NUL-terminated, even though it is intended to contain a NUL-terminated
string. Add a warning about this in a comment so future consumers of
this field know to check it for a NUL terminator before using it.
Signed-off-by: Aaron Rainbolt <arraybolt3@gmail.com>
---
include/xen/xen.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/include/xen/xen.h b/include/xen/xen.h
index fdf0fc4..16f3fd7 100644
--- a/include/xen/xen.h
+++ b/include/xen/xen.h
@@ -823,6 +823,11 @@ struct start_info {
/* (PFN of pre-loaded module if */
/* SIF_MOD_START_PFN set in flags). */
unsigned long mod_len; /* Size (bytes) of pre-loaded module. */
+ /*
+ * cmd_line will contain a NUL-termianted string if it contains valid
+ * data, but it MAY be invalid and not contain a NUL byte at all. Code
+ * that accesses cmd_line MUST NOT assume it is NUL-terminated.
+ */
#define GRUB_XEN_MAX_GUEST_CMDLINE 1024
int8_t cmd_line[GRUB_XEN_MAX_GUEST_CMDLINE];
/* The pfn range here covers both page table and p->m table frames. */
--
2.50.1
next prev parent reply other threads:[~2025-08-14 1:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-14 1:36 [PATCH v5 0/3] kern/xen: Add Xen command line parsing arraybolt3
2025-08-14 1:36 ` arraybolt3
2025-08-14 1:36 ` [PATCH v5 1/3] include/xen: Rename MAX_GUEST_CMDLINE to GRUB_XEN_MAX_GUEST_CMDLINE arraybolt3
2025-08-14 1:36 ` arraybolt3
2025-08-14 1:36 ` arraybolt3 [this message]
2025-08-14 1:36 ` [PATCH v5 2/3] include/xen: Add warning comment for cmd_line arraybolt3
2025-08-18 15:19 ` Daniel Kiper
2025-08-18 15:19 ` Daniel Kiper
2025-08-14 1:36 ` [PATCH v5 3/3] kern/xen: Add Xen command line parsing arraybolt3
2025-08-14 1:36 ` arraybolt3
2025-08-18 15:52 ` Daniel Kiper
2025-08-18 15:52 ` Daniel Kiper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250814013645.2488043-3-arraybolt3@gmail.com \
--to=arraybolt3@gmail.com \
--cc=grub-devel@gnu.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.