Skip to content

linux-user, fix: Limit private mmap shadows to SQLite - #389

Open
ganjue66da wants to merge 1 commit into
lat-opensource:masterfrom
ganjue66da:t1
Open

linux-user, fix: Limit private mmap shadows to SQLite#389
ganjue66da wants to merge 1 commit into
lat-opensource:masterfrom
ganjue66da:t1

Conversation

@ganjue66da

Copy link
Copy Markdown
Contributor

Wine maps SQLite database files privately. The host-page fragment fallback copies data with pread into anonymous memory, so later writes through the file descriptor are not visible. WXWork can then reopen a document approval as a white view.

The initial opt-in shadow path covered every writable file descriptor. On UOS this also shadowed writable PE cache files. WXWork could then fault in over_page_write during startup.

Require MAP_PRIVATE and a writable descriptor whose first 16 bytes match the SQLite database header. Other writable files keep the normal fragment fallback, while SQLite fragments remain file-backed when LATX_PRIVATE_MMAP_SHADOW=1.

Tests:

  • UOS WXWork 5.0.0.6008: launch and reopen one document approval
  • Linux and Wine SQLite regression: 10,000 mmap query/update iterations

Summary / 变更说明

Validation / 验证

Checklist / 检查项

  • I have read CONTRIBUTING.md. / 我已阅读 CONTRIBUTING.md
  • Every commit contains a DCO sign-off (git commit -s). /
    每个提交都包含 DCO 签署(git commit -s)。
  • I have included relevant build or test results, or explained why they
    are not applicable. /
    我已提供相关构建或测试结果,或说明了不适用的原因。

Wine maps SQLite database files privately. The host-page fragment
fallback copies data with pread into anonymous memory, so later writes
through the file descriptor are not visible. WXWork can then reopen a
document approval as a white view.

The initial opt-in shadow path covered every writable file descriptor.
On UOS this also shadowed writable PE cache files. WXWork could then
fault in over_page_write during startup.

Require MAP_PRIVATE and a writable descriptor whose first 16 bytes match
the SQLite database header. Other writable files keep the normal
fragment fallback, while SQLite fragments remain file-backed when
LATX_PRIVATE_MMAP_SHADOW=1.

Tests:
- UOS WXWork 5.0.0.6008: launch and reopen one document approval
- Linux and Wine SQLite regression: 10,000 mmap query/update iterations

Signed-off-by: Wenqiang Wei <weiwenqiang@mail.ustc.edu.cn>
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