From patchwork Fri Feb 25 14:26:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Sakoman X-Patchwork-Id: 4303 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84709C433EF for ; Fri, 25 Feb 2022 14:28:40 +0000 (UTC) Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) by mx.groups.io with SMTP id smtpd.web08.6812.1645799319841714352 for ; Fri, 25 Feb 2022 06:28:39 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@sakoman-com.20210112.gappssmtp.com header.s=20210112 header.b=w0uPEGZO; spf=softfail (domain: sakoman.com, ip: 209.85.210.172, mailfrom: steve@sakoman.com) Received: by mail-pf1-f172.google.com with SMTP id u16so4807268pfg.12 for ; Fri, 25 Feb 2022 06:28:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakoman-com.20210112.gappssmtp.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=2bfkTwraJcO/IJdTCpajZPK99RDrvkOdLMJM4XioSBE=; b=w0uPEGZOB23o6t26qH3p05R8Hs0Bw7rtj0rTsM/sLeJT1kMQR0WqloH3TpbzVjo+AP ATh2lODPTicBcgf7ldDIFKZcW+8lJ3NEgEBXXtLOAwZ/Obb7aQlBvyAiO5s6idbAU0+v oVQRxePBlDsC5HR8ieF3LnnmB4h2+afvOaVqVFSXvVYbHzvA0RazLJkLSul+Bg09BQUT PqGVChrP2XjvxMwK8oFD++2Z44rGho0ioe5eExjp55w2e7Oxj+qLgHy8zzDwHufVYptt 0/coPgly1N5kPruEEE/DSOGAo0O7aOEdqkCtGbZvX1XbT1til9JdyIK9SU3kgIMP7nVY H6CQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2bfkTwraJcO/IJdTCpajZPK99RDrvkOdLMJM4XioSBE=; b=eDIv9FcxKGNZz0fIpy4wPi26YvHNKbHFr9JDESrxCdCjfPDHB8v7c5xsjV9rsdtIwr 5F9frVYiqDjmnJ5XkOSZPuprqp4qrPrq0Gnw/zffvU2Lqbt0/EEFCLHEI0QtgUpcS2BZ L4qEIrpyefl3k7qtdiGpTswOvyuMv6PXSrIICAS4t3kXWwWWb+gC0FJxXiBiMQWWh4d+ n/suhiYT5hW99u1jPjkYvqKx14j6F5Xxf0rnn8Y34JeO+6CwKPiddz+C6TScA7HBsHIh XNqHb0puZbTW/sUNh14ajEqMiCeXZmar2RRuVcR15ngpTZMwOynMSWh+ehdspVQJM/TR XbkQ== X-Gm-Message-State: AOAM532Nr2wZnn02quxiDjlrPdpQhLzu3LCq8mpxQLQ4LBfEoZIy7Kba 4FZiOKzMpbltX+up5zhZAhbo7SXmjlQtAgiV X-Google-Smtp-Source: ABdhPJzX6VZHXFWVUbXAxZnRP3lP4GYwI6UN/R9ZhHFfI+HMeIpqo1GmKbQFmpsrYjiGdtRHyi4imQ== X-Received: by 2002:a62:b609:0:b0:4f1:2735:3217 with SMTP id j9-20020a62b609000000b004f127353217mr8110123pff.22.1645799318940; Fri, 25 Feb 2022 06:28:38 -0800 (PST) Received: from hexa.router0800d9.com (dhcp-72-253-6-214.hawaiiantel.net. [72.253.6.214]) by smtp.gmail.com with ESMTPSA id h17-20020a63df51000000b0036b9776ae5bsm2864538pgj.85.2022.02.25.06.28.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Feb 2022 06:28:38 -0800 (PST) From: Steve Sakoman To: openembedded-core@lists.openembedded.org Subject: [OE-core][dunfell 49/50] grub: avoid a NULL pointer dereference Date: Fri, 25 Feb 2022 04:26:29 -1000 Message-Id: <6666dccd33178445f3c4fe277354393efb70285a.1645798648.git.steve@sakoman.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 25 Feb 2022 14:28:40 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/162395 From: Marta Rybczynska This patch adds a fix for a NULL pointer dereference in grub's commands/ls. It is a part of a security series [1]. [1] https://lists.gnu.org/archive/html/grub-devel/2021-03/msg00007.html Signed-off-by: Marta Rybczynska Signed-off-by: Steve Sakoman --- ...ire-device_name-is-not-NULL-before-p.patch | 33 +++++++++++++++++++ meta/recipes-bsp/grub/grub2.inc | 1 + 2 files changed, 34 insertions(+) create mode 100644 meta/recipes-bsp/grub/files/0045-commands-ls-Require-device_name-is-not-NULL-before-p.patch diff --git a/meta/recipes-bsp/grub/files/0045-commands-ls-Require-device_name-is-not-NULL-before-p.patch b/meta/recipes-bsp/grub/files/0045-commands-ls-Require-device_name-is-not-NULL-before-p.patch new file mode 100644 index 0000000000..5a327fe1d2 --- /dev/null +++ b/meta/recipes-bsp/grub/files/0045-commands-ls-Require-device_name-is-not-NULL-before-p.patch @@ -0,0 +1,33 @@ +From dd82f98fa642907817f59aeaf3761b786898df85 Mon Sep 17 00:00:00 2001 +From: Daniel Axtens +Date: Mon, 11 Jan 2021 16:57:37 +1100 +Subject: [PATCH] commands/ls: Require device_name is not NULL before printing + +This can be triggered with: + ls -l (0 0*) +and causes a NULL deref in grub_normal_print_device_info(). + +I'm not sure if there's any implication with the IEEE 1275 platform. + +Signed-off-by: Daniel Axtens +Reviewed-by: Daniel Kiper + +Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/grub.git/commit/?id=6afbe6063c95b827372f9ec310c9fc7461311eb1] +Signed-off-by: Marta Rybczynska +--- + grub-core/commands/ls.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/commands/ls.c b/grub-core/commands/ls.c +index 5b7491a..326d2d6 100644 +--- a/grub-core/commands/ls.c ++++ b/grub-core/commands/ls.c +@@ -196,7 +196,7 @@ grub_ls_list_files (char *dirname, int longlist, int all, int human) + goto fail; + } + +- if (! *path) ++ if (! *path && device_name) + { + if (grub_errno == GRUB_ERR_UNKNOWN_FS) + grub_errno = GRUB_ERR_NONE; diff --git a/meta/recipes-bsp/grub/grub2.inc b/meta/recipes-bsp/grub/grub2.inc index 84b8b8d1be..0454b09d52 100644 --- a/meta/recipes-bsp/grub/grub2.inc +++ b/meta/recipes-bsp/grub/grub2.inc @@ -91,6 +91,7 @@ SRC_URI = "${GNU_MIRROR}/grub/grub-${PV}.tar.gz \ file://0042-util-grub-editenv-Fix-incorrect-casting-of-a-signed-.patch \ file://0043-util-glue-efi-Fix-incorrect-use-of-a-possibly-negati.patch \ file://0044-script-execute-Fix-NULL-dereference-in-grub_script_e.patch \ + file://0045-commands-ls-Require-device_name-is-not-NULL-before-p.patch \ " SRC_URI[md5sum] = "5ce674ca6b2612d8939b9e6abed32934" SRC_URI[sha256sum] = "f10c85ae3e204dbaec39ae22fa3c5e99f0665417e91c2cb49b7e5031658ba6ea"