Skip to content

LcRead fails for sub-page requests contained within the first 4KiB page #76

Description

@shih6

Hi, I found a possible issue in LcRead() when the requested range is fully contained in the first 4KiB page.

Reproduction:

  • page-aligned pa
  • LcRead(hLC, pa, 1, buffer) returns FALSE
  • a valid 4KiB-aligned LcReadScatter() request for the same page succeeds

In LcRead(), for pa aligned and cb = 1:

fFirst = TRUE
fLast = FALSE
cbData = cb - (0x1000 - (pa & 0xfff))
       = 1 - 0x1000
       = 0xfffff001

LcAllocScatter3() then rejects cbData, so LcRead() fails before issuing the backend read.

Was the intended calculation to subtract the actual first-page bytes, e.g.:

cbFirst = min(cb, 0x1000 - (pa & 0xfff));
cbData = cb - cbFirst - cbLast;

Is LcRead() intended to support sub-page contiguous reads such as 1B, 64B, and 4095B? The public API appears to imply that it should, while MEM_SCATTER entries remain page/DWORD constrained.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions