6

I have an Asus eee 4G (AMI BIOS), I want to ask if this product actually overwrites the entire RAM during cold boot. I have the "Quick boot" feature turned off and I can see the memory being tested during the BIOS post, but I read that it might not actually work that way.

Why do old computers perform a long memory test on every boot?

Here the user @Bitbang3r wrote:

Adding fuel to the fire... on a modern PC, performing naive "write bytes, read them back" tests of RAM might not even directly touch the ram that's ostensibly being tested AT ALL... modern PCs have so much primary & secondary cache, a strategy that fails to explicitly take cache-management into account is potentially doing nothing more than wasting the user's time by repeatedly exercising the cache while ignoring the underlying RAM. Even IF the values eventually got written to "real" RAM, it might not happen until long AFTER you seemingly read the bytes back & decided they matched.

So what is the truth, will the entire RAM be overwritten in my case?

Is the whole CPU cache (L1 64 + L2 512 in my case) also tested during BIOS POST?

user3840170
  • 23,072
  • 4
  • 91
  • 150
Hasbo
  • 61
  • 3
  • 2
    Surely a BIOS would be able to control the caches in a way that it actually tests the memory. There may be just a shorter quick test for memory and other items when performing a quick boot. – Justme Dec 14 '22 at 21:42
  • 2
    @Justme the question isn’t whether BIOSs are hypothetically able to do so, but whether or not they actually do it. (BIOS writers are notoriously lazy, tending to change as little as possible, and only when mandatory.) – RonJohn Dec 14 '22 at 22:14
  • 1
    @RonJohn Even if the cache is on, you would think that writing a block of RAM larger than what fits in cache and then reading the block of RAM back would actually be read from RAM because it didn't fit in the cache to begin with. – Justme Dec 14 '22 at 23:24
  • 1
    It seems rather unlikely that there's machine-specific memory test firmware routines that are somehow unaware of how caches work. Besides, in my (non-x86) experience, machines boot up with caches disabled, and you have to explicitly enable them. – dave Dec 15 '22 at 02:36
  • 1
    @Justme that’s the point.. You’d think they would. The question is whether or not they actually did it on OP’s old netbook. – RonJohn Dec 15 '22 at 05:01
  • 6
    @RonJohn, "BIOS writers are notoriously lazy, tending to..." Where is this notoriety known, though, and what weight does it carry? Thanks because the way those comments are written, it just reads like hearsay applied as a blanket statement. It would seem difficult to believe that a significant number, or any, BIOS coders have not taken account of cache memory operation in a memory test put into such low-level software as a BIOS. Caches have been around since the 1980s so surely most BIOS coders wouldn't know life without it. – TonyM Dec 15 '22 at 09:47
  • @TonyM each company’s BIOSs changed little over the years. Linux kernel programmers interfacing with the BIOS regularly complained about it. They complain about bad UEFI programming too. Naturally, this does not mean they are the only lazy programmers, which is the assumption you jumped to. – RonJohn Dec 15 '22 at 10:28
  • @TonyM and I’ve written multiple times that we just don’t know. – RonJohn Dec 15 '22 at 10:29
  • @RonJohn, actually I hadn't jumped to anything. But if, as you later said, 'we just don't know' then a reasonable starting point seems to be that BIOS/UEFI does account for cache in its RAM tests, unless presented with evidence to the contrary. But (and as Justme pointed out) the BIOS would be unable to run a full RAM test that was fooled by the cache. By definition, a cache is always much smaller than the RAM it supports, usually far smaller. – TonyM Dec 15 '22 at 12:01
  • 1
    @RonJohn - programmers (myself included) always complain about other programmers. Specifically, "firmware is software written by hardware engineers". More generally, as Jean-Paul Sartre almost said, "hell is other people's code". – dave Dec 16 '22 at 01:12
  • The Asus eee 4G is not on topic for Retrocomputing.SE because it is a recent and modern computer – Omar and Lorraine Dec 16 '22 at 10:43
  • @OmarL While the Eee PCs may be out of topic generally, this question pretty straightforwardly applies to late 1990s/early 2000s computers, which I think are generally considered within scope. – user3840170 Dec 16 '22 at 19:52
  • 2
    I believe at some point, the purpose of the "memory test" was no longer to actually check every bit, but merely to verify that the memory map read from the hardware was correct. And for that, it should be safe to assume that memory is installed in units of some fixed size, let's say 16KB. So then it suffices to just check that you can write and read one byte out of each 16KB block that the hardware claims is RAM. But maybe that's what your Quick Boot did. – Nate Eldredge Dec 16 '22 at 21:56
  • 1
    I think this is a computer security question. From ~2012 there is a mechanism to force UEFI to overwrite all memory on a cold boot, this is to prevent extraction of encryption keys. (I've seen it on Haswell+). It may be worthless on systems prior because you can press escape to skip memory tests, and an attacker would do just that. – user71659 Dec 21 '22 at 00:15
  • @NateEldredge I assume that if the RAM could be partially restored after a FULL POST, it would be documented in some of the studies. For example, in the document "Lest We Remember: Cold Boot Attacks on Encryption Keys" it literally says: If the attacker cannot bypass the POST, he cannot image the PC's memory with locally-executing software. It is mentioned in connection with "quick boot" – Hasbo Dec 22 '22 at 03:23
  • 1
    You're asking two questions (at least) here: Do you want to know whether the BIOS clears (i.e. "writes", which it certainly does) or tests the entire RAM at boot time? These two things are entirely different concepts (with the concept of test having a possibly very wide range of thoroughness). – tofro Dec 22 '22 at 10:24

1 Answers1

6

Because dynamic RAM's switch-on contents is random, the memory of a computer needs to be brought to a defined state anyways. The clearing (and clear-check afterwards) is and was also the method of choice to detect the amount of RAM installed in the computer. Maintaining (or rather, not clearing) RAM on reset can also be considered a security issue.

In the early days, when RAM was rather unreliable and tended to fail, the good practice to do an (at least rudimentary) RAM test was established. Most BIOS RAM tests, even in the past, did check for rather basic faults, like not being able to clear or set a byte, which didn't cover all possible RAM failures (like e.g. changing one bit corrupting another) anyhow.

On modern computers with Gigabytes of (relatively reliable) memory, this has proven to be very time-consuming and somewhat unnecessary. Modern computers normally don't do a thorough RAM test anymore. They will do spot tests to detect the amount of installed RAM and verify RAM is generally working (typically, by clearing all available RAM), some BIOSes (HPe, for example) even allow the memory clear on reset to be switched off.

Thorough memory tests have to be either done in hardware (parity RAM) or by specific applications that the computer is being booted into.

tofro
  • 34,832
  • 4
  • 89
  • 170
  • For clarification: From https://en.wikipedia.org/wiki/Power-on_self-test "In earlier BIOSes, up to around the turn of the millennium, the POST would perform a thorough test of all devices, including a complete memory test." – Hasbo Feb 05 '23 at 16:58
  • On other machines, mainly high-end desktops and servers that support ECC memory, we found that the BIOS cleared memory contents without any override option. ECC memory must be set to a known state to avoid spurious errors if memory is read without being initialized, and we believe many ECC-capable systems perform this wiping operation whether or not ECC memory is installed. – Hasbo Feb 05 '23 at 17:01