From patchwork Thu Dec 22 11:14:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 635951 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp146593pvb; Thu, 22 Dec 2022 03:17:43 -0800 (PST) X-Google-Smtp-Source: AMrXdXskgYAxid6FTZYwYBaXpm0XaAhJK965BU7Rn95A8+/7C1BJRxOom0P4TB/sXmq4L2mFmDf0 X-Received: by 2002:a05:622a:4c88:b0:3a8:649:8d0a with SMTP id ez8-20020a05622a4c8800b003a806498d0amr6323025qtb.30.1671707863485; Thu, 22 Dec 2022 03:17:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671707863; cv=none; d=google.com; s=arc-20160816; b=AKu11rDeb5nGKXdeq4hVvCQcDteI/vv/w+IhLO8VDx2jkMD5o3XotdgChbThD5cg8y W5hk7/mQ49iOp+aMuyXoxQ6kKlCbIK3MtuxnDEttccrRrhqdvnSvffQ5N4Ny4FBsRASD 8cJIJ66VPhrP8FQc24D2BFyS2U7xPLiKhX1HgQYQ/bg42MaGAAAWFSDbffMHsQAie8o6 7JHK++o2Ay5McnfkEsJbTDmhclcWQo3PxMgqVaZxMIjEjtiyGQKaA2dE3OXvKYE0nfXN 5ZCc5ynOssrXbrw9EBYFiM+jHuN7V8luYIBUTIUsVGAQK4YUTXqp9OiQ68ei/DmPGIPM xl2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=zVOFX/QXgxgq/Mt5/tMSMI8XdezWWBXbI4ji1oI7FPo=; b=rkNyY1OQZlDQSHZWSRZjOuJvO/lDed3BYGW4QJSlTumbEdTC2cwX18iNwp1sr80Eib Jq03si5dKJKz5Nwh4YwMQ8VQ0qGZjVNn9crzTZQz2KVOfSnHPTwx2NT+Bc14fLjZAhy9 zbq7YMufpKIOFjbaqNqBWeyV6Crdcufu0yoPr5w+eilpO9x2Tq2A/f9i0gFmm07QhuWn kX1+OFOQeBHIPTqonLT5cOQ4eM9Q8eMdPxBUK8T0HCvQdOmdisyIuTJa4XLEmsuRj2tw tHot35ccTHgxEcYjnP2Ms0loOtZxu2pXh5wq5C/KMbEcbBsMad0btasQ6eesmuv28/ow 9wqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=uVRgJVLS; spf=pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="grub-devel-bounces+patch=linaro.org@gnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u22-20020a05620a455600b006fa452a9a61si83060qkp.191.2022.12.22.03.17.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 22 Dec 2022 03:17:43 -0800 (PST) Received-SPF: pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=uVRgJVLS; spf=pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="grub-devel-bounces+patch=linaro.org@gnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p8JXS-0007vb-Qf; Thu, 22 Dec 2022 06:15:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p8JXM-0007v8-Dg for grub-devel@gnu.org; Thu, 22 Dec 2022 06:14:56 -0500 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p8JXH-0002k9-Rw for grub-devel@gnu.org; Thu, 22 Dec 2022 06:14:54 -0500 Received: by mail-pj1-x102e.google.com with SMTP id v23so1579623pju.3 for ; Thu, 22 Dec 2022 03:14:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=kCQj+af7filc06nxE7iZvorEa8OL8mtj5V5B7Qywr/A=; b=uVRgJVLSMuBIgeElGd0EHsjd3f0quERDsiO9xJVgFVoKVcVQ+3QKfEQ+/SKln3SUNA oo5na/GH0JI3GRxDGgZ6f7Bus9M58cIg2CqSbGsmMniVYr878OYrCl3RJNs9/tian9Ct IbVpE+PZRUIyfoqmeixlpEFmgs8ABJQrUHPzpBmlmbBcl8M83SMGQHv2l8tJoZlPtvcq ROSrReJId7VTm39jDXLoNOA/je9+z6z9zSRTr1L6hdUPOuIOXtxp/yqq4HRqBYyDQc7L Jf/XbNsI/N/ph0uniV5L9psd+huNnihsaGBjvXTLSEihpj3ELCK/UtI49HeJ9mZe9K4z wYqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=kCQj+af7filc06nxE7iZvorEa8OL8mtj5V5B7Qywr/A=; b=ur4wMS1hIzOTy+wPQAVQD/mkLWXAJ1YTeqR5dc1mZrmC83Xj5FvMKPxz7BzIjhhf1j isy1aevNF0lQqGEx+861sXGEOiRNPt8emXJdSd0bR4SenOFHoe980zQx87FDbj4Mqo8i z6HNUc8tc3kyfUbmAq4HsySRri5qSXZtKnIa1YdCG16djo74uKYYQWlRL6vAQvWNs5B9 hZkvn38TD4iqeB17uBryIklNRKmRwP5vPnox54QVGV92ckPF2luf0Qv77HGPexNfbMlK h0O/A1/fmYoV8Fi1Nx/h1x4/LZMlP+1cn1Es53hKdInbkrE+nn/fSC8dgcu/DzpeBOK3 pTBA== X-Gm-Message-State: AFqh2kqMm407HHI+MCAAld3GKya7t0Bb/Fqms+VC6/0WA6V58v0hCNpv c6AWjsiT4GxBFLXhecioSxr/ew== X-Received: by 2002:a05:6a21:999d:b0:9e:9685:f15e with SMTP id ve29-20020a056a21999d00b0009e9685f15emr8905223pzb.0.1671707686190; Thu, 22 Dec 2022 03:14:46 -0800 (PST) Received: from leoy-yangtze.lan (n058152048225.netvigator.com. [58.152.48.225]) by smtp.gmail.com with ESMTPSA id x68-20020a626347000000b0056bc742d21esm444686pfb.176.2022.12.22.03.14.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Dec 2022 03:14:45 -0800 (PST) From: Leo Yan To: Daniel Kiper , Daniel Kiper , Alex Burmashev , Vladimir 'phcoder' Serbinenko , Ilias Apalodimas , grub-devel@gnu.org Cc: Leo Yan Subject: [PATCH] verifiers: Don't return error for deferred image Date: Thu, 22 Dec 2022 19:14:39 +0800 Message-Id: <20221222111439.2653118-1-leo.yan@linaro.org> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102e; envelope-from=leo.yan@linaro.org; helo=mail-pj1-x102e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-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.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: The development of GNU GRUB Errors-To: grub-devel-bounces+patch=linaro.org@gnu.org Sender: grub-devel-bounces+patch=linaro.org@gnu.org When boot from menu and the flag GRUB_VERIFY_FLAGS_DEFER_AUTH is set, grub returns error: Booting a command list error: verification requested but nobody cares: (hd0,gpt1)/Image. Press any key to continue... In this case, the image should be deferred for authentication, grub should return the file handle and pass down to later firmware (e.g. U-Boot, etc) for authentication. For this purpose, rather than returning error, this patch prints log and returns file handler. Signed-off-by: Leo Yan --- grub-core/kern/verifiers.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/grub-core/kern/verifiers.c b/grub-core/kern/verifiers.c index 75d7994cf..ada753e69 100644 --- a/grub-core/kern/verifiers.c +++ b/grub-core/kern/verifiers.c @@ -115,11 +115,7 @@ grub_verifiers_open (grub_file_t io, enum grub_file_type type) if (!ver) { if (defer) - { - grub_error (GRUB_ERR_ACCESS_DENIED, - N_("verification requested but nobody cares: %s"), io->name); - goto fail_noclose; - } + grub_printf("%s verification is deferred\n", io->name); /* No verifiers wanted to verify. Just return underlying file. */ return io;