Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1lOCYW-0002bW-O5 for mharc-grub-devel@gnu.org; Mon, 22 Mar 2021 00:52:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54700) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lOCYV-0002bN-GN for grub-devel@gnu.org; Mon, 22 Mar 2021 00:52:43 -0400 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]:41612) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lOCYT-0001au-MX for grub-devel@gnu.org; Mon, 22 Mar 2021 00:52:43 -0400 Received: by mail-pj1-x102c.google.com with SMTP id nh23-20020a17090b3657b02900c0d5e235a8so7878732pjb.0 for ; Sun, 21 Mar 2021 21:52:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficientek-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=+CoVwAMQcWdp7OA+QPzQGvUcGfxmzDc5MBbr/8RdSuI=; b=Kb4zjppt5BthxpQcZhWmKSQ3sR4x/HeEw1yC3zidnvVHzNCXIeKBrTvj0ch4TNJ+ca oVKmAuC5pt/GWznpwDkHJcvNFanfBQvZGCDgV1yix/SdIE/s/Zwh5BuRbQoq3ylmWY/N NmXQVEXKNZhq7aaKXaBzzVxibLLFGHJ8Ak5OtwAhIFsB3RxfrLLhDlzucly9nVzXMY2Z u6pTfkeDB67ftdNzZfGWP+U7pOcO6sTxm0wWNxczbibeUelMR6GIxA0U0ztm0LuwALhX AHOHOH7CWGHTdpYqSSbF6iOt106M9oyiFsSTd8c31bTYgQ0L1Y4rNjieOS5MtXrD4f3G SH4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=+CoVwAMQcWdp7OA+QPzQGvUcGfxmzDc5MBbr/8RdSuI=; b=rD3CIfr9olkiMXmQCJQAv/0uaXcwlmuvEC6f+34JGAOP6S1BX8B/CWbnqwMgb7MhGi ILPxBqL6HhgF0eZVLir62FVVFWS6yELoKpeT6j8efZ9NLihUonbgnHM5zjGhGoFlP5oP I2RUYQ6TPjNbVUSddtdlhGQowQw+7tiM2eIsxvDqXd7D58UuQFjJpw0fQg+W0tLbr70b mpxMCdezgGvoLM8ixXtTXrEh/KwtNe7n0jUVyePV19q/Yn4vOlZttBVMZrxuCK3ZjGws Ux/VHJ46lpMQVg9RBiFuB866G2gWavRnqDLq7ZzUk1apEi/9fnbYi3gPCJm7nOBApYX5 yCBQ== X-Gm-Message-State: AOAM532PjOo1BYZLOk/hbj7ANSpqPGxLH/K4CZJFm8kElDT2CURUEkqx onuinhA0tza5HPaGvZV38/nJueNAR0c43w== X-Google-Smtp-Source: ABdhPJyblyVQaLXpdYz8uwcx70IbMZPrdUlJZUu6dKh27iqgVDp7nnGRhKRvccpJ8gfOHp6gqU1YlA== X-Received: by 2002:a17:90a:1b0e:: with SMTP id q14mr10873047pjq.41.1616388759764; Sun, 21 Mar 2021 21:52:39 -0700 (PDT) Received: from localhost.localdomain ([2605:a601:ab16:db00:59d7:d891:def4:a439]) by smtp.gmail.com with ESMTPSA id q16sm7038913pfs.16.2021.03.21.21.52.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Mar 2021 21:52:39 -0700 (PDT) From: Glenn Washburn To: grub-devel@gnu.org, Daniel Kiper Cc: Glenn Washburn Subject: [PATCH 0/2] Allow overriding commands Date: Sun, 21 Mar 2021 23:52:20 -0500 Message-Id: X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=development@efficientek.com; helo=mail-pj1-x102c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Mar 2021 04:52:43 -0000 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 -- 2.27.0