<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Nov 23, 2021 at 4:18 AM Sunny Wang <<a href="mailto:Sunny.Wang@arm.com">Sunny.Wang@arm.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div style="overflow-wrap: break-word;" lang="EN-US">
<div class="gmail-m_-3416468625086588741WordSection1">
<p class="MsoNormal">You’re right, Alex. <u></u><u></u></p>
<p class="MsoNormal">Edhaya and I just checked this. Our kernel config is in /proc/config.gz. Could you add code to handle /proc/config.gz?
</p></div></div></blockquote><div><br></div><div style="font-family:verdana,sans-serif" class="gmail_default">Please share a copy of config.gz for further analysis.<br></div><div style="font-family:verdana,sans-serif" class="gmail_default"></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;" lang="EN-US"><div class="gmail-m_-3416468625086588741WordSection1"><p class="MsoNormal"><u></u><u></u></p>
<p class="MsoNormal">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>.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Best Regards,<u></u><u></u></p>
<p class="MsoNormal">Sunny<u></u><u></u></p>
<div style="border-color:rgb(225,225,225) currentcolor currentcolor;border-style:solid none none;border-width:1pt medium medium;padding:3pt 0cm 0cm">
<p class="MsoNormal"><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<u></u><u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal"><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.<u></u><u></u></span></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">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:<u></u><u></u></p>
</div>
<blockquote style="border-color:currentcolor currentcolor currentcolor rgb(204,204,204);border-style:none none none solid;border-width:medium medium medium 1pt;padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm">
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-family:"Verdana",sans-serif"><u></u> <u></u></span></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">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:<u></u><u></u></p>
</div>
<blockquote style="border-color:currentcolor currentcolor currentcolor rgb(204,204,204);border-style:none none none solid;border-width:medium medium medium 1pt;padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm">
<p class="MsoNormal">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?<u></u><u></u></p>
</blockquote>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<div>
<p class="MsoNormal"><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)<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Verdana",sans-serif"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><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.<u></u><u></u></span></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<blockquote style="border-color:currentcolor currentcolor currentcolor rgb(204,204,204);border-style:none none none solid;border-width:medium medium medium 1pt;padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm">
<p class="MsoNormal"><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.<u></u><u></u></p>
</blockquote>
</div>
<p class="MsoNormal"><br clear="all">
<br>
-- <u></u><u></u></p>
<div>
<div>
<p class="MsoNormal">Cheers,<br>
Alex Hung<u></u><u></u></p>
</div>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal"><br clear="all">
<br>
-- <u></u><u></u></p>
<div>
<div>
<p class="MsoNormal">Cheers,<br>
Alex Hung<u></u><u></u></p>
</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.
</div>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr">Cheers,<br>Alex Hung<br></div></div></div>