<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:PMingLiU;
panose-1:2 2 5 0 0 0 0 0 0 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Verdana;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:"\@PMingLiU";
panose-1:2 1 6 1 0 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Here you go. <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Best Regards,<o:p></o:p></p>
<p class="MsoNormal">Sunny<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b>From:</b> Alex Hung <alex.hung@canonical.com> <br>
<b>Sent:</b> 25 November 2021 16:39<br>
<b>To:</b> Sunny Wang <Sunny.Wang@arm.com><br>
<b>Cc:</b> fwts-devel@lists.ubuntu.com; G Edhaya Chandran <Edhaya.Chandran@arm.com><br>
<b>Subject:</b> Re: [PATCH][V3] dmicheck: skip scanning smbios in /dev/mem on aarch64<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-family:"Verdana",sans-serif"><o:p> </o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">On Tue, Nov 23, 2021 at 4:18 AM Sunny Wang <<a href="mailto:Sunny.Wang@arm.com">Sunny.Wang@arm.com</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">You’re right, Alex.
<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Edhaya and I just checked this. Our kernel config is in /proc/config.gz. Could you add code to handle /proc/config.gz?
<o:p></o:p></p>
</div>
</div>
</blockquote>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Verdana",sans-serif">Please share a copy of config.gz for further analysis.<o:p></o:p></span></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">For more information, please check
<a href="https://superuser.com/questions/287371/obtain-kernel-config-from-currently-running-linux-system" target="_blank">
https://superuser.com/questions/287371/obtain-kernel-config-from-currently-running-linux-system</a>.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Best Regards,<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Sunny<o:p></o:p></p>
<div style="border:none;border-top:solid windowtext 1.0pt;padding:3.0pt 0cm 0cm 0cm;border-color:currentcolor currentcolor">
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><b>From:</b> Alex Hung <<a href="mailto:alex.hung@canonical.com" target="_blank">alex.hung@canonical.com</a>>
<br>
<b>Sent:</b> 22 November 2021 22:59<br>
<b>To:</b> Sunny Wang <<a href="mailto:Sunny.Wang@arm.com" target="_blank">Sunny.Wang@arm.com</a>><br>
<b>Cc:</b> <a href="mailto:fwts-devel@lists.ubuntu.com" target="_blank">fwts-devel@lists.ubuntu.com</a>; G Edhaya Chandran <<a href="mailto:Edhaya.Chandran@arm.com" target="_blank">Edhaya.Chandran@arm.com</a>><br>
<b>Subject:</b> Re: [PATCH][V3] dmicheck: skip scanning smbios in /dev/mem on aarch64<o:p></o:p></p>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-family:"Verdana",sans-serif">It is also possible that your ACS uses a different approach for kernel config, i.e. not /boot/config-`uname -r` like Ubuntu and fwts-live.
If that's the case, this patch can be improved to include more ways for kernel config.</span><o:p></o:p></p>
</div>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">On Mon, Nov 22, 2021 at 3:46 PM Alex Hung <<a href="mailto:alex.hung@canonical.com" target="_blank">alex.hung@canonical.com</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid windowtext 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt;border-color:currentcolor currentcolor currentcolor rgb(204,204,204)">
<div>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-family:"Verdana",sans-serif"> </span><o:p></o:p></p>
</div>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">On Mon, Nov 22, 2021 at 2:44 PM Sunny Wang <<a href="mailto:Sunny.Wang@arm.com" target="_blank">Sunny.Wang@arm.com</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid windowtext 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt;border-color:currentcolor currentcolor currentcolor rgb(204,204,204)">
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Hi Alex,<br>
<br>
Edhaya and I just tested the v2 patch by cherry-picking it into our ACS FWTS, and then somehow this fix doesn’t work.<br>
Does it work on your side? Could you build the FWTS live image with this fix and offline share it with us for verification?<o:p></o:p></p>
</blockquote>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-family:"Verdana",sans-serif">Yes it worked on my RPI4. The attached results.log contains two runs: 1st run with patch (runs to completion) and 2nd run without
the patch (stopped in test 1)</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-family:"Verdana",sans-serif"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-family:"Verdana",sans-serif">The fwts-live requires released version of fwts so it's not possible without major modifications. If it doesn't work I think the patch
may not fix but hide the error on my systems. We will have to revisit the bug again.</span><o:p></o:p></p>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid windowtext 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt;border-color:currentcolor currentcolor currentcolor rgb(204,204,204)">
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><br>
Best Regards,<br>
Sunny<br>
-----Original Message-----<br>
From: fwts-devel <<a href="mailto:fwts-devel-bounces@lists.ubuntu.com" target="_blank">fwts-devel-bounces@lists.ubuntu.com</a>> On Behalf Of Alex Hung<br>
Sent: 22 November 2021 02:15<br>
To: <a href="mailto:fwts-devel@lists.ubuntu.com" target="_blank">fwts-devel@lists.ubuntu.com</a><br>
Subject: [PATCH][V3] dmicheck: skip scanning smbios in /dev/mem on aarch64<br>
<br>
Buglink: <a href="https://bugs.launchpad.net/bugs/1947786" target="_blank">https://bugs.launchpad.net/bugs/1947786</a><br>
<br>
Signed-off-by: Alex Hung <<a href="mailto:alex.hung@canonical.com" target="_blank">alex.hung@canonical.com</a>><br>
---<br>
src/dmi/dmicheck/dmicheck.c | 14 +++++++<br>
src/lib/include/fwts.h | 1 +<br>
src/lib/include/fwts_kernel.h | 25 ++++++++++++<br>
src/lib/src/Makefile.am | 1 +<br>
src/lib/src/fwts_kernel.c | 74 +++++++++++++++++++++++++++++++++++<br>
5 files changed, 115 insertions(+)<br>
create mode 100644 src/lib/include/fwts_kernel.h<br>
create mode 100644 src/lib/src/fwts_kernel.c<br>
<br>
diff --git a/src/dmi/dmicheck/dmicheck.c b/src/dmi/dmicheck/dmicheck.c<br>
index 7f6a90c4..3985b126 100644<br>
--- a/src/dmi/dmicheck/dmicheck.c<br>
+++ b/src/dmi/dmicheck/dmicheck.c<br>
@@ -381,6 +381,13 @@ static void* dmi_table_smbios(fwts_framework *fw, fwts_smbios_entry *entry)<br>
free(table);<br>
}<br>
<br>
+#ifdef FWTS_ARCH_AARCH64<br>
+ if (fwts_kernel_config_set("CONFIG_STRICT_DEVMEM")) {<br>
+ fwts_warning(fw, "Skipping scanning SMBIOS table in memory for arm64 systems");<br>
+ return NULL;<br>
+ }<br>
+#endif<br>
+<br>
mem = fwts_mmap(addr, length);<br>
if (mem != FWTS_MAP_FAILED) {<br>
/* Can we safely copy the table? */<br>
@@ -429,6 +436,13 @@ static void* dmi_table_smbios30(fwts_framework *fw, fwts_smbios30_entry *entry)<br>
free(table);<br>
}<br>
<br>
+#ifdef FWTS_ARCH_AARCH64<br>
+ if (fwts_kernel_config_set("CONFIG_STRICT_DEVMEM")) {<br>
+ fwts_warning(fw, "Skipping scanning SMBIOS3 table in memory for arm64 systems");<br>
+ return NULL;<br>
+ }<br>
+#endif<br>
+<br>
mem = fwts_mmap(addr, length);<br>
if (mem != FWTS_MAP_FAILED) {<br>
/* Can we safely copy the table? */<br>
diff --git a/src/lib/include/fwts.h b/src/lib/include/fwts.h<br>
index 551a4e09..be754a99 100644<br>
--- a/src/lib/include/fwts.h<br>
+++ b/src/lib/include/fwts.h<br>
@@ -185,6 +185,7 @@<br>
#include "fwts_iasl.h"<br>
#include "fwts_ipmi.h"<br>
#include "fwts_klog.h"<br>
+#include "fwts_kernel.h"<br>
#include "fwts_olog.h"<br>
#include "fwts_pipeio.h"<br>
#include "fwts_stringextras.h"<br>
diff --git a/src/lib/include/fwts_kernel.h b/src/lib/include/fwts_kernel.h<br>
new file mode 100644<br>
index 00000000..a89576ae<br>
--- /dev/null<br>
+++ b/src/lib/include/fwts_kernel.h<br>
@@ -0,0 +1,25 @@<br>
+/*<br>
+ * Copyright (C) 2021 Canonical<br>
+ *<br>
+ * This program is free software; you can redistribute it and/or<br>
+ * modify it under the terms of the GNU General Public License<br>
+ * as published by the Free Software Foundation; either version 2<br>
+ * of the License, or (at your option) any later version.<br>
+ *<br>
+ * This program is distributed in the hope that it will be useful,<br>
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>
+ * GNU General Public License for more details.<br>
+ *<br>
+ * You should have received a copy of the GNU General Public License<br>
+ * along with this program; if not, write to the Free Software<br>
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.<br>
+ *<br>
+ */<br>
+<br>
+#ifndef __FWTS_KERNEL_H__<br>
+#define __FWTS_KERNEL_H__<br>
+<br>
+bool fwts_kernel_config_set(const char *config);<br>
+<br>
+#endif<br>
diff --git a/src/lib/src/Makefile.am b/src/lib/src/Makefile.am<br>
index 55c52b41..0a39882a 100644<br>
--- a/src/lib/src/Makefile.am<br>
+++ b/src/lib/src/Makefile.am<br>
@@ -83,6 +83,7 @@ libfwts_la_SOURCES = \<br>
fwts_ioport.c \<br>
fwts_ipmi.c \<br>
fwts_json.c \<br>
+ fwts_kernel.c \<br>
fwts_keymap.c \<br>
fwts_klog.c \<br>
fwts_olog.c \<br>
diff --git a/src/lib/src/fwts_kernel.c b/src/lib/src/fwts_kernel.c<br>
new file mode 100644<br>
index 00000000..10d11a99<br>
--- /dev/null<br>
+++ b/src/lib/src/fwts_kernel.c<br>
@@ -0,0 +1,74 @@<br>
+/*<br>
+ * Copyright (C) 2021 Canonical<br>
+ *<br>
+ * This program is free software; you can redistribute it and/or<br>
+ * modify it under the terms of the GNU General Public License<br>
+ * as published by the Free Software Foundation; either version 2<br>
+ * of the License, or (at your option) any later version.<br>
+ *<br>
+ * This program is distributed in the hope that it will be useful,<br>
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>
+ * GNU General Public License for more details.<br>
+ *<br>
+ * You should have received a copy of the GNU General Public License<br>
+ * along with this program; if not, write to the Free Software<br>
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.<br>
+ *<br>
+ */<br>
+<br>
+#include <sys/utsname.h><br>
+<br>
+#include "fwts.h"<br>
+#include "fwts_kernel.h"<br>
+#include <stdlib.h><br>
+#include <stdio.h><br>
+#include <bsd/string.h><br>
+<br>
+#define CONFIG_FILE_PREFIX "/boot/config-"<br>
+<br>
+/*<br>
+ * fwts_kernel_config_set<br>
+ * check whether a kernel config is set, ex.<br>
+ * true if CONFIG_XYZ=y or CONFIG_XYZ=m<br>
+ */<br>
+bool fwts_kernel_config_set(const char *config)<br>
+{<br>
+ const size_t config_str_len = strlen(config) + 3;<br>
+ char config_file[PATH_MAX];<br>
+ char config_str[255];<br>
+ size_t config_file_len;<br>
+ fwts_list* config_list;<br>
+ fwts_list_link *item;<br>
+ struct utsname buf;<br>
+<br>
+ /* get path of config file, i.e. /boot/config-5.11.0-38-generic */<br>
+ uname(&buf);<br>
+ config_file_len = strlen(CONFIG_FILE_PREFIX) + strlen(buf.release) + 1;<br>
+ (void)strlcpy(config_file, CONFIG_FILE_PREFIX, config_file_len);<br>
+ (void)strlcat(config_file, buf.release, config_file_len);<br>
+<br>
+ config_list = fwts_file_open_and_read(config_file);<br>
+ if (config_list == NULL)<br>
+ return false;<br>
+<br>
+ fwts_list_foreach(item, config_list) {<br>
+ /* check built-in, i.e. =y */<br>
+ (void)strlcpy(config_str, config, config_str_len);<br>
+ (void)strlcat(config_str, "=y", config_str_len);<br>
+ if (!strncmp(fwts_text_list_text(item), config_str, strlen(config_str))) {<br>
+ fwts_list_free(config_list, free);<br>
+ return true;<br>
+ }<br>
+<br>
+ /* check module, i.e. =m */<br>
+ config_str[strlen(config_str) - 1] = 'm';<br>
+ if (!strncmp(fwts_text_list_text(item), config_str, strlen(config_str))) {<br>
+ fwts_list_free(config_list, free);<br>
+ return true;<br>
+ }<br>
+ }<br>
+<br>
+ fwts_list_free(config_list, free);<br>
+ return false;<br>
+}<br>
--<br>
2.32.0<br>
<br>
<br>
--<br>
fwts-devel mailing list<br>
<a href="mailto:fwts-devel@lists.ubuntu.com" target="_blank">fwts-devel@lists.ubuntu.com</a><br>
Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/fwts-devel" target="_blank">
https://lists.ubuntu.com/mailman/listinfo/fwts-devel</a><br>
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose,
or store or copy the information in any medium. Thank you.<o:p></o:p></p>
</blockquote>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><br clear="all">
<br>
-- <o:p></o:p></p>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Cheers,<br>
Alex Hung<o:p></o:p></p>
</div>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><br clear="all">
<br>
-- <o:p></o:p></p>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Cheers,<br>
Alex Hung<o:p></o:p></p>
</div>
</div>
</div>
<p class="MsoNormal">IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person,
use it for any purpose, or store or copy the information in any medium. Thank you.
<o:p></o:p></p>
</div>
</blockquote>
</div>
<p class="MsoNormal"><br clear="all">
<br>
-- <o:p></o:p></p>
<div>
<div>
<p class="MsoNormal">Cheers,<br>
Alex Hung<o:p></o:p></p>
</div>
</div>
</div>
</div>
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose,
or store or copy the information in any medium. Thank you.
</body>
</html>