From mboxrd@z Thu Jan 1 00:00:00 1970 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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 29940C433F5 for ; Wed, 24 Nov 2021 02:53:27 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4482282F95; Wed, 24 Nov 2021 03:53:25 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="run/CMre"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 599FB82F97; Wed, 24 Nov 2021 03:53:24 +0100 (CET) Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 9169282D5B for ; Wed, 24 Nov 2021 03:53:20 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pg1-x532.google.com with SMTP id f65so835443pgc.0 for ; Tue, 23 Nov 2021 18:53:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=WO3GcjS7jg443Ga/Rid0YRZXXu+sJ+16BdgDxJ1aJdE=; b=run/CMreFWHalPZNgbG7HRp/5cWr6kV7pN+uKIWoSp1l9skngMZ2DTec9c7xBDeWGk hRM3/OpEzUkuQrBFeD1d+uizszpNQ0b8MWn922NhHdNTQBJgKNfEyyrthD2CknWbdSK2 rm3/wzZRvp9AD7VfI0HZh4lNwwYBx3+y83iIC/0EQNDJl0ykVcZSvaauftW/h0+fJuRS 2ydNn5oR3A+vNcbD9RiJATMuSzdAFwPACXLRdsXKJsl2FhAoEWOBQ0TYspxCedul3hQP jeCypDaCkmUu32mEjoPb0Zg1CMaouJ0QI01YhIwCxE0wzniVX4UPSkW1acBnV6Bbk8tQ 6fww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=WO3GcjS7jg443Ga/Rid0YRZXXu+sJ+16BdgDxJ1aJdE=; b=gqlCHGUvRDoS7zSsUUiYGJx5oJ4QnhEYf8d/SeBC6bMknehAgxA8JLPFJDj9GOb3Vy hznJ8HXNatJrUv8Wm9JaaCofjCL6415qM7Ph67tL3Mplns8Gmoz42xoLsOCf7bNHBIB8 TOMAMFpsHv3RnO5sGSdX9BEKOKxUadZmepUuRbtqajVnFnJfG7ZVc+veUR1ed8GyolK6 931DO8IkOurBB1k7kp57Z9xcvgydaQdRacJUYS/zlq8M3T3c679cARrWGCWhpXArKhPq pUaFPSxhaIfdE6G7BeaVl/nxCQGC2pLnWeA05AiQYRSCFQ1OaRgB5ugIWNOMc3W0xmZE P++w== X-Gm-Message-State: AOAM532N74XxNMWVMlLOLie2KZdFtSoBG6pbd6MKDUMdT+8nyyZ92jEK eXFHXiv0mnDXoHoBBRpzRLhRlg== X-Google-Smtp-Source: ABdhPJxFEJHNDnUaKvR7JvpgSBTe/qXLMaYt7yAETAAVGohTU8g4WQkZl1g1NRmq703MhC7WYoqmjw== X-Received: by 2002:a62:1cc4:0:b0:49f:99b6:3507 with SMTP id c187-20020a621cc4000000b0049f99b63507mr2364059pfc.76.1637722398699; Tue, 23 Nov 2021 18:53:18 -0800 (PST) Received: from laputa ([2400:4050:c3e1:100:6daa:4b0a:ac7e:f30c]) by smtp.gmail.com with ESMTPSA id p15sm2541815pjh.1.2021.11.23.18.53.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Nov 2021 18:53:18 -0800 (PST) Date: Wed, 24 Nov 2021 11:53:14 +0900 From: AKASHI Takahiro To: Heinrich Schuchardt Cc: u-boot@lists.denx.de, Alexander Graf , Ilias Apalodimas , Masami Hiramatsu Subject: Re: [PATCH 1/1] efi_loader: segfault in efi_clear_os_indications() Message-ID: <20211124025314.GA9598@laputa> Mail-Followup-To: AKASHI Takahiro , Heinrich Schuchardt , u-boot@lists.denx.de, Alexander Graf , Ilias Apalodimas , Masami Hiramatsu References: <20211120110225.40663-1-heinrich.schuchardt@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211120110225.40663-1-heinrich.schuchardt@canonical.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.37 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean On Sat, Nov 20, 2021 at 12:02:25PM +0100, Heinrich Schuchardt wrote: > If we call efi_clear_os_indications() before initializing the memory store > for UEFI variables a NULL pointer dereference occurs. > > The error was observed on the sandbox with: > > usb start > host bind 0 sandbox.img > load host 0:1 $kernel_addr_r helloworld.efi > bootefi $kernel_addr_r > > Here efi_resister_disk() failed due to an error in the BTRFS implementation. > > It is enough to clear EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED > if we have successfully initialized the UEFI sub-system. I think that it would be better move this function into efi_launch_capsules() as we should defer to a responsible sub-component, capsule support in this case, on whether a particular bit should be cleared. -Takahiro Akashi > Fixes: 149108a3eb59 ("efi_loader: clear OsIndications") > Signed-off-by: Heinrich Schuchardt > --- > lib/efi_loader/efi_setup.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c > index a2338d74af..661868811f 100644 > --- a/lib/efi_loader/efi_setup.c > +++ b/lib/efi_loader/efi_setup.c > @@ -331,11 +331,10 @@ efi_status_t efi_init_obj_list(void) > if (IS_ENABLED(CONFIG_EFI_CAPSULE_ON_DISK) && > !IS_ENABLED(CONFIG_EFI_CAPSULE_ON_DISK_EARLY)) > ret = efi_launch_capsules(); > - > -out: > r = efi_clear_os_indications(); > if (ret == EFI_SUCCESS) > ret = r; > +out: > efi_obj_list_initialized = ret; > return ret; > } > -- > 2.32.0 >