Skip to content

sharedmem: accept relative buffer offsets - #41

Open
monperrus wants to merge 1 commit into
linux-msm:masterfrom
monperrus:master
Open

sharedmem: accept relative buffer offsets#41
monperrus wants to merge 1 commit into
linux-msm:masterfrom
monperrus:master

Conversation

@monperrus

Copy link
Copy Markdown

Summary

Accept shared-memory request addresses expressed as offsets into the mapped
RMTFS region, while preserving support for the absolute physical addresses
handled by the current implementation.

Problem

On the MSM8909W downstream modem stack, sector requests arrive with values
such as phys_offset=0x200: a zero-based offset into the RMTFS allocation.
The current code always subtracts the mapping's physical base, treating the
value as an absolute physical address. The subtraction underflows and every
EFS transfer is rejected as out of bounds, preventing the modem from booting.

Change

  • Treat an address as relative when the complete requested span fits in the
    mapped allocation.
  • Otherwise retain the existing absolute-physical-address interpretation.
  • Use subtraction-based bounds checks so address and length arithmetic cannot
    overflow.
  • Apply the same normalization to the mmap and pread/pwrite backends.

Completed Validation

  • Cross-compiled sharedmem.c with GCC for ARMv7 (-Wall -Wextra).
  • Tested on a Huawei Watch 2 LTE (MSM8909W, downstream Linux 3.18).
  • RMTFS EFS reads completed after the change, the modem finished booting, and QMI DMS returned the device IMEI.

Signed-off-by: Martin Monperrus <martin.monperrus@gnieh.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant