scroll-tech / scroll-tech/ceno

fix bss/sbss from static read-only to rw

Open
#1,029 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
153
Forks
43
Avg merge
3d 13h
Merged PRs (30d)
4

Description

The command

MOCK_PROVING=1 cargo run --features sanity-check --package ceno_zkvm --bin e2e -- --platform=ceno examples/target/riscv32im-ceno-zkvm-elf/debug/examples/ceno_rt_alloc

failed with read/write inconsistency.

The reason is for now when load elf, we treat bss/sbss read-only with other program data, e.g. text, rodata etc.
https://github.com/scroll-tech/ceno/blob/469890b7fb0181f6250174b1aded29b98491560f/ceno_emul/src/elf.rs#L206-L215

However bss/sbss are for static variables, e.g. for the guest program
https://github.com/scroll-tech/ceno/blob/469890b7fb0181f6250174b1aded29b98491560f/examples/examples/ceno_rt_alloc.rs#L8

Thus we need to make bss/sbss appeared in RAM region.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in ceno_emul/src/elf.rs around the ELF segment handling at lines 206-215, then inspect examples/examples/ceno_rt_alloc.rs to understand the static allocation that exposes the issue. Run the provided cargo e2e command with sanity-check enabled. Done means bss/sbss are represented in the RAM region and the read/write inconsistency no longer occurs.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.