From patchwork Mon Jan 6 19:02:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Breno Leitao X-Patchwork-Id: 855325 Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com [209.85.208.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3DA2813775E; Mon, 6 Jan 2025 19:03:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736190186; cv=none; b=YamvmA5lnYBU2bFo5nswVIP0TwZzkTCcsaS1P2KuIE8EN8nEbd/SqhIShB7aOs0a7PQqUQftPF6/SpT9TchlqBHVrLKcwM94ouDbPx8NG2wn0t+NkVGRri/xnbjLMR9xE4piHXvt587dCftqLbpP3TA79eYFMDLNKw1FgfwdC0g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736190186; c=relaxed/simple; bh=1hFbOdAyQ1Rf/EUjbs+J0s/+S7tHE+WNNrA0yz7O9Yw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=QI//glxFPsHNbmGM/4Z1WI7yuX6HF5U/SBHXAh/Rr1CACOB6WJQaaGXFE3j7TOtibXv5kXiV/cv5H9Zd/h0SSxOtbVMgSKFOvaUwtdcrf8Nl+lCON4yt1seV6K8CsA+CQe+zez/yxEvOo5YvfQyErv2GEqAZzTabhhLxOLAMcOw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.208.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f44.google.com with SMTP id 4fb4d7f45d1cf-5d8c1950da7so14080321a12.3; Mon, 06 Jan 2025 11:03:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736190182; x=1736794982; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lFUta7O3eGoSELPg3GbEEtx457MSNjK6QkV3l6hmYuo=; b=h1l9aAib46L5SXIXHQ9w+ZnFFByrXUgm3AJzHxrQPCH6Po6u0IywUz9UCMj939P+Ao D/rRTpEswNmj7wW3Zmpl9AGqbrVOc+XMuFVpJPCTuWtvoKqRW2M+e9A6ZbqdVKCkYnw5 R/EjHvz8swLm3t0kuI3M4qffKMRtrd2AXslwo3TtvC2U1GB3ARv25hgfhFUWkJzHArMf 6Fmar5HXTZH/4TRfAVlY7uZayhIemdv/W1cH74PLuc7Hhu4F+xwli1QDMVPidSHXg4qN 0xhj7BPkwZ5l94PxyiSxkgf9MHIOlIXRDWEGaC10R52wSLjm3CYriFO3BN1TTfNzqXBF D2hA== X-Forwarded-Encrypted: i=1; AJvYcCVfo0qHQ89oK/2ms0RR/2AnkfPo+1RMhEwU0UMpHjSA5T2HIuCydI8VL1WVAGk+se+MtuVYrKCSBYQ=@vger.kernel.org, AJvYcCXmiCElRir/6u8i7CVzFTmX8wZDq5Pq/InPN6GrvECOdeQVRJH9fFJyizTDS/RxmBs9aYNY0LoxGN42BVSk@vger.kernel.org X-Gm-Message-State: AOJu0YyOlDcp3/QcwWGtwKYpz00aJBhhGTMuiKGio+k2GClUio5kL751 YxhKroUIb2vvVafY02+Rxmq1rt3gKlciEQD/FSqzmYjfqz9SWWc6 X-Gm-Gg: ASbGncvQq0eae7CeS8h2PvjZSZ31mNnrQPnq1z9fcy+K/e68TkGufQG0uvdPCOeAD1D 8mGHvjFLt0UNUCcvO/KzaacwSlr/ZHvRn44zuQ45YeRUQN9/stOCR6rz/2oaWxGMRa9KCWW5WCR CBuEyVsT6d5DoOOCL02n+jv45R9wWEVkR/eJPT3vptD63j7VCQeYgqaJQbwgHgyq/aZeRQu9+Pv atMCNv7yncAc1U9W07zoJ93yeY1AgcqoxOu2R49I9w1aWg= X-Google-Smtp-Source: AGHT+IE+XIbJ69aMgudvHSBCpUZQ4L1FmQMMDEoQc0G7bmFIAbk+dw2hprAQKQU+eN+6hfKB3OdcjQ== X-Received: by 2002:a05:6402:430c:b0:5d2:fa65:c5e2 with SMTP id 4fb4d7f45d1cf-5d81de1fd2amr56989550a12.22.1736190182391; Mon, 06 Jan 2025 11:03:02 -0800 (PST) Received: from localhost ([2a03:2880:30ff:9::]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5d80701abd1sm23290505a12.76.2025.01.06.11.03.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jan 2025 11:03:01 -0800 (PST) From: Breno Leitao Date: Mon, 06 Jan 2025 11:02:50 -0800 Subject: [PATCH 1/3] efi/memattr: Convert efi_memattr_init() return type to void Precedence: bulk X-Mailing-List: linux-efi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250106-efi_fw_bug-v1-1-01a8eb40bfeb@debian.org> References: <20250106-efi_fw_bug-v1-0-01a8eb40bfeb@debian.org> In-Reply-To: <20250106-efi_fw_bug-v1-0-01a8eb40bfeb@debian.org> To: Ard Biesheuvel Cc: Gregory Price , Usama Arif , linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1970; i=leitao@debian.org; h=from:subject:message-id; bh=1hFbOdAyQ1Rf/EUjbs+J0s/+S7tHE+WNNrA0yz7O9Yw=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBnfCjiY8XLy7iF+bqCOSZPKiTSz6qUyBBUuXVdV f3aAi7QwuSJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCZ3wo4gAKCRA1o5Of/Hh3 bbLsD/wJT5/SAuVqCFsYBTW5no/3EC6EdYKEtOyRooM4UaiuMjx0G0tRFHlX0k2u3zIZl4lM71z 4VrfrfOCb74KTFveNv8do6AmkIkopjMTYXf7bAYc+O1PjxEVzzgM+WUETtCI1M2Z1sYY2QzVnlR bayJvzoX8w1LDxaXqjk3lJMxQnxDgeemPtMewCsDy90jGPQB9OqJhHiekrOAw9x2nLlsRXbcWIv MZo1SssKaVj6SIVEHWzKIi4n/xUuOsxI+w7uZy4eN75p3PvxUhjRcYtX0UKVrzCCRaQyGQkL4yU VHd3ApAC/PDLwnip3qjwo01laRUoRqBFxjOxlCW0S8iHss33mJGFMOvZIFEmSdwi8h9fSzhiH/4 LAs4bGwPUBBlu4oc4DixPeP1GCbOjs9bhnDGAEIli3pdHzbKuw0DMecD5WEIEdOTURIqw1nSoHs fxcIpouiJfG8XgaSfofhZ4lyXseyfkx9MSnoPxMvw5KmKzBZqUAeMTJ44a3IqfXlRXtKK0S9jmr Bel0L8hUN00Df6usisKmZmburA6mFCOYwoyc442r7TFZIdAC+gnCOqCa/4a0Bks3noUNM8H4Sx4 7AqYYf9Rkc/IpmG4xRN04bLwMyNxUTV4vmALWlS6TRmwKez96j+AkL9ovFfaaoSX0jKvG/YGjqr AaPD/Fpe69rg6gg== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D The efi_memattr_init() function's return values (0 and -ENOMEM) are never checked by callers. Convert the function to return void since the return status is unused. Signed-off-by: Breno Leitao Acked-by: Ard Biesheuvel --- drivers/firmware/efi/memattr.c | 7 +++---- include/linux/efi.h | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/firmware/efi/memattr.c b/drivers/firmware/efi/memattr.c index c38b1a335590d4f6b75012414a936e66f22dcd9a..e727cc5909cb676c47d787ab0d7754b6fdcb493d 100644 --- a/drivers/firmware/efi/memattr.c +++ b/drivers/firmware/efi/memattr.c @@ -19,19 +19,19 @@ unsigned long __ro_after_init efi_mem_attr_table = EFI_INVALID_TABLE_ADDR; * Reserve the memory associated with the Memory Attributes configuration * table, if it exists. */ -int __init efi_memattr_init(void) +void __init efi_memattr_init(void) { efi_memory_attributes_table_t *tbl; unsigned long size; if (efi_mem_attr_table == EFI_INVALID_TABLE_ADDR) - return 0; + return; tbl = early_memremap(efi_mem_attr_table, sizeof(*tbl)); if (!tbl) { pr_err("Failed to map EFI Memory Attributes table @ 0x%lx\n", efi_mem_attr_table); - return -ENOMEM; + return; } if (tbl->version > 2) { @@ -61,7 +61,6 @@ int __init efi_memattr_init(void) unmap: early_memunmap(tbl, sizeof(*tbl)); - return 0; } /* diff --git a/include/linux/efi.h b/include/linux/efi.h index e5815867aba971a64091bf0ea017d95f21115124..5404939df81bdc870f6ee5d0fb7cbb53394a2304 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h @@ -771,7 +771,7 @@ extern unsigned long efi_mem_attr_table; */ typedef int (*efi_memattr_perm_setter)(struct mm_struct *, efi_memory_desc_t *, bool); -extern int efi_memattr_init(void); +extern void efi_memattr_init(void); extern int efi_memattr_apply_permissions(struct mm_struct *mm, efi_memattr_perm_setter fn); From patchwork Mon Jan 6 19:02:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Breno Leitao X-Patchwork-Id: 855538 Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E765FFBF6; Mon, 6 Jan 2025 19:03:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736190187; cv=none; b=TmNuCzOi+Bath0PBRoPGTP9odDEggXGU2il2qg+esApT6dIFmxkVbGdTvMkmLbTSOHXv9IclWe88EqttvPQXrUOyGUQ+uDhwUcYMKQnl64U1qonvnksna+rHKg4xTfTexg7yvJ8HiIvwcudWBhJFDmevcgOU1Me+leGL+pIxhRU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736190187; c=relaxed/simple; bh=SzCoB6sQHDFFteL8s7JGLImKCYtxlB9ZDym1wSLtA6k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LRsqC/EEMWigJd1Abtv54aI0qHrmt8HXCGuNcCy4ojIfEbxaisNDQ0wHFPQIq1S06CpcjiwSEtz8dNh0WD4UZV1VwsMvAer036/DxssHpFOn/E5xZUnMd/MKthWo4YMV8MGhXyGY4rPCJaVqad6w4kALzkCg2VeRvakTOcrQdlU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.218.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-aa6c0d1833eso3059278766b.1; Mon, 06 Jan 2025 11:03:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736190184; x=1736794984; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Qqx5dtb4zn1xEVEpLQTLVTCHxIWy4bTfVSfUtmGRb1A=; b=Q4RBQOWAAyxsNz20ruwmg1Fsw8f/+OEfQIONLP1ovsn36KLL3X6cCBucsem2O2jm0d 4e/CQzo5g0YeEwPQ3WvO9NdDvo9Qj+W1OkQHwnKf0iK0NdJXZT44htpERVc0FrnEgPHl 91VFMcBIyXd3dVyacCxyURsvz1XnRGYldu47xZnUHm+A3MXAxrD1xt+YnKspX+J5ZYE9 cT80Tn5bO/VKxcs9zH7KtbpbTUyZYHyEyzICgmlQdX3IAVfI6+lzYPECQltEXhe6WKrf vyu0rCRnmPBHqhjsZDlgRl/K7XJTJejvJMawxIC5AWPfEnDJAOtPizCqoc8gMM3Sh2xd wL8Q== X-Forwarded-Encrypted: i=1; AJvYcCUX2DdJyr82TciPBNGZzo9grXW7e6j8XRw7YO8z0g/DSO0EVfkacD5oi5RilZOB7g8T75O9CD6eCYuQqnk+@vger.kernel.org, AJvYcCWkgFnPDIPQvNnY24S6yjc9KEu2l0jFFr6ixad8NJxWVvAQic1UQ1Y1nu8Plw6XcCwMXgVy4cKPuVo=@vger.kernel.org X-Gm-Message-State: AOJu0Yy5IQuvvbmKWnlejDE89cwjHGd5SHrpbCsNOw5OwqZCGrzhmTkF KCo2oBHnfvvMoor8KzLd2v3zaNf/6Qh2ngR47IP43eVMEWVN9y0MqIeh/A== X-Gm-Gg: ASbGnctVMEFCG8bglOXEfBdNCsFcs9wdrayaiQPtefLFJIfxtOHXPMpgJ20K2BKCLXA EHGF1nQqLfClZFuQgRDKHqP8SODp0jyAbGLitURE5ZcB384gJI4PmeSvhHUVnTMvORI0xi8Fldr 53moTpZKDyO6hYc6hBxkFftOvNbCe5+ypMSX0oVe76RE9ZCuShQ8zfjcKAxA2FJs0xmyz+ysP82 Vu0+SMcnLUeXa1LmDnmsyxsPBS447TG33Cc2YyvwakdvF4= X-Google-Smtp-Source: AGHT+IFA2z6O7oK5pZ3aqxpwas8ITcxwjM2g2PfAQIKX/A4KeWSUnqS8BUUEw5gVXHwcQbbo+wwBSg== X-Received: by 2002:a17:907:7dab:b0:aa6:98c9:aadc with SMTP id a640c23a62f3a-aac2d45fb01mr5408442766b.31.1736190183955; Mon, 06 Jan 2025 11:03:03 -0800 (PST) Received: from localhost ([2a03:2880:30ff:9::]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aac0e89490dsm2267389766b.45.2025.01.06.11.03.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jan 2025 11:03:03 -0800 (PST) From: Breno Leitao Date: Mon, 06 Jan 2025 11:02:51 -0800 Subject: [PATCH 2/3] efi/memattr: Add FW_BUG prefix to firmware error messages Precedence: bulk X-Mailing-List: linux-efi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250106-efi_fw_bug-v1-2-01a8eb40bfeb@debian.org> References: <20250106-efi_fw_bug-v1-0-01a8eb40bfeb@debian.org> In-Reply-To: <20250106-efi_fw_bug-v1-0-01a8eb40bfeb@debian.org> To: Ard Biesheuvel Cc: Gregory Price , Usama Arif , linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1124; i=leitao@debian.org; h=from:subject:message-id; bh=SzCoB6sQHDFFteL8s7JGLImKCYtxlB9ZDym1wSLtA6k=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBnfCjiuDGAe0GVCy3Hv7yfI8K9aJu5yMo1TmQq4 dzbSyIAd8CJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCZ3wo4gAKCRA1o5Of/Hh3 bcMAEACb0hycfKstg+T1pVxX0J/1kBOiZZEdSX5aO3NjTP13qwPWtUadaXqlIXmbvh2zhC2mNwW aHTi2TlaA2zMdWhemhxjSeB2K6DYgY0k49xEAZE9Q/A/l8oVry1QqAkuuE0z0/x8yjAF1v5Bp2N gyqyZYhNV+kKvXK/OcGS3hHMefBsxEFFePjghSu/HThWCJicVBMUcSGKrSdHTBLmmsIQ+Bso5Se 5uNFUf9kqRuU/YzH1OLBTfdZ8firXYtayzdEgwdFlcHyKAUIotrwxq3QP91jG6yIQWhBMlLD3wh Eow9xATOzoTU/nF86S7ogO737mAxqz4Ry2zzH/QRmguTCSv1UE5M+gdjObfQrrvCZ0kRYx6mqeU JZDGxJQKTrEgI/TxJx7qMr7YGymnqR4QD6p18C2hpEtkW7O525N78T9ZLeTtsYCPrF1+tcxjhd2 ctdgOMJRIz+t0tMrnzlXnrfKNXheS40oq0P/mce5HFykMKH6X+HHaooWnFDbEZa3qiR3wts+kQg vM0xqVUK1vAOKG/AVDW3/Rdmf0KZ+EvSvF0/lrAe79ua2+0Yzu5GwQEI5/i5OgOyQhNag/SVfbN zMFYsHcfdQXtZncOfremWw+099w5myeoEMEo2FBmhdSdt+yIb/EEjPtwooRLkVQVJSyTrrnooS6 2QQ1k+OzIOWw/yQ== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D Tag firmware-related error messages with FW_BUG in efi_memattr_init() to make EFI firmware issues more discoverable and consistent with kernel error reporting conventions. Signed-off-by: Breno Leitao --- drivers/firmware/efi/memattr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/firmware/efi/memattr.c b/drivers/firmware/efi/memattr.c index e727cc5909cb676c47d787ab0d7754b6fdcb493d..5f83cdea88b05cb325e9f90c14a0048131e53cfa 100644 --- a/drivers/firmware/efi/memattr.c +++ b/drivers/firmware/efi/memattr.c @@ -29,13 +29,13 @@ void __init efi_memattr_init(void) tbl = early_memremap(efi_mem_attr_table, sizeof(*tbl)); if (!tbl) { - pr_err("Failed to map EFI Memory Attributes table @ 0x%lx\n", + pr_err(FW_BUG "Failed to map EFI Memory Attributes table @ 0x%lx\n", efi_mem_attr_table); return; } if (tbl->version > 2) { - pr_warn("Unexpected EFI Memory Attributes table version %d\n", + pr_warn(FW_BUG "Unexpected EFI Memory Attributes table version %d\n", tbl->version); goto unmap; } From patchwork Mon Jan 6 19:02:52 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Breno Leitao X-Patchwork-Id: 855324 Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF5F01DF99F; Mon, 6 Jan 2025 19:03:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736190189; cv=none; b=SbQlzstMhvYTTetNaOZZ1jgHuRoxGISGX5JLwmfQ+dw5XBxNAHW7dG2V6c2zUedU9RCuQSB3hwRkxgiJkTySssGpsNBohcBCCtmt4/1HFFbd9TC06k05BeQJcTBXTzdXnGgRmFj51KhIVcaBpo1So2QB+kYN77aOGyLCFgu1FwI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736190189; c=relaxed/simple; bh=XDlQUoNtCeApaDduUy35dnCHFieyco1MPgmsEZIJluI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=aZrzOaPTGZBdIxI7B37Xb1heuJie3oY5YhccxwYVPKgrgS3SCbXp4Gi73CHfEW9IMe7bXhyGoEgrgrAXj+yJ9OEErGw8GacqA7Gi8zo1avG+VsiuHFnmFDw9VI4oPOpb69mdsWAR+VMPdgs0rWfPBYrPvDQIeF2WNMMQHSm7qW8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.208.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-5d3d479b1e6so21120887a12.2; Mon, 06 Jan 2025 11:03:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736190186; x=1736794986; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WNw/CDj2AbqbsGDq693ZJ+rM8tBrERKJW3IEDPq+sNE=; b=voFZJ3ugdAV8e8QOnXzA9xJAJcPLzzM424YSnCGGnm1n50mMXrz9SutH4u/jesEQbF 0j7pxtPi7h2yfru5TpB15x2G0tiSK7h8wZF56faZXioT/oPWKhlTJv+7wKIaXpm9X5FN QIAwMo3LQLizblTIWd6tqm5fGiXb8yZ+lpqbUsrR68nNDkFradInBp505FFR5yGZNC7e 38k3Kn/o9Ao/SBwadJ53FufSe9zKOrzS2MEDbSXd4QMVzDuDIUv1oihzxNg9PpILZzNT kenrQ+Mzck17xLaCRZysv77MpOlPgZENdenPhk2yxNsmtoRQVjVlW4b395NHnFSGpxcy E+wg== X-Forwarded-Encrypted: i=1; AJvYcCXLBR6XRpNd0xdE9vOeC/10JUWbnd3mwRzxmRpkvxyB0HtpfsQlgwYLatA1KV2UB7IKpzqPCemo0Lq50mag@vger.kernel.org, AJvYcCXXmJZseofO/Mtt52Cb/sstFG5+6cgNPLBXdpdZMQHR5HC7tLU9Gdy/BE86kaJscSuheHYLwHIaT8k=@vger.kernel.org X-Gm-Message-State: AOJu0Yy7NDJnRuq+BWM7XnRx+HoDftK06ZHwSLQCvtXOKvsoGBpZlTJz 7CuFYhvfHz7mviqG0ldzPYWe6GhA2afhdLeYqifPxdAN0g8nc6Br X-Gm-Gg: ASbGncu68IjbuaePJbbcshZMeSVC1ddqiAXwU5VvWO0Z+Rc8gwkJb2zSd4FGjKKXsjR VHTPCCnFIwVUjLE74hhq7ZUSjvvfO7pm62EdWx0LEZPsxZlxOechfn7JLIdSq/BWheW6EUSQ76n nNfSKh6bi4cPgOu0iqQdNTbCcktx6dFjPD1U/GfKRDnTjAtIM0suTZ/hiY21ShGd/hJ24zMDVPM lE/x0pk1ifwFrWlCSNxH7I9YSNwAUV3c4WAz2UxDVDqamU= X-Google-Smtp-Source: AGHT+IEZDQWzmp5R71lMPn2pyV2ms78L0LJVg99guVtYekxh5sI6zcDQHYOjlstIaq5cJELBwT/M/Q== X-Received: by 2002:a05:6402:50c6:b0:5d4:35c7:cd7a with SMTP id 4fb4d7f45d1cf-5d81dd9c7d5mr150377218a12.10.1736190186213; Mon, 06 Jan 2025 11:03:06 -0800 (PST) Received: from localhost ([2a03:2880:30ff:1::]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5d80678c8dbsm23258258a12.40.2025.01.06.11.03.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jan 2025 11:03:04 -0800 (PST) From: Breno Leitao Date: Mon, 06 Jan 2025 11:02:52 -0800 Subject: [PATCH 3/3] efi/memattr: Include EFI memmap size in corruption warnings Precedence: bulk X-Mailing-List: linux-efi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250106-efi_fw_bug-v1-3-01a8eb40bfeb@debian.org> References: <20250106-efi_fw_bug-v1-0-01a8eb40bfeb@debian.org> In-Reply-To: <20250106-efi_fw_bug-v1-0-01a8eb40bfeb@debian.org> To: Ard Biesheuvel Cc: Gregory Price , Usama Arif , linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1581; i=leitao@debian.org; h=from:subject:message-id; bh=XDlQUoNtCeApaDduUy35dnCHFieyco1MPgmsEZIJluI=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBnfCji1e2QsBy/TWDBEo3SBADQTcBVfTF7xdR/A Zfp5HIZ/HmJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCZ3wo4gAKCRA1o5Of/Hh3 bShhD/0YyAnhwhxw6D0NhVeQRYnz5YOUXqeUGgN2m+arSHAP5ivVpRutIG9uQU0AZAK0nw5r3ES 8l6mtegPemB/nmDhLawV3ko0N+PRg4Hoc0M6MNNud7G/aTOIcYslW+T2PlSGj4zvvn3ZgWCuulz EBhXdNTJP546dpgH9phhPztVs57ehyehlRYoCcc2spO7NJ+4FgXti4T/cUBF7RmJOHU/3aGXXjl ivACPZu6ESYbY7PRd9t6qh7zGKDcKdub0OXKl1iZ2CBS2pvUu1fZAVPAAFJMB7KTglXxa7PBoEt tLEtz1oTvWYNsvkMcYe8uDEBH2lDeX0tTSGcZO9QFOTBuBMDAZio0pELqaIlHChkeipqtzAsVns tJGxJVEnvXVRs6G7Y77APJK2lA8v8ELv4SM94VGy+OAwDqGRlPjhKDOC4fuxjdVhtfeH1wa8eb2 rwxpJzzfDqjfJCpr8651CUFdnGxVbU/i+i/yAmLL1cDK8fRyw+arhU1XWu6QZibLWnojX0sFuFg DYuw0YWfwgEckEdfy8c6Sr0AFeDKjdw3sFpzO5LDLwhHFRCW6hatFk3i/qSGocg1hauyoGP9D6P HqstDoRITxTO5BBSKBEUW4Wopheo+gNSeWQ8niWrQ3KwI23a8estH0NWhrbOhfoAeMdg1KEVUSw W3+EMhJJ40wv1Aw== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D Add EFI memory map size to warning messages when a corrupted Memory Attributes Table is detected, making it easier to diagnose firmware issues. Signed-off-by: Breno Leitao --- drivers/firmware/efi/memattr.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/firmware/efi/memattr.c b/drivers/firmware/efi/memattr.c index 5f83cdea88b05cb325e9f90c14a0048131e53cfa..2c276bcc0df48352bec6cd96b69edf67a16f6069 100644 --- a/drivers/firmware/efi/memattr.c +++ b/drivers/firmware/efi/memattr.c @@ -22,7 +22,7 @@ unsigned long __ro_after_init efi_mem_attr_table = EFI_INVALID_TABLE_ADDR; void __init efi_memattr_init(void) { efi_memory_attributes_table_t *tbl; - unsigned long size; + unsigned long size, efi_map_size; if (efi_mem_attr_table == EFI_INVALID_TABLE_ADDR) return; @@ -49,9 +49,10 @@ void __init efi_memattr_init(void) * just be ignored altogether. */ size = tbl->num_entries * tbl->desc_size; - if (size > 3 * efi.memmap.nr_map * efi.memmap.desc_size) { - pr_warn(FW_BUG "Corrupted EFI Memory Attributes Table detected! (version == %u, desc_size == %u, num_entries == %u)\n", - tbl->version, tbl->desc_size, tbl->num_entries); + efi_map_size = efi.memmap.nr_map * efi.memmap.desc_size; + if (size > 3 * efi_map_size) { + pr_warn(FW_BUG "Corrupted EFI Memory Attributes Table detected! (version == %u, desc_size == %u, num_entries == %u, efi_map_size == %lu)\n", + tbl->version, tbl->desc_size, tbl->num_entries, efi_map_size); goto unmap; }