Skip to content

Allow overriding commands

Glenn Washburn grub-devel 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2script: Allow user-defined functions to override builtinsMakefile.util.def grub-core/script/execute.c tests/grub_script_override.in+53 -80 replies
2/2script: Add script language construct "builtin"Makefile.util.def grub-core/script/execute.c tests/grub_cmd_builtin.in+59 -110 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] Allow overriding commands

This patch series allows user-defined functions to hook commands by creating a function that is the same name as a command. Commands may be executed by prefixing the command name with the "builtin" keyword, as in bash. This allows functions to modify the invocation of commands. For instance, I use this to concatenate an extra initrd file to an existing one created by my OS, by hooking initrd and adding the extra file. As an aside, in the future, I'd like to dynamically generate this extra initrd file within GRUB.

This patch series is not "lockdown" aware. And I'm not entirely sure it needs to be, but I have a strong suspicion it does. Commands that are locked down obviously won't all of a sudden work. However, my concern is that this feature could prevent essential commands from running. Not being entirely familiar with secureboot, I don't feel I'm in the best position to judge the security implications . If it is determined that this feature does need to be lockdown aware, I believe its a fairly simple change, and can modify the patch series. I'll await feedback before I make that change, as it may be deemed unnecessary.

Glenn

Glenn Washburn (2):
script: Allow user-defined functions to override builtins
script: Add script language construct "builtin"

 Makefile.util.def             | 12 ++++++++++
 grub-core/script/execute.c    | 45 ++++++++++++++++++++++-------------
 tests/grub_cmd_builtin.in     | 37 ++++++++++++++++++++++++++++
 tests/grub_script_override.in | 33 +++++++++++++++++++++++++
 4 files changed, 110 insertions(+), 17 deletions(-)
 create mode 100644 tests/grub_cmd_builtin.in
 create mode 100644 tests/grub_script_override.in
Signature · 1 line
2.27.0