What happens when an unlocked entry crosses the page boundary and an error occurs?

Say a 32-bit value is written to a memory cell that occupies 2 pages. For the sake of argument, suppose that 2 bytes end on the first page and 2 more in the second. The first page is writable, but the second page is not displayed. Executing the command as a whole will lead to a page crash and its termination.

My question is: will the page crash before or after the first 2 bytes of the value are written to memory? In other words, can a code working after a failure (for example, an error handler) be able to observe a partial write?

Suppose the X86 environment, as I suspect that the behavior may be architecture, or perhaps even model-specific.

+5
source share
1 answer

From the Intel Volume 3A Architecture Guide:

Access to cached memory separated by cache lines and page boundaries is not guaranteed by atomic Intel Core 2 Duo, Intelยฎ Atom โ„ข, Intel Core Duo, Pentium M, Pentium 4, Intel Xeon, P6, Pentium, and Intel486 family processors.

IMO not atomic means that your described scenario can happen. An interrupt can be generated after writing the first two bytes.

-3
source

Source: https://habr.com/ru/post/1272618/


All Articles