blog.fpmurphy.com
Open in
urlscan Pro
2607:f298:5:111b::1af:a7f6
Public Scan
Submitted URL: http://fpmurphy.com/
Effective URL: https://blog.fpmurphy.com/
Submission: On April 27 via api from GB — Scanned from GB
Effective URL: https://blog.fpmurphy.com/
Submission: On April 27 via api from GB — Scanned from GB
Form analysis
2 forms found in the DOMPOST https://blog.fpmurphy.com/wp-comments-post.php
<form action="https://blog.fpmurphy.com/wp-comments-post.php" method="post" id="commentform" class="comment-form">
<p><textarea name="comment" id="comment" rows="10" cols="10" tabindex="4"></textarea></p>
<p><input class="text author" id="author" name="author" type="text" value="" size="30" tabindex="1"> <label for="author"><strong>Name </strong> (required)</label></p>
<p><input class="text email" id="email" name="email" type="text" value="" size="30" tabindex="2"> <label for="email"><strong>Email</strong> (will not be published) (required)</label></p>
<p class="form-submit"><input name="submit" type="submit" id="submit" class="submit" value="Post Comment"> <input type="hidden" name="comment_post_ID" value="2503" id="comment_post_ID">
<input type="hidden" name="comment_parent" id="comment_parent" value="0">
</p>
<p style="display: none;"><input type="hidden" id="akismet_comment_nonce" name="akismet_comment_nonce" value="b5d9280790"></p>
<p style="display: none !important;"><label>Δ<textarea name="ak_hp_textarea" cols="45" rows="8" maxlength="100"></textarea></label><input type="hidden" id="ak_js_1" name="ak_js" value="1651080319285">
<script>
document.getElementById("ak_js_1").setAttribute("value", (new Date()).getTime());
</script>
</p>
</form>
POST https://feedburner.google.com/fb/a/mailverify
<form style="border:0px solid #ccc;padding:3px;text-align:center;" action="https://feedburner.google.com/fb/a/mailverify" method="post" target="popupwindow"
onsubmit="window.open('https://feedburner.google.com/fb/a/mailverify?uri=MusingsOfAnOsPlumber', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true">
<p style="font-size:10px; float: left;">Enter your email address</p>
<p><input type="text" style="width:160px" name="email"></p><input type="hidden" value="MusingsOfAnOsPlumber" name="uri"><input type="hidden" name="loc" value="en_US"><input type="submit" value="Subscribe">
</form>
Text Content
MUSINGS of an OS plumber TRANSLATE Sprache auswählenDeutschAfrikaansAlbanischAmharischArabischArmenischAserbaidschanischBaskischBelarussischBengalischBirmanischBosnischBulgarischCebuanoChichewaChinesisch (traditionell)Chinesisch (vereinfacht)DänischEsperantoEstnischFilipinoFinnischFranzösischFriesischGalizischGeorgischGriechischGujaratiHaitianischHausaHawaiischHebräischHindiHmongIgboIndonesischIrischIsländischItalienischJapanischJavanischJiddischKannadaKasachischKatalanischKhmerKinyarwandaKirgisischKoreanischKorsischKroatischKurdisch (Kurmandschi)LaoLateinischLettischLitauischLuxemburgischMalagasyMalayalamMalaysischMaltesischMaoriMarathiMazedonischMongolischNepalesischNiederländischNorwegischOdia (Oriya)PaschtuPersischPolnischPortugiesischPunjabiRumänischRussischSamoanischSchottisch-GälischSchwedischSerbischSesothoShonaSindhiSinghalesischSlowakischSlowenischSomaliSpanischSuaheliSundanesischTadschikischTamilTatarischTeluguThailändischTschechischTürkischTurkmenischUigurischUkrainischUngarischUrduUsbekischVietnamesischWalisischXhosaYorubaZulu Powered by Google Übersetzer SEE ALSO GitHub Repositories ARCHIVES * February 2022 * January 2022 * December 2021 * February 2021 * April 2019 * March 2019 * February 2019 * January 2019 * December 2018 * October 2018 * September 2018 * August 2018 * July 2018 * June 2018 * May 2018 * April 2018 * March 2018 * February 2018 * January 2018 * December 2017 * November 2017 * October 2017 * September 2017 * August 2017 * July 2017 * June 2017 * May 2017 * April 2017 * March 2017 * February 2017 * January 2017 * December 2016 * November 2016 * October 2016 * September 2016 * August 2016 * July 2016 * June 2016 * May 2016 * April 2016 * March 2016 * February 2016 * January 2016 * December 2015 * November 2015 * October 2015 * September 2015 * August 2015 * July 2015 * June 2015 * May 2015 * April 2015 * March 2015 * February 2015 * January 2015 * December 2014 * November 2014 * October 2014 * September 2014 * August 2014 * July 2014 * June 2014 * May 2014 * April 2014 * March 2014 * February 2014 * January 2014 * December 2013 * November 2013 * October 2013 * September 2013 * August 2013 * July 2013 * June 2013 * May 2013 * April 2013 * March 2013 * February 2013 * January 2013 * December 2012 * November 2012 * October 2012 * September 2012 * August 2012 * July 2012 * June 2012 * May 2012 * April 2012 * March 2012 * February 2012 * January 2012 * December 2011 * November 2011 * October 2011 * September 2011 * August 2011 * July 2011 * June 2011 * May 2011 * April 2011 * March 2011 * February 2011 * January 2011 * December 2010 * November 2010 * October 2010 * September 2010 * August 2010 * July 2010 * June 2010 * May 2010 * April 2010 * March 2010 * February 2010 * January 2010 * December 2009 * November 2009 * October 2009 * September 2009 * August 2009 * July 2009 * June 2009 * May 2009 * April 2009 * March 2009 * February 2009 * January 2009 * December 2008 * November 2008 * October 2008 * September 2008 * August 2008 * July 2008 * June 2008 * May 2008 * April 2008 * March 2008 * February 2008 * January 2008 * December 2007 * November 2007 * August 2007 * July 2007 * June 2007 * May 2007 Exploring Lenovo T480 NVRAM Variables With CHIPSEC » CHIPSEC V1.8.1 UEFI SHELL SPI DUMP COMMAND ERROR CHIPSEC is a “extensible framework for analyzing platform level security of hardware, devices, system firmware, low-level protection mechanisms, and the configuration of various platform components. It contains a set of modules, including simple tests for hardware protections and correct configuration, tests for vulnerabilities in firmware and platform components, security assessment and fuzzing tools for various platform devices and interfaces, and tools acquiring critical firmware and device artifacts”. CHIPSEC is mostly written in Python for portability and can run on Linux, Windows, Mac OSX, DAL, and the UEFI shell. It is Intel-centric at this time. The recent update from Python 2 from Python 3 broke a couple of commands. For example, in version 1.8.1, I am getting a TypeError: argument 3 must be str, not bytes exception when I invoke chipsec_util.py spi dump rom.bin from a UEFI shell. Here is the full error details: ################################################################ CHIPSEC: Platform Hardware Security Assessment Framework ################################################################ [CHIPSEC] Version : 1.8.0 [CHIPSEC] OS : uefi [CHIPSEC] Python : 3.6.8 (64-bit) [CHIPSEC] API mode: using CHIPSEC kernel module API [CHIPSEC] Helper : EfiHelper (None) [CHIPSEC] Platform: Mobile 8th Generation Core Processor (Kabylake U-Quad Core) [CHIPSEC] VID: 8086 [CHIPSEC] DID: 5914 [CHIPSEC] RID: 08 [CHIPSEC] PCH : PCH-U with iHDCP 2.2 Premium [CHIPSEC] VID: 8086 [CHIPSEC] DID: 9D4E [CHIPSEC] RID: 21 [CHIPSEC] Executing command 'spi' with args ['dump', 'rom.bin'] [CHIPSEC] Dumping entire SPI flash memory to 'rom.bin' [CHIPSEC] it may take a few minutes (use DEBUG or VERBOSE logger options to see progress) [CHIPSEC] BIOS region: base = 0x00700000, limit = 0x00FFFFFF [CHIPSEC] Dumping 0x01000000 bytes (to the end of BIOS region) [spi] reading 0x1000000 bytes from SPI at FLA = 0x0 (in 262144 0x40-byte chunks + 0x0-byte remainder) Traceback (most recent call last): File "chipsec_util.py", line 218, in sys.exit( main() ) File "chipsec_util.py", line 214, in main return chipsecUtil.main() File "chipsec_util.py", line 189, in main comm.run() File "FS1:\chipsec\chipsec\utilcmd\spi_cmd.py", line 182, in run self.func() File "FS1:\chipsec\chipsec\utilcmd\spi_cmd.py", line 108, in spi_dump buf = self._spi.read_spi_to_file( 0, spi_size, self.out_file ) File "FS1:\chipsec\chipsec\hal\spi.py", line 564, in read_spi_to_file buf = self.read_spi( spi_fla, data_byte_count ) File "FS1:\chipsec\chipsec\hal\spi.py", line 592, in read_spi cycle_done = self._wait_SPI_flash_cycle_done() File "FS1:\chipsec\chipsec\hal\spi.py", line 507, in _wait_SPI_flash_cycle_done self.spi_reg_write( self.hsfs_off, HSFSTS_CLEAR, 1 ) File "FS1:\chipsec\chipsec\hal\spi.py", line 243, in spi_reg_write return self.mmio.write_MMIO_reg(self.rcba_spi_base, reg, value, size) File "FS1:\chipsec\chipsec\hal\mmio.py", line 112, in write_MMIO_reg self.cs.helper.write_mmio_reg( bar_base, size, value, offset, bar_size ) File "FS1:\chipsec\chipsec\helper\oshelper.py", line 192, in write_mmio_reg ret = self.helper.write_mmio_reg(bar_base +offset, size, value ) File "FS1:\chipsec\chipsec\helper\efi\efihelper.py", line 166, in write_mmio_reg edk2.writemem(phys_address_lo, phys_address_hi, buf, size) TypeError: argument 3 must be str, not bytes The fix was simple. All that was required was to modify one line of code in write_mmio_reg() which is in …/chipsec/helper/efi/efihelper.py, and also import bytestostring from chipsec.defines in the same file. Here is the existing version 1.8.1 code for write_mmio_reg: 1 2 3 4 5 6 7 8 def write_mmio_reg(self, phys_address, size, value): phys_address_lo = phys_address & 0xFFFFFFFF phys_address_hi = (phys_address >> 32) & 0xFFFFFFFF if size == 4: return edk2.writemem_dword(phys_address_lo, phys_address_hi, value) else: buf = struct.pack(size * "B", value) edk2.writemem(phys_address_lo, phys_address_hi, buf, size) Here is the modified code that works: 1 2 3 4 5 6 7 8 def write_mmio_reg(self, phys_address, size, value): phys_address_lo = phys_address & 0xFFFFFFFF phys_address_hi = (phys_address >> 32) & 0xFFFFFFFF if size == 4: return edk2.writemem_dword(phys_address_lo, phys_address_hi, value) else: buf = bytestostring( struct.pack(size * "B", value) ) edk2.writemem(phys_address_lo, phys_address_hi, buf, size) What is bytestostring you may ask and why is the change necessary? Here is the definition of bytestostring from …/chipsec/defines.py: 1 2 3 4 5 def bytestostring(mbytes): if isinstance(mbytes, bytes): return mbytes.decode("latin_1") else: return mbytes Note that the real work is done by the mbytes object’s mbytes.decode method. As an aside, I am not sure why latin_1 was chosen by the developers of CHIPSEC as the decoded string format but it works. For completeness, some notes about Python 3 TypeError follow. As you are probably aware, Python 3 is a much stricter object-orientated programming language than Python 2. It always checks the type of object you are passing and whether a particular object type supports the operation. If there is a mismatch, Python 3 will throw a TypeError exception error. Note that type constraints are not checked at compile time; therefore operations on an object may fail at runtime if the given object is not of a suitable type. Looking back at the defective source code, you can see that the line struct.pack(size * “B”, value) returns a bytes object in buf. struct.pack is part of the struct.py module which performs conversions between Python values and C structs represented as Python bytes objects. In this case, “B” is the format character for unsigned char C type (Python – integer type) whose size is 1 byte. However edk2.writemem expects a string for the third argument – not a bytes object. This mismatch of types causes the TypeError exception. Enjoy! February 10th, 2022 LEAVE A REPLY CANCEL REPLY Name (required) Email (will not be published) (required) Δ This site uses Akismet to reduce spam. Learn how your comment data is processed. TAGS ACPI Bash C Cinnamon D-Bus DBus EFI Extension Fedora Fedora 16 Fedora 18 Fedora 19 FireFox GCC GNOME GNOME Shell GPT GRUB GRUB2 Java JavaScript kernel Korn Shell ksh ksh93 Linux MBR PackageKit PowerShell Python RHCSA RHEL RHEL7 RPM Secure Boot shell systemd UDK2015 UEFI UEFI Shell VMware Workstation Windows XML XSLT yum Enter your email address Copyright © 2007-2022 Finnbarr P. Murphy. All Rights Reserved We use cookies to ensure that we give you the best possible experience on our website.I AcceptCookie Policy ORIGINALTEXT Bessere Übersetzung vorschlagen --------------------------------------------------------------------------------