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 X-Spam-Level: X-Spam-Status: No, score=-17.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26D05C4338F for ; Mon, 26 Jul 2021 14:55:17 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DEC5360F51 for ; Mon, 26 Jul 2021 14:55:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org DEC5360F51 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1/NatZaNx0wc+x9V0pXu0ejQm5M83BFmBJwmYwk7eCc=; b=mSJqibaviGHVM5 HhYVql5oYXktAfxOhw6dTkvzY7o05lPpaDc638fNjDO8Z7zr//ca5eWolQpPiN+DsUkfM4s+poDJq RlzUSmJI20TXNkisC6BJ4R/6HwAhgW0PicBwYfBfyqR0hGh//nVyIC06AjEgOHnxQKSnoFl4VAqu4 4kR7nUEBxulZsNfKc22eAmYoKv7ENJdzFkjrbDHZVJizDlCuLMflpN1I/Orm4va1sRrgvE0PhY4my fW6JCF7PH8vWtya4jpQzgxWs6g0MXSfYy8t32DgjCP7DaoDa1X2fkAXpD2yrPHlrG+GMHDY6Ok/eZ gJeupck0rLV7h+F/QDGg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m81yS-00BYre-1S; Mon, 26 Jul 2021 14:52:56 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m81xg-00BYhI-VT for linux-arm-kernel@lists.infradead.org; Mon, 26 Jul 2021 14:52:10 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id D4A8060F55; Mon, 26 Jul 2021 14:52:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1627311128; bh=FL4XscM/XE1HlSxzzIgal5E9ANumuP+Cm/xIkiJYOxg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MtiPxwUzhbv1NycIDYzPr/+wphukJlZG1AllhC03Y+kim9P5uVjKZS6EuiX6eBAir JJipAXDq/lcGVSbubMsqCQvZyXj0hMYl83O0jrOhbI0VoWwtoMXhdMV5VjvppBQqlG c1kLrcgwDoxR38YEnQHSEnSvgqIcXEbCvNTIA734Ce61rZgloe93ONK4xnDgrOVIVg GibqZlTfGdRLPGbdQR9B2JROk2BxwmJ8wdMi7Bu3WmdoFYUv7UuIvRjj6bgCTdWj63 xG2/kK2mu0KfQuCHQRIJITSTTmA2FexD9KwRXeo5TFZlIU8xg9/Z00ELLQtyuWF1vL 51lZvu79s1/iQ== From: Ard Biesheuvel To: linux-efi@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Ard Biesheuvel Subject: [PATCH v3 3/4] efi/libstub: arm64: Warn when efi_random_alloc() fails Date: Mon, 26 Jul 2021 16:51:55 +0200 Message-Id: <20210726145156.12006-4-ardb@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210726145156.12006-1-ardb@kernel.org> References: <20210726145156.12006-1-ardb@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210726_075209_138351_5DB4ABC3 X-CRM114-Status: UNSURE ( 9.58 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Randomization of the physical load address of the kernel image relies on efi_random_alloc() returning successfully, and currently, we ignore any failures and just carry on, using the ordinary, non-randomized page allocator routine. This means we never find out if a failure occurs, which could harm security, so let's at least warn about this condition. Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/libstub/arm64-stub.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/firmware/efi/libstub/arm64-stub.c b/drivers/firmware/efi/libstub/arm64-stub.c index 6f214c9c303e..010564f8bbc4 100644 --- a/drivers/firmware/efi/libstub/arm64-stub.c +++ b/drivers/firmware/efi/libstub/arm64-stub.c @@ -130,6 +130,8 @@ efi_status_t handle_kernel_image(unsigned long *image_addr, */ status = efi_random_alloc(*reserve_size, min_kimg_align, reserve_addr, phys_seed); + if (status != EFI_SUCCESS) + efi_warn("efi_random_alloc() failed: 0x%lx\n", status); } else { status = EFI_OUT_OF_RESOURCES; } -- 2.20.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel