All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Serbinenko <phcoder@gmail.com>
To: grub-devel@gnu.org
Cc: Vladimir Serbinenko <phcoder@gmail.com>
Subject: [PATCH vRESEND 3/4] loader/xen: Add --noescape option.
Date: Fri, 17 May 2024 10:52:49 +0300	[thread overview]
Message-ID: <20240517075250.2760-3-phcoder@gmail.com> (raw)
In-Reply-To: <20240517075250.2760-1-phcoder@gmail.com>

---
 grub-core/loader/i386/xen.c | 43 +++++++++++++++++++++++++++----------
 1 file changed, 32 insertions(+), 11 deletions(-)

diff --git a/grub-core/loader/i386/xen.c b/grub-core/loader/i386/xen.c
index d24ef151b..12d920294 100644
--- a/grub-core/loader/i386/xen.c
+++ b/grub-core/loader/i386/xen.c
@@ -638,6 +638,14 @@ grub_cmd_xen (grub_command_t cmd __attribute__ ((unused)),
   grub_addr_t kern_start;
   grub_addr_t kern_end;
   grub_size_t sz;
+  int no_escape = 0;
+
+  if (argc != 0 && grub_strcmp (argv[0], "--noescape") == 0)
+    {
+      argc--;
+      argv++;
+      no_escape = 1;
+    }
 
   if (argc == 0)
     return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
@@ -650,7 +658,7 @@ grub_cmd_xen (grub_command_t cmd __attribute__ ((unused)),
   err = grub_create_loader_cmdline (argc - 1, argv + 1,
 				    (char *) xen_state.next_start.cmd_line,
 				    sizeof (xen_state.next_start.cmd_line) - 1,
-				    GRUB_VERIFY_KERNEL_CMDLINE, 0);
+				    GRUB_VERIFY_KERNEL_CMDLINE, no_escape);
   if (err)
     return err;
 
@@ -845,17 +853,30 @@ grub_cmd_module (grub_command_t cmd __attribute__ ((unused)),
   grub_relocator_chunk_t ch;
   grub_size_t cmdline_len;
   int nounzip = 0;
+  int option_found = 0;
+  int no_escape = 0;
   grub_file_t file;
 
-  if (argc == 0)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
-
-  if (grub_strcmp (argv[0], "--nounzip") == 0)
+  do
     {
-      argv++;
-      argc--;
-      nounzip = 1;
-    }
+      option_found = 0;
+
+      if (argc != 0 && grub_strcmp (argv[0], "--nounzip") == 0)
+	{
+	  argc--;
+	  argv++;
+	  option_found = 1;
+	  nounzip = 1;
+	}
+
+      if (argc != 0 && grub_strcmp (argv[0], "--noescape") == 0)
+	{
+	  argc--;
+	  argv++;
+	  option_found = 1;
+	  no_escape = 1;
+	}
+    } while (option_found);
 
   if (argc == 0)
     return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
@@ -910,7 +931,7 @@ grub_cmd_module (grub_command_t cmd __attribute__ ((unused)),
     return grub_errno;
   size = grub_file_size (file);
 
-  cmdline_len = grub_loader_cmdline_size (argc - 1, argv + 1, 0);
+  cmdline_len = grub_loader_cmdline_size (argc - 1, argv + 1, no_escape);
 
   err = grub_relocator_alloc_chunk_addr (xen_state.relocator, &ch,
 					 xen_state.max_addr, cmdline_len);
@@ -919,7 +940,7 @@ grub_cmd_module (grub_command_t cmd __attribute__ ((unused)),
 
   err = grub_create_loader_cmdline (argc - 1, argv + 1,
 				    get_virtual_current_address (ch), cmdline_len,
-				    GRUB_VERIFY_MODULE_CMDLINE, 0);
+				    GRUB_VERIFY_MODULE_CMDLINE, no_escape);
   if (err)
     goto fail;
 
-- 
2.39.2


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

  parent reply	other threads:[~2024-05-17  7:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-17  7:52 [PATCH vRESEND 1/4] Add "noescape" argument to cmdline creation Vladimir Serbinenko
2024-05-17  7:52 ` [PATCH vRESEND 2/4] loader/multiboot: Add --noescape option Vladimir Serbinenko
2024-05-17  7:52 ` Vladimir Serbinenko [this message]
2024-05-17  7:52 ` [PATCH vRESEND 4/4] 10_illumos: Use --noescape so that $ZFS_BOOTFS is passed properly Vladimir Serbinenko

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=20240517075250.2760-3-phcoder@gmail.com \
    --to=phcoder@gmail.com \
    --cc=grub-devel@gnu.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.